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: do not export repo-server environment to sidecar (#9393) #9397

Closed
wants to merge 2 commits into from

Conversation

pierrecregut
Copy link
Contributor

getPluginEnvs is both used for local plugins and sidecar plugins. For the later
do not include the environement variables of the repo-server in the supplied
variables.

Fixes: #9393
Signed-off-by: Pierre Crégut [email protected]

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@codecov
Copy link

codecov bot commented May 13, 2022

Codecov Report

Merging #9397 (e28ca33) into master (5edaa6c) will decrease coverage by 0.08%.
The diff coverage is 80.00%.

❗ Current head e28ca33 differs from pull request most recent head 663f959. Consider uploading reports for the commit 663f959 to get more accurate results

@@            Coverage Diff             @@
##           master    #9397      +/-   ##
==========================================
- Coverage   45.86%   45.78%   -0.09%     
==========================================
  Files         221      220       -1     
  Lines       26309    26170     -139     
==========================================
- Hits        12067    11981      -86     
+ Misses      12586    12531      -55     
- Partials     1656     1658       +2     
Impacted Files Coverage Δ
reposerver/repository/repository.go 59.78% <80.00%> (-1.63%) ⬇️
util/grpc/errors.go 22.72% <0.00%> (-24.45%) ⬇️
server/application/terminal.go 3.60% <0.00%> (-20.73%) ⬇️
util/dex/dex.go 81.57% <0.00%> (-6.30%) ⬇️
...is/applicationset/v1alpha1/applicationset_types.go 27.58% <0.00%> (-4.56%) ⬇️
util/git/client.go 44.74% <0.00%> (-3.39%) ⬇️
server/server.go 54.12% <0.00%> (-0.46%) ⬇️
util/cmp/stream.go 52.14% <0.00%> (-0.45%) ⬇️
pkg/apiclient/apiclient.go 0.68% <0.00%> (-0.13%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61f48d5...663f959. Read the comment docs.

@@ -1270,8 +1270,11 @@ func runConfigManagementPlugin(appPath, repoRoot string, envVars *v1alpha1.Env,
return kube.SplitYAML([]byte(out))
}

func getPluginEnvs(envVars *v1alpha1.Env, q *apiclient.ManifestRequest, creds git.Creds) ([]string, error) {
env := append(os.Environ(), envVars.Environ()...)
func getPluginEnvs(envVars *v1alpha1.Env, q *apiclient.ManifestRequest, creds git.Creds, remote bool) ([]string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment to describe what remote does? And, if you have time, a unit test to illustrate the difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a comment. Testing the feature at the level of exported functions would require mocking the cmp server which does not look like an easy task. I do not have the time for that.

getPluginEnvs is both used for local plugins and sidecar plugins. For the later
do not include the environement variables of the repo-server in the supplied
variables.

Fixes: argoproj#9393
Signed-off-by: Pierre Crégut <[email protected]>
@crenshaw-dev
Copy link
Member

Merged already as part of #9319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repo server overrides side car plugin environment variables
2 participants