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

Clean up helm/config.go #9

Closed
ErinCall opened this issue Dec 17, 2019 · 1 comment · Fixed by #32
Closed

Clean up helm/config.go #9

ErinCall opened this issue Dec 17, 2019 · 1 comment · Fixed by #32
Assignees
Labels
code quality Improvements to the internals that may not have user-facing impact documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@ErinCall
Copy link
Contributor

ErinCall commented Dec 17, 2019

The Config struct in internal/helm/config.go defines the interface between drone-helm3 and a project's Drone settings. As such, it should be clear and well-documented:

  • Make sure the comment above the Config struct makes sense to you—it makes sense to me, but I'm a poor judge since I already know all the things it's telling me.
  • Remove the "Global helm config" and "Config specifically for helm upgrade" comments; they aren't particularly accurate
  • Make sure each struct field has a comment explaining what that setting does
  • Probably remove the custom decoder for helmCommand; that responsibility lies with the determineSteps function in internal/helm/plan.go.
  • Fix the inthe typo on line 8 🙃
@ErinCall ErinCall added documentation Improvements or additions to documentation good first issue Good for newcomers labels Dec 17, 2019
@ErinCall
Copy link
Contributor Author

Currently, there's some code that tries to guess which config fields might show up in the environment section of the consumer's .drone.yml, rather than the settings section. Those fields have to have an envconfig tag, so that envconfig will look for the non-prefixed form if it doesn't see a PLUGIN_ version.

It probably makes more sense to allow all fields to come from a non-prefixed env var. It should be a small change to cmd/drone-helm/main.go. After calling envconfig.Process("plugin", &c), call it again with an empty string for the prefix: envconfig.Process("", &c)

Make sure to confirm that

  1. an empty-string prefix looks for ENV_VAR_NAME, not _ENV_VAR_NAME
  2. if the prefixed form is present, but the non-prefixed form is empty, the second call to envconfig.Process won't stomp on the populated value.

@ErinCall ErinCall added the code quality Improvements to the internals that may not have user-facing impact label Dec 17, 2019
@ErinCall ErinCall self-assigned this Dec 23, 2019
ErinCall added a commit that referenced this issue Dec 23, 2019
ErinCall added a commit that referenced this issue Dec 23, 2019
I'm leaving the no-op test file in place because my next step is to add
new behavior that will require testing.
ErinCall added a commit that referenced this issue Dec 24, 2019
Trying to guess in advance which part of the config a user will put in
the `settings` section and which they'll put in `environment` is a
fool's errand. Just let everything go in either place.

The ServiceAccount field only had an `envconfig` tag (as opposed to
`split_words`) because that triggered envconfig to look for the non-
prefixed form. Now that we're finding non-prefixed forms of everything,
we can use the clearer/more concise tag.

Note that TestPopulateWithConflictingVariables isn't meant to say
"here's what behavior we *want*" so much as "here's what the behavior
*is*." I don't think one thing is any better than the other, but we
should know which one we're getting.
ErinCall added a commit that referenced this issue Dec 24, 2019
Redacting KubeToken may not be sufficient, since it's possible that
someone would put secrets in Values or StringValues. Unilaterally
redacting those seems unhelpful, though, since they may be the very
thing the user is trying to debug. I've settled on redacting the obvious
field without trying to promise that all sensitive data will be hidden.
ErinCall added a commit that referenced this issue Dec 30, 2019
Just something I noticed while resolving a merge conflict. The "write
some docs" and "implement prefix" branches happened concurrently and
didn't get re-coordinated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improvements to the internals that may not have user-facing impact documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant