Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1952929

Summary: 02912673 | Using oc start-build with '--from-file' sometimes corrupts exactly one byte of a jar file
Product: OpenShift Container Platform Reporter: David Caldwell <dcaldwel>
Component: BuildAssignee: Adam Kaplan <adam.kaplan>
Status: CLOSED EOL QA Contact: wewang <wewang>
Severity: medium Docs Contact:
Priority: high    
Version: 4.5CC: adam.kaplan, aos-bugs, cdaley, nalin, sgehwolf, vnema
Target Milestone: ---   
Target Release: 4.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-19 15:34:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Caldwell 2021-04-23 15:25:36 UTC
Description of problem:

Note that customer is on Azure platform.

Customer is using 'oc start-build' as part of a pipeline. They have noticed (with about a 1 in 10 occurrence?) that when they use '--from-file' this process sometimes corrupts exactly one byte of a jar file being copied into the container image to the '/deployments' directory. When they use '--from-dir' instead, the corruption does not seem to happen.


Version-Release number of selected component (if applicable):

OCP4.6.x + Azure platform (customer says that this did not happen on 4.5.x + AWS platform and that their build process has not been changed)


Steps to Reproduce:

# 1. Verify jar on jenkins agent pod
14:06:24  + jar xf target.jar
# 2. Print size of the jar on jenkins agent pod
14:06:25  + ls -al target.jar
14:06:25  -rw-r--r--. 1 1001 root 91351065 Apr 16 12:06 target.jar

[at this point, the jar file is the correct size]

# 3. Copy jar to persistent pod in order to analyze
14:06:26  + oc rsh example-0 bash -c 'mkdir -p /usr/share/nginx/html/test'
14:06:34  + oc cp target.jar example-0:/usr/share/nginx/html/test/
# 4. Print size of the jar on persistent pod 
14:06:36  + oc rsh example-0 bash -c 'ls -al target.jar'
14:06:36  -rw-r--r--. 1 1001 root 91351065 Apr 16 12:06 target.jar

[at this point, the jar file is still the correct size]

# 5. Run oc start-build, that build the image with input jar and push it to the repository
14:06:37  + oc start-build bc/target-service --from-file=target.jar

[after this point, the jar file is not the correct size (-1 byte) when the /deployments directory is examined and also "Error: Invalid or corrupt jarfile" is produced in the log]

If the customer uses '--from-dir' instead of --from-file' in the oc start-build command, the corruption does not seem to happen.


Actual results:
target.jar is exactly one byte short after being copied to the /deployments directory (happens about 10% of the time) when using --from-file.


Expected results:
target.jar is copied intact every time.

Additional info:
Please see the attachments for more process details and logs.

Comment 6 David Caldwell 2021-04-28 12:24:05 UTC
The customer has tested using two different oc clients. Versions below:

~~~
$ oc version
Client Version: 4.6.0-202104091041.p0-c3dc785
Server Version: 4.6.25
Kubernetes Version: v1.19.0+a5a0987
~~~

&

~~~
$ oc version
Client Version: openshift-clients-4.5.0-202006231303.p0-21-g297a4ac42
Kubernetes Version: v1.19.0+a5a0987
~~~


Tar version used:

~~~
$ tar --version
tar (GNU tar) 1.26
~~~

Comment 7 Corey Daley 2021-05-12 19:42:13 UTC
According to https://www.gnu.org/software/tar/, version 1.26 was released in 2011, which is over a decade old. Can the client try using a more recent version and see if they have the same results?

Comment 20 David Caldwell 2021-08-06 06:07:31 UTC
It appears that the Jenkins agent image contains an old version (1.26 release ~2011) of the tar utility. Is it possible to update the Jenkins agent image with a newer tar version? Would this solve the issue when using 'oc start-build ... --from-file'?

Comment 21 Adam Kaplan 2021-08-19 15:21:49 UTC
@David The Jenkins 4.5 agent image is RHEL 7 based and uses the older tar utility. The Jenkins agent for 4.6 and higher is RHEL 8 based and uses a newer version of tar:

```
$ podman run --authfile=/path/to/pull-secret.json -i -t --rm --entrypoint=/bin/bash registry.redhat.io/openshift4/ose-jenkins-agent-maven:v4.6
bash-4.4$ tar --version
tar (GNU tar) 1.30
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
bash-4.4$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.2 (Ootpa)
```

OCP 4.5 images have reached the end of their maintenance support lifecycles - users should update their agent images to use a supported version of OCP. We will not backport any fixes to the 4.5 image per our update support policy [1]. Any fixes related to the newer version of tar will not be backported to the 4.5 image.


[1] https://access.redhat.com/support/policy/updates/openshift

Comment 23 Adam Kaplan 2021-10-27 13:00:19 UTC
*** Bug 2011654 has been marked as a duplicate of this bug. ***