Description of problem: When start a build manually, --env option does't work with --from-repo --from-dir, --from-file binary build option Version-Release number of selected component (if applicable): ami:devenv-rhel7_2913 openshift v1.1-389-g84776cf kubernetes v1.1.0-origin-1107-g4c8e6f4 How reproducible: always Steps to Reproduce: 1.start openshift and create a project 2.create imagestream under openshift namespace 3.oc new-app -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/build/ruby22rhel7-template-docker.json 4. clone the ruby-hello-world repo to local $git clone https://github.com/openshift/ruby-hello-world 5. start a build using from-repo option $oc start-build <bcname> --from-repo=./ruby-hello-world --env=RACK_ENV=development 6. oc logs -f <pod> Actual results: The env RACK_ENV=development should replace RACK_ENV=production in the Dockerfile [root@ip-172-18-2-6 ruby-hello-world]# oc logs ruby22-sample-build-5-build -f Step 0 : FROM registry.access.redhat.com/rhscl/ruby-22-rhel7 ---> 9416bc460d0c Step 1 : ENV "EXAMPLE" "sample-app" ---> Using cache ---> c72e4041bdd9 Step 2 : USER default ---> Using cache ---> 56500b8b4789 Step 3 : EXPOSE 8080 ---> Using cache ---> 71caac7c76cb Step 4 : ENV RACK_ENV production ---> Using cache ---> b3d66932c12b Step 5 : ENV RAILS_ENV production ---> Using cache ---> 07b568cafc1b Step 6 : COPY . /opt/app-root/src/ ---> abb0b4e85b58 Removing intermediate container 76169cdccb5a Step 7 : RUN scl enable rh-ruby22 "bundle install" ---> Running in b658e7601d64 Fetching gem metadata from https://rubygems.org/.......... Installing rake 10.3.2 Installing i18n 0.6.11 Installing json 1.8.3 Installing minitest 5.4.2 Installing thread_safe 0.3.4 Installing tzinfo 1.2.2 Installing activesupport 4.1.7 Installing builder 3.2.2 Installing activemodel 4.1.7 Installing arel 5.0.1.20140414130214 Installing activerecord 4.1.7 Expected results: The env should replace the env RACK_ENV=production defined in the Dockerfile Additional info:
1. This has nothing to do with options --from-repo --from-dir, --from-file, issue reproduced if trigger new build without these options: $oc start-build <bcname> --env=RACK_ENV=development 2. The step4 of command output "oc logs -f" kept saying "Step 4 : ENV RACK_ENV production" regardless of how we set value to RACK_ENV in --env when doing "oc start-build"
(In reply to Xia Zhao from comment #1) > 1. This has nothing to do with options --from-repo --from-dir, --from-file, > issue reproduced if trigger new build without these options: > $oc start-build <bcname> --env=RACK_ENV=development > I think it's different code logic , both exists the problem. > 2. The step4 of command output "oc logs -f" kept saying "Step 4 : ENV > RACK_ENV production" regardless of how we set value to RACK_ENV in --env > when doing "oc start-build" If start the build like what you said , it will add the env in the step 1. and then overlaped by step 4. if there is a new env not exits in previous dockerfile , this option will work.So problem is the env passed through --env option haven't replace the exits one in dockerfile .
I think this is a bug but not related to the binary build. The --env option was added recently, I will have a look.
After some investigation the bug that the --env option is passed into a BuildRequest from CLI, but the binary builds are using BinaryBuildRequest, where this field is missing. I'm fixing this now, so you're right, this is actually related to the binary builds ;-)
Upstream issue about this: https://github.com/kubernetes/kubernetes/issues/18649
Wang: This bug will be fixed by showing a warning when you use --env/--build-loglevel with combination with binary build source. The warning PR is here: https://github.com/openshift/origin/pull/6298 I think this bug can be verified and closed.
will verify this once the PR is merged.
the --env options is removed from the oc start-build command , so this senario will disappear. origin version: openshift v1.1-428-ged29520
Moving NeedInfo tag.
*** Bug 1257254 has been marked as a duplicate of this bug. ***