2

In Argo - ApplicationSet Controller there is a "Pull Request Generator".

I would like to get the pull request number, git sha - "{{number}}" {{head_sha}} in a configMap. I am using kustomize. and I am trying to use the configMapGenerator

cat <<EOF >.env
PULL_REQUEST_NUMBER
GIT_SHA

cat <<EOF >./kustomization.yaml
configMapGenerator:
- name: example-configmap-1
  envs:
  - .env
EOF

But am not sure how to link from the applicationSet to get in environment variables to get in kustomize and finaly in the configMap

Adrian I
  • 113
  • 1
  • 6
  • Could you potentially accomplish what you need by injecting the SHA in a label rather than a ConfigMap? The Application spec contains a `commonLabels` field which could be templated. – crenshaw-dev Jul 21 '22 at 15:48
  • the main goal would be to deploy an app for each Pull Request (even if multiple PRs are open at the same time). I saw a challenge somehow to make these independent and pull request number would be ideal to: get each app in a different namespace and modify some dns configurations. – Adrian I Jul 22 '22 at 10:24
  • I tend to create application manifests for every environment overlay, then I use an app of apps pattern to make changes. This keeps your configurations explicit...the use of AppSets has an implicit nature to it which IMO is a bit of an antipattern for declarative repositories. It __feels__ like helm. – LostJon Jul 22 '22 at 14:00
  • 1
    @AdrianI yeah I don't think `commonLabels` is gonna be powerful enough to get you a temp namespace. Might have to switch to Helm for this job. It's much more parameterize-able. @LostJon, yeah it's Helm-esque and becoming more so with Go templating. Test environments seems like a reasonable use case, but for prod, being explicit is probably better. – crenshaw-dev Jul 25 '22 at 15:17

0 Answers0