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

Bug 1560608

Summary: [3.7] Binary build with --from-file not working
Product: OpenShift Container Platform Reporter: Vladislav Walek <vwalek>
Component: BuildAssignee: Ben Parees <bparees>
Status: CLOSED CURRENTRELEASE QA Contact: Wenjing Zheng <wzheng>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.7.0CC: aos-bugs, bleanhar, bparees, openshift-bugs-escalate, smunilla, vlaad, wewang, wzheng
Target Milestone: ---   
Target Release: 3.7.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Build pods use multiple containers. Binary builds need to specify which container to stream content into, and for custom builds the name of the container is different from non-custom builds. Consequence: When streaming binary content into a custom build, the expected container (git-clone) does not exist and the build fails. Fix: The logic for streaming binary content into a custom build pod will be changed to reference the correct container name (custom-build) Result: Binary content will successfully stream into the custom build container.
Story Points: ---
Clone Of:
: 1560659 1560661 (view as bug list) Environment:
Last Closed: 2018-08-29 14:02:33 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:
Bug Depends On:    
Bug Blocks: 1560659, 1560661    

Description Vladislav Walek 2018-03-26 14:48:57 UTC
Description of problem:

We are running OpenShift Container Platform v3.7, containerized. 

We are using a custom build strategy to build and release docker images to our internal docker registry. 
This strategy works fine but after upgrading to OCP 3.7 we cannot use the binary option --from-file in the oc client. Each time we run the command "oc start-build <bc_name> --from-file=<file_to_use>.zip" , we get the following error message:
- command
oc start-build aapplication --from-file=openshift-application.zip --follow --wait
- message
Uploading file "openshift-application.zip" as binary input for the build ...
Error from server (BadRequest): container git-clone is not valid for pod <bc_name>-<number>-build


Version-Release number of selected component (if applicable):
OpenShift Container Platform 3.7

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Ben Parees 2018-03-26 17:52:43 UTC
PR: https://github.com/openshift/ose/pull/1163

Comment 4 wewang 2018-03-27 05:54:59 UTC
I can reproduce the bug in version
openshift v3.7.40
kubernetes v1.7.6+a08f5eeb62
etcd 3.2.8
oc v3.7.40

-message
# oc start-build ruby-sample-build --from-file=ruby-hello-world.zip --follow --wait  --loglevel=5
Uploading file "ruby-hello-world.zip" as binary input for the build ...
I0327 01:52:31.535955   62891 helpers.go:206] server response object: [{
  "metadata": {},
  "status": "Failure",
  "message": "container git-clone is not valid for pod ruby-sample-build-5-build",
  "reason": "BadRequest",
  "code": 400
}]
F0327 01:52:31.536062   62891 helpers.go:120] Error from server (BadRequest): container git-clone is not valid for pod ruby-sample-build-5-build

Comment 10 Wenjing Zheng 2018-04-17 09:00:47 UTC
Have tested with ocp v3.7.44, met below error when do binary build for custom strategy:
$ oc start-build ruby-sample-build --from-file=ruby-hello-world.zip --follow --wait  --loglevel=5
Uploading file "ruby-hello-world.zip" as binary input for the build ...
build "ruby-sample-build-7" started
Could not access source url: 
F0417 16:58:01.171596   32348 helpers.go:119] error: the build wzheng2/ruby-sample-build-7 status is "Failed"

Comment 11 Ben Parees 2018-04-17 14:08:12 UTC
Wenjing, what image did you use as your custom builder image?  

There is no source url because it's a binary build, so the logic in our sample custom builder which tries to access the source url will fail:  
https://github.com/openshift/origin/blob/master/images/builder/docker/custom-docker-builder/build.sh#L33

To do a binary build w/ a custom builder image, you need your custom builder's entrypoint script to do a "tar -xf -" to extract the incoming binary content (and then whatever logic you want to process the content).  You can't use the sample custom builder image.  I'm pretty sure we don't have any existing tests for this scenario.

Comment 12 Wenjing Zheng 2018-04-18 09:38:45 UTC
OK, I will build a custom builder image to verify this bug. Thx for the info!

Comment 13 Wenjing Zheng 2018-04-19 07:21:52 UTC
Verified with below steps on v3.7.44:
1. Edit custom builder image Dockerfile like below:
#CMD ["/tmp/build.sh"]
ENTRYPOINT tar -xf -
2. docker build . -t custom-builder
3. Create a custom build with above customized builder image
4. git clone https://github.com/openshift/ruby-hello-world; tar -cf ruby-hello-world.tar.gz ruby-hello-world
5. $ oc start-build ruby-sample-build --from-file=ruby-hello-world.tar.gz --follow --wait  --loglevel=5
Uploading file "ruby-hello-world.tar.gz" as binary input for the build ...
build "ruby-sample-build-2" started


build "ruby-sample-build-2" will go completed at last.