applicationset
applicationset copied to clipboard
Allow regex capture groups in directories from git generation
Hi,
I have a git contains multiple releases contains kustomize:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: app-deploy-dev
spec:
generators:
- git:
repoURL: [email protected]:org/app-deploy.git
revision: HEAD
directories:
- path: 'app-*'
template:
metadata:
name: '{{path.basename}}-dev'
spec:
project: default
source:
repoURL: [email protected]:org/app-deploy.git
targetRevision: HEAD
path: '{{path}}/overlays/dev'
destination:
server: https://kubernetes.default.svc
But while dev is always available, other environment like qa are not available in early stages. This results into a lot of Application that going to be errored.
Switch to
directories:
- path: 'app-*/overlays/dev'
May not help, since {{path.basename}} would always dev now. Losing the information like the service name.
A solution could be allowing the capture group inside path and expose the groups as variable:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: app-deploy-dev
spec:
generators:
- git:
repoURL: [email protected]:org/app-deploy.git
revision: HEAD
directories:
- path: '(app-*)/overlays/dev'
template:
metadata:
name: '{{path.match.1}}-dev'
spec:
project: default
source:
repoURL: [email protected]:org/app-deploy.git
targetRevision: HEAD
path: '{{path}}'
destination:
server: https://kubernetes.default.svc
I think something similar could be achieved with functions. https://github.com/argoproj/applicationset/issues/303