Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ROX-8830: Respect local overwrites of variables in BASH_ENV #99
ROX-8830: Respect local overwrites of variables in BASH_ENV #99
Changes from 22 commits
42fc5fc
11d5582
ed0da3e
c30a448
f3c0940
c5264af
1e67044
c683bd5
2439030
9166ca5
bf07491
6939ece
80c0cf7
a6bd62f
2eefb26
f4be15b
a3a9f01
21ecfc9
e2267a5
0e294e3
4940119
baff548
34179a4
f059562
c21a9f9
ec744d8
58a71b0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my limited understanding of the issue, the problem is that
BASH_ENV
contents may override whatever is set in the environment beforebash
process is launched.bash
(through our wrappers but that doesn't matter).bash
seesBASH_ENV
and sources that file.BASH_ENV
overwrites environment variables if their names match the ones set by the parent process.If we assume, we don't want overwriting only for values that we put into
$BASH_ENV
with ourcci-export
function, could we simply modify this specific line fromto
Warning: this needs testing if escaping works as it should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct, I added this in line 39.
This solution requires handling one edge-case: cci-exporting the same key twice with different values. In order to make this work properly, I needed to add line 35:
remove_lines_starting_with "$BASH_ENV" "$(printf 'export %q="${%q:-' "$key" "$key")"
. There are unit tests in this PR to cover this edge-case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I did not even think about it. Let me take another look at the current approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. The part above resembles things that happen in
rox.Dockerfile
. Have you considered using that image as some of the base stages?Advantages should be:
It may be a bit annoying that apollo-ci image is pushed before testing but that happens before publishing rox PR, so shouldn't be that bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea but it feels like a lot of changes - I will give it a try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will try in a separate branch
pr/ROX-8830-common-container-base
to separate this thread from the restThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Let's do it as a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I branched off this branch and almost got it - see #101