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

feat: add support for extra env vars #65

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

johncblandii
Copy link

what

  • Adds support for extra environment variables

why

  • Private Helmfile chart repositories require a username and password in a specific format or supplied through the username and `password: args on the repo itself. When those values are not available to change to the proper format, they need to be supplied through custom env vars.
repositories:
  - name: artifactory
    url: my.jfrog.io
    oci: true
    username: '{{ env "ARTIFACTORY_USER" }}'
    password: '{{ env "ARTIFACTORY_PASS" }}'

The expected format would be ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD, but those are not capable of being changed without legacy concerns.

references

for var in $(jq -r 'keys[]' env.json); do
echo "::add-mask::$(jq -r --arg v "$var" '.[$v]' env.json)"
done
cat env.json | jq -r 'to_entries | .[] | "\(.key)=\(.value)"' >> $GITHUB_ENV
Copy link
Member

@Benbentwo Benbentwo Feb 12, 2025

Choose a reason for hiding this comment

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

This doesn't feel right. My gut is saying there would be a lot of headache dealing with the input format as json and then making sure the input works for both those jq commands.

If you're trying to add authentication to private registries for helmfile registries could we just use env variables - similar to this but just on the workflow itself?

e.g.

...
steps:
 - uses: cloudposse/github-action-deploy-argocd
   env:
      ARTIFACTORY_USERNAME: foo
      ARTIFACTORY_PASSWORD: ${{ secrets.artifactory-password }}

which would then call this entire workflow with the env variables set?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, there is pain to ensuring the JSON is correct. This is a totem pole.

A (source repos) -> B (reusable workflow) -> C (this workflow)

A has needs. B does not know of those particular needs that could change wildly per repo so adding a custom env var for every single repos needs can get pretty tedious.

This is indeed not the ideal solution, but we need a way to get from A -> C without tweaking B every time a new app repo changes needs.

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