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

Bug 1590730

Summary: In chained builds, `io.openshift.build.commit.id` label is missing from runtime image
Product: OpenShift Container Platform Reporter: Pili Guerra <pguerra>
Component: RFEAssignee: Ben Parees <bparees>
Status: CLOSED WONTFIX QA Contact: Xiaoli Tian <xtian>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.9.0CC: aos-bugs, jokerman, mmccomas
Target Milestone: ---   
Target Release: ---   
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: 2019-06-12 11:55:17 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:
Attachments:
Description Flags
Output from `oc export isimage runtime@97591f901fa49eb88ae924dd12dccae37911cd91d8f2e9aca719230521d3e6f3`
none
Output from `oc export isimage artifact-builder@6c2dee2c103e30b988aedd773b8c1b58a1e526c8537f415fa9f8c3b66af2f6e4` none

Description Pili Guerra 2018-06-13 09:37:01 UTC
Created attachment 1450829 [details]
Output from `oc export isimage runtime@97591f901fa49eb88ae924dd12dccae37911cd91d8f2e9aca719230521d3e6f3`

Description of problem:

Customer is trying to link the running container of a chained build to the commit of the compiled code inside it.

He wants to use the `io.openshift.build.commit.id` label or OPENSHIFT_BUILD_COMMIT environment variable to do this but this information is lost when using chained builds on OpenShift.

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

OpenShift 3.9

How reproducible:

Always

Steps to Reproduce:

1. oc new-build jorgemoralespou/s2i-java~https://github.com/jorgemoralespou/s2i-java --context-dir=/test/test-app-gradle/ --name=artifact-builder
2. oc new-build --name=runtime --docker-image=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift --source-image=artifact-builder --source-image-path=/opt/openshift/app.jar:. --dockerfile=$'FROM registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift\nCOPY app.jar /deployments/app.jar' --strategy=docker
3. Compare imagestream image labels/environment variables in artifact-builder and runtime images. Runtime image is missing.

Actual results:

see attached builder-image.txt vs runtime-image.txt

Expected results:

Environment variables/labels are copied to runtime image.

Additional info:

Comment 1 Pili Guerra 2018-06-13 09:38:20 UTC
Created attachment 1450830 [details]
Output from `oc export isimage artifact-builder@6c2dee2c103e30b988aedd773b8c1b58a1e526c8537f415fa9f8c3b66af2f6e4`

Comment 2 Ben Parees 2018-06-13 13:02:07 UTC
Since the second build is effectively just an independent build that's copying some content from an existing image, there's no commit to associate w/ the build.

If you want to fake it out, you could include the git repo reference in your second build also, but not actually have your second build include any of the content from the git repo.  That would cause openshift to pick up the commit from the repo and label the image accordingly.

There is a slight risk that you could have the following sequence of events, however:

1) builder build runs w/ git repo commit "1"
2) commit "2" is pushed to the git repo before the second build in the chain starts
3) runtime build runs, picking up binary content from commit "1" (from step 1), but labels the image as being from commit "2" (as picked up from the current state of the repo).


We can carry this as an RFE but the only solution that comes to mind would be for us to allow you to copy labels from the input image into the output image, for a build.  There's nowhere else to get the commit information.

Comment 5 Kirsten Newcomer 2019-06-12 11:55:17 UTC
With the introduction of OpenShift 4, Red Hat has delivered or roadmapped a substantial number of features based on feedback by our customers.  Many of the enhancements encompass specific RFEs which have been requested, or deliver a comparable solution to a customer problem, rendering an RFE redundant.

This bz (RFE) has been identified as a feature request not yet planned or scheduled for an OpenShift release and is being closed. 

If this feature is still an active request that needs to be tracked, Red Hat Support can assist in filing a request in the new JIRA RFE system, as well as provide you with updates as the RFE progress within our planning processes. Please open a new support case: https://access.redhat.com/support/cases/#/case/new 

Opening a New Support Case: https://access.redhat.com/support/cases/#/case/new 

As the new Jira RFE system is not yet public, Red Hat Support can help answer your questions about your RFEs via the same support case system.