Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPENSHIFT_BUILD_COMMIT env var not set when build is trigged manually #6817

Closed
bleporini opened this issue Jan 25, 2016 · 3 comments
Closed
Assignees
Labels
area/usability component/build kind/bug Categorizes issue or PR as related to a bug. priority/P3

Comments

@bleporini
Copy link

Hello,

When a build is started from a webhook (here from Github), the OPENSHIFT_BUILD_COMMIT environment variable is correctly set at the end of the build:

Step 22 : ENV "OPENSHIFT_BUILD_NAME" "xxxxxxxxxxxx-26" "OPENSHIFT_BUILD_NAMESPACE" "xxxxxxxxxxxxx" "OPENSHIFT_BUILD_SOURCE" "git@github.com:xxxxxxxxxxxxxxx" "OPENSHIFT_BUILD_REFERENCE" "master" "OPENSHIFT_BUILD_COMMIT" "6a4d2581812068c9a0b0a0f058711c04567beba3"
 ---> Running in 13e28cf3c00d
 ---> 3412359810b7
Removing intermediate container 13e28cf3c00d
Step 23 : LABEL "io.openshift.build.commit.author" "Brice LEPORINI \u003cbleporini@gmail.com\u003e" "io.openshift.build.commit.date" "Mon Jan 25 10:49:23 2016 +0100" "io.openshift.build.commit.id" "6a4d2581812068c9a0b0a0f058711c04567beba3" "io.openshift.build.commit.ref" "HEAD" "io.openshift.build.commit.message" "xxxxxxxxxxxx " "io.openshift.build.source-location" "git@github.com:xxxxxxxxxxxxxxxx" "io.openshift.build.source-context-dir" "/"
 ---> Running in d558da38fb34

But if you trig it manually with a oc start-build bc/my-build-cfg for example, the OPENSHIFT_BUILD_COMMIT variable is missing, but the commit id is still available as an image label :

Step 22 : ENV "OPENSHIFT_BUILD_NAME" "xxxxxxxxxxx-27" "OPENSHIFT_BUILD_NAMESPACE" "xxxxxxxxxxx" "OPENSHIFT_BUILD_SOURCE" "git@github.com:xxxxxxxxxxxx/xxxxxxxxxxx.git" "OPENSHIFT_BUILD_REFERENCE" "master"
 ---> Running in 084b3505d669
 ---> 43bf03ac0ff5
Removing intermediate container 084b3505d669
Step 23 : LABEL "io.openshift.build.commit.author" "Brice LEPORINI \u003cbleporini@gmail.com\u003e" "io.openshift.build.commit.date" "Mon Jan 25 10:49:23 2016 +0100" "io.openshift.build.commit.id" "6a4d2581812068c9a0b0a0f058711c04567beba3" "io.openshift.build.commit.ref" "master" "io.openshift.build.commit.message" "xxxxxxxxxxxxxxxxxxxxxxxxxx" "io.openshift.build.source-location" "git@github.com:xxxxxxxxxxx/xxxxxxxxxxx.git" "io.openshift.build.source-context-dir" "/"
 ---> Running in 70b43973a452

Is it an expected behavior?

@mfojtik
Copy link
Member

mfojtik commented Jan 26, 2016

@bleporini no, I think this is a bug. @bparees ?

@mfojtik mfojtik added kind/bug Categorizes issue or PR as related to a bug. area/usability priority/P3 component/build labels Jan 26, 2016
@bparees
Copy link
Contributor

bparees commented Jan 26, 2016

yeah it's a bug, we should be adding the commit information in a consistent way:

  1. clone the git repo
  2. check out the requested commit/ref (if any, otherwise master)
  3. check what the current commit information is
  4. apply that commit information as labels/env/etc.

i'm guessing this is currently broken because the ENV comes from the webhook info and the label comes from the flow I just described.

@bparees bparees self-assigned this Jan 26, 2016
@bparees bparees assigned php-coder and unassigned bparees Apr 8, 2016
@php-coder php-coder assigned bparees and unassigned php-coder Nov 4, 2016
@bparees
Copy link
Contributor

bparees commented Jan 3, 2017

closing this issue since we are now tracking this in https://bugzilla.redhat.com/show_bug.cgi?id=1408879

@bparees bparees closed this as completed Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/usability component/build kind/bug Categorizes issue or PR as related to a bug. priority/P3
Projects
None yet
Development

No branches or pull requests

4 participants