Description of problem: Setting environment variable using shell variable, e.g. ${user.home} leads to error during build Missing ':' in substitution: "${user.home}" Version-Release number of selected component (if applicable): OCP 4.1.0-rc.5 How reproducible: Steps to Reproduce: oc login url oc create -f ./build_config.yaml oc start-build env-reproducer-bc --follow Builds ends with error error: build error: error resolving step {Value:env Next:0xc4208e32d0 Children:[] Attributes:map[] Original:ENV OPENSHIFT_BUILD_NAME="env-reproducer-bc-2" OPENSHIFT_BUILD_NAMESPACE="default" TEST="${user.home}" Flags:[] StartLine:3 endLine:3}: Missing ':' in substitution: "${user.home}" build_config.yaml: kind: BuildConfig apiVersion: build.openshift.io/v1 metadata: name: env-reproducer-bc namespace: default spec: nodeSelector: null output: {} resources: {} successfulBuildsHistoryLimit: 5 failedBuildsHistoryLimit: 5 strategy: type: Source sourceStrategy: from: kind: DockerImage name: 'registry.access.redhat.com/jboss-eap-7/eap72-openshift:1.0' env: - name: TEST value: '${user.home}' postCommit: {} source: type: None triggers: - type: ConfigChange runPolicy: Serial status: lastVersion: 1 Additional info: Reproducer is working fine on OCP 3.11. I assume that has something to do with replacing docker with other container technologies on OCP cluster.
Created attachment 1571511 [details] build.log
Could reproduce this with customer case in 4.1.0-0.nightly-2019-05-21-005558 version. And works with v3.11.115 and v3.10.145.
Moving to the Containers component - bug appears to be in buildah processing the Dockerfile. We can't call this issue closed until the issue is fixed in buildah and merged into openshift/builder. We will also want to backport the fix to 4.1.z.
Hmm, it looks like it's producing an error when the variable name includes a '.'. When I try the logged instructions using a Dockerfile with 'docker build' (both moby-engine-18.06.3-2.ce.gitd7080c1.fc30.x86_64 or docker-1.13.1-96.gitb2f74b2.el7.x86_64), I get the same `Missing ':' in substitution: "${user.home}"` error: FROM registry.access.redhat.com/jboss-eap-7/eap72-openshift:1.0 LABEL "io.openshift.build.image"="registry.access.redhat.com/jboss-eap-7/eap72-openshift:1.0" "io.openshift.build.source-location"="/tmp/build/inputs" ENV OPENSHIFT_BUILD_NAME="env-reproducer-bc-2" OPENSHIFT_BUILD_NAMESPACE="default" TEST="${user.home}" A bit of experimenting with 3.11.98 suggests that for s2i builds, environment variables set in the build config weren't being expanded, and ended up being set as specified in the resulting image's config blob, and the trigger for the build failing is that we're attempting to do so now.
This looks like a combination of https://github.com/openshift/source-to-image/pull/969 and https://github.com/containers/buildah/pull/1607.
*** Bug 1712855 has been marked as a duplicate of this bug. ***
PR: https://github.com/openshift/builder/pull/76
Wen - is this ON_QA yet? Cloned BZ for 4.1.z has been verified.
Verified version: 4.2.0-0.nightly-2019-06-24-160709
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:2922