Skip to content

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.

@johncblandii
Copy link
Author

Closing this in favor of env at the reusable workflow level.

@johncblandii johncblandii deleted the feat/extra-env-vars branch February 21, 2025 21:02
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.

3 participants