Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Fix variable interpolation in the workflows #1277

Merged
merged 2 commits into from
Jul 24, 2024
Merged

Conversation

i5okie
Copy link
Contributor

@i5okie i5okie commented Jul 24, 2024

The inline variable setting commands do not correctly interpret the environment variables. This results in variables not being updated:

$ export IMAGE_TAG=sha-c78888
$ yq e -vi '.traction.ui.image.tag = $IMAGE_TAG' services/traction/charts/dev/values.yaml
...
10:40:15 GetMatchingNodes [DEBU] >>
10:40:15 getVariableOperator [DEBU] getVariableOperator IMAGE_TAG
10:40:15 PrintResults [DEBU] PrintResults for 1 matches
10:40:15 PrintResults [DEBU] -- print sep logic: p.firstTimePrinting: false, previousDocIndex: 0, mappedDoc.Document: 0
10:40:15 PrintResults [DEBU] D0, P[], (doc)::traction:
...

Using env variable operator env() fixes this issue:

$ export IMAGE_TAG=sha-c78888
$ yq e -vi '.traction.ui.image.tag = env(IMAGE_TAG)' services/traction/charts/dev/values.yaml
...
10:41:45 GetMatchingNodes [DEBU] >>
10:41:45 envOperator [DEBU] EnvOperator, env name:%!(EXTRA string=IMAGE_TAG)
10:41:45 envOperator [DEBU] ENV tag%!(EXTRA string=!!str)
10:41:45 envOperator [DEBU] ENV value%!(EXTRA string=sha-c78888)
10:41:45 envOperator [DEBU] ENV Kind%!(EXTRA yaml.Kind=8)
10:41:45 UpdateAttributesFrom [DEBU] UpdateAttributesFrom: n: 0 - [traction ui image tag] other: 0 - []
10:41:45 PrintResults [DEBU] PrintResults for 1 matches
...

Signed-off-by: Ivan Polchenko <2119240+i5okie@users.noreply.github.com>
@i5okie i5okie self-assigned this Jul 24, 2024
@i5okie i5okie changed the title [workflow] Fix variable interpolation [fix] Fix variable interpolation in the workflows Jul 24, 2024
@i5okie i5okie added the bug Something isn't working label Jul 24, 2024
@i5okie i5okie requested a review from esune July 24, 2024 17:48
@esune esune merged commit 0460774 into main Jul 24, 2024
10 of 11 checks passed
@esune esune deleted the i5okie/workflow-fix branch July 24, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants