Bug 1965376
| Summary: | Wrong interpolation in environment values in the build pod | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | Nikolaos Leandros Moraitis <nmoraiti> |
| Component: | Build | Assignee: | Corey Daley <cdaley> |
| Status: | CLOSED ERRATA | QA Contact: | Jitendar Singh <jitsingh> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 4.7 | CC: | aaleman, adam.kaplan, aos-bugs, cdaley, skuznets |
| Target Milestone: | --- | ||
| Target Release: | 4.8.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-10-12 06:01:19 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: | |||
Notably, we pass in: > "{\"title\":\"Revert \\\"Wait for expected number of drivers starting API\\\"\"}" As the value. By the time the Go program reads it, this looks like: > {"title":"Revert \\"Wait for expected number of drivers starting API\\""} On a normal system: $ DATA="{\"title\":\"Revert \\\"Wait for expected number of drivers starting API\\\"\"}" $ echo $DATA {"title":"Revert \"Wait for expected number of drivers starting API\""} @nmoraiti Can you verify what the value of the env var looks like in the build yaml? And I am guessing that you were able to rsh into the build pod to get the referenced output above for the value of the `DATA` env var? This seems fixed in 4.8.0-rc.1 verified 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 (OpenShift Container Platform 4.8.14 bug fix update), 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-2021:3682 The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days |
Description of problem: Then the JSON value of the environment variable contains escaped quotes the build pod's interpolation causes failures while unmarshaling the JSON data. Version-Release number of selected component (if applicable): 4.7 How reproducible: kind: ImageStream apiVersion: v1 metadata: name: output --- apiVersion: v1 kind: BuildConfig metadata: name: output spec: output: to: kind: ImageStreamTag name: output:latest source: dockerfile: | FROM registry.ci.openshift.org/openshift/release:golang-1.16 RUN echo $'package main\nimport "encoding/json"\nimport "os"\nimport "fmt"\ntype data struct{\n Title string\n}\nfunc main() {\n fmt.Println(os.Getenv("DATA")) \n var d data\n if err := json.Unmarshal([]byte(os.Getenv("DATA")), &d); err != nil {\n panic(err)\n } else {\n fmt.Println(d.Title)\n }\n}' > read.go RUN cat read.go RUN go run read.go strategy: dockerStrategy: from: kind: DockerImage name: registry.ci.openshift.org/openshift/release:golang-1.16 imageOptimizationPolicy: SkipLayers env: - name: DATA value: "{\"title\":\"Revert \\\"Wait for expected number of drivers starting API\\\"\"}"