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

Bug 1357107

Summary: Custom Image Environment Variables With '=' Character Are Truncated
Product: OpenShift Container Platform Reporter: Steven Walter <stwalter>
Component: Management ConsoleAssignee: Jessica Forrester <jforrest>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.2.0CC: aos-bugs, jforrest, jokerman, mmccomas, tdawson, trogers
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: During the Add to Project workflow when picking a source builder image, the environment variables coming from the builder image were being split into key value pairs using the '=' character, but only the first two parts were being kept as the key and value. Consequence: Environment variable values that contained an '=' character were being truncated. In 3.2 this meant that an env var was getting stored that actually overrode the env var to the truncated version. In 3.3 and later this was just being shown visually since we no longer stored env vars on the deployment configuration that were already coming from the builder image. Fix: The environment variable key and value are only split on the first '=' character and everything after the first one is considered part of the value. Result: The environment variable key and value are correctly split and not truncated when the value contains a '=' character.
Story Points: ---
Clone Of:
: 1429550 (view as bug list) Environment:
Last Closed: 2017-04-12 19:06:03 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:

Description Steven Walter 2016-07-15 18:58:32 UTC
Description of problem:
When using a custom image and setting an environment variable with an '=' character in the value, the environment variable is truncated out.

Version-Release number of selected component (if applicable):
OSE 3.2.0, OSE 3.1.1, Docker 1.9.1

How reproducible:
Reproduced in 3.2.0 with Docker 1.9.1, reported but untested with OSE 3.1.0

Steps to Reproduce:
Make a docker file with contents:
~~~
FROM registry.access.redhat.com/jboss-eap-6/eap64-openshift:latest
ENV JVM_ARG_TEST_CASE="-Dname1=value1 -Dname2=value2"
~~~
docker build
docker tag <resulting image> <internal registry ip>:<port>/openshift/testimage
docker push <ip>:<port>/openshift/testimage

Go to web console, "add to project", select the image stream previous steps created. Then go to "Show advance routing, build and deployment options", look at environment variables.


Actual results:
JVM_ARG_TEST_CASE -Dname1


Expected results:
JVM_ARG_TEST_CASE -Dname1=value1 -Dname2=value2

Additional info:
There is a way for this particular use case using CATALINA_OPTS_APPEND as discussed in http://post-office.corp.redhat.com/archives/openshift-sme/2016-July/msg00201.html but the issue could occur for other potential cases

Comment 1 Ben Parees 2016-07-15 19:05:08 UTC
Jessica starting w/ you, but I guess it's also possible the image metadata itself is incorrect/being stripped, in which case it should go to platform management.

Comment 2 bpeterse 2016-07-15 20:36:03 UTC
I'll check into this.

Comment 3 Jessica Forrester 2016-11-08 15:41:24 UTC
@bpeterse looking at the source I can see we definitely have a bug here, we are splitting the dockerImageMetadata.Config.Env on "=" and assuming that will only result in two parts. See createFromImage.js where we set scope.DCEnvVarsFromImage

Please fix that, and then we will need to determine if that is the only issue or if there is also a problem with the metadata being imported.

Comment 4 Troy Dawson 2017-01-20 23:19:56 UTC
This has been merged into ocp and is in OCP v3.5.0.7 or newer.

Comment 5 Yadan Pei 2017-01-22 06:36:15 UTC
Tested with OCP v3.5.0.7 and docker 1.12.6

1.Build images
Make a docker file with contents:
~~~
FROM registry.access.redhat.com/jboss-eap-6/eap64-openshift:latest
ENV JVM_ARG_TEST_CASE="-Dname1=value1 -Dname2=value2"
~~~
docker build
docker tag <resulting image> <internal registry ip>:<port>/openshift/testimage
docker push <ip>:<port>/openshift/testimage

2.Visit https://<master>:<port>/console/project/<your_project>/create/fromimage?imageStream=testimage&imageTag=test&namespace=openshift

3.Click to Show advanced options
4.Click "Show Image Environment Variables" in Deployment Configuration section, environment variables are shown as 
JVM_ARG_TEST_CASE  -Dname1=value1 -Dname2=value2


Move to VERIFIED

Comment 9 errata-xmlrpc 2017-04-12 19:06:03 UTC
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-2017:0884