Bug 2026297 - Use '&' (ampersand) in environment variables of oc start-build in Openshift 4.6
Summary: Use '&' (ampersand) in environment variables of oc start-build in Openshi...
Keywords:
Status: CLOSED DUPLICATE of bug 1918153
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build
Version: 4.6.z
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.10.0
Assignee: Otávio Fernandes
QA Contact: Jitendar Singh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-24 10:16 UTC by JS
Modified: 2024-12-20 21:38 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-01-06 13:29:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description JS 2021-11-24 10:16:58 UTC
Description of problem:
Using oc start-build with environment variables that contains '&' will be encoded to \u0026

Version-Release number of selected component (if applicable):
Tested and confirmed on OCP 4.6:
- 4.6.27
- 4.6.49

How reproducible:
Always

Steps to Reproduce:
1. Create a new namespace `$ oc new-project namespace-dev`
2. Start a dummy out of box app `$ oc new-app https://github.com/openshift/ruby-hello-world --name=ruby-hello`
3. Start a build with environment variables `$oc start-build ruby-hello --env=ARTIFACT_URL='http://some.url.com/with?query=params&second=param' --env=ARTIFACT_URL_02='http&'`
4. Check the environment variables from the new generated POD `$ oc rsh <POD> env | grep ARTIFACT_URL`

Actual results:
From OCP 4.6.z

```
$ oc rsh ruby-hello-546cff6d5b-jk48h env | grep ARTIFACT_URL
ARTIFACT_URL=http://some.url.com/with?query=params\u0026second=param
ARTIFACT_URL_02=http\u0026
```

Expected results:
From OCP 4.7.11

```
$ oc rsh pod/ruby-hello-8f69774d4-bs9jv env | grep ARTIFACT_URL
ARTIFACT_URL=http://some.url.com/with?query=params&second=param
ARTIFACT_URL_02=http&
```

Additional info:
- Not all apps will know how to convert `\u0026`

Comment 1 Maciej Szulik 2021-11-30 15:51:56 UTC
Moving to build team who owns that bit of oc.

Comment 4 Otávio Fernandes 2022-01-06 13:29:04 UTC
Given the issue only happens in 4.6, it's too late for back-porting at this point. Therefore closing this BZ.

I have tested the solution applied in 4.7, back ported to 4.6 via this "draft"  pull-request: https://github.com/openshift/builder/pull/278 . The experiment shows it fixes the issue back in 4.6 as well.

*** This bug has been marked as a duplicate of bug 1918153 ***

Comment 5 Gabe Montero 2022-01-06 15:18:54 UTC
As a reminder to everyone watching this bz, the support dates for 4.x are at  https://access.redhat.com/support/policy/updates/openshift#dates and the state of 4.6.z that Otavio alluded to in #Comment 4 is noted there


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