Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1357107 - Custom Image Environment Variables With '=' Character Are Truncated
Custom Image Environment Variables With '=' Character Are Truncated
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console (Show other bugs)
3.2.0
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Jessica Forrester
Yadan Pei
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-07-15 14:58 EDT by Steven Walter
Modified: 2017-07-24 10 EDT (History)
6 users (show)

See Also:
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 15:06:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0884 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.5 RPM Release Advisory 2017-04-12 18:50:07 EDT

  None (edit)
Description Steven Walter 2016-07-15 14:58:32 EDT
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 15:05:08 EDT
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 16:36:03 EDT
I'll check into this.
Comment 3 Jessica Forrester 2016-11-08 10:41:24 EST
@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 18:19:56 EST
This has been merged into ocp and is in OCP v3.5.0.7 or newer.
Comment 5 Yadan Pei 2017-01-22 01:36:15 EST
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 15:06:03 EDT
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

Note You need to log in before you can comment on or make changes to this bug.