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

properly populate the EnvironmentVariable struct #998

Merged

Conversation

felixlut
Copy link
Contributor

@felixlut felixlut commented Aug 30, 2023

Checklist

=========

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked for similar issues and haven't found anything relevant.
  • This is not a security issue (which should be reported here: https://circleci.com/security/)
  • I have read Contribution Guidelines.

Internal Checklist

  • I am requesting a review from my own team as well as the owning team
  • I have a plan in place for the monitoring of the changes that I am making (this can include new monitors, logs to be aware of, etc...)

Changes

=======

  • Properly populate the EnvironmentVariable struct with json tags
  • Added updated_at while at it, as per the API docs.

Rationale

=========

Before this change, listing the environment variables in a context would result in each environment variable not being properly populated. The image below is the result of running fmt.Errorf("%+v\n", envVariable), where envVariable is an environmental variable extracted from a EnvironmentVariables() call. The only thing that gets populated is the name.

image

With the json tags, the same print produces:

image

Considerations

==============

It didn't work properly, now it does.

Screenshots

See screenshots above

Here are some helpful tips you can follow when submitting a pull request:

  1. Fork the repository and create your branch from main.
  2. Run make build in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (make test).
  5. The --debug flag is often helpful for debugging HTTP client requests and responses.
  6. Format your code with gofmt.
  7. Make sure your code lints (make lint). Note: This requires Docker to run inside a local job.

@felixlut felixlut marked this pull request as ready for review August 30, 2023 22:50
@felixlut felixlut requested a review from a team as a code owner August 30, 2023 22:50
Copy link
Contributor

@JulesFaucherre JulesFaucherre left a comment

Choose a reason for hiding this comment

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

Thank you for this 🙏

@felixlut
Copy link
Contributor Author

felixlut commented Sep 4, 2023

Hey! Is there anything else I should do? Or is this just pending a merge? The failed job is for some security thing, which my change shouldn't effect

@JulesFaucherre
Copy link
Contributor

Hey, actually no, it only seems that you can't run this check because you're not part of the org, I merge the PR

@JulesFaucherre JulesFaucherre merged commit c152c1b into CircleCI-Public:develop Sep 4, 2023
@felixlut felixlut deleted the context-env-var-json-tags branch September 4, 2023 12:58
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.

2 participants