Currently, definition of SCM Provider Github does not allows to filter out Archive repositories.
In the current situation, ApplicationSet will still try to create Application based on files hosted on Archive repositories.
Motivation
We currently have use cases we we want to keep our repository with the latest files but we have archived it as it should no more be deployed anywhere.
Proposal
Solution 1
I propose to add a parameter to the scmProvider Github to allow to filter out Archived repository.
By default, i suggest to keep it to true to not change the current behavior.
- scmProvider:
github:
# If true, archived repository will be include in the repositories list. If false, only active repositories. Defaults to true.
includeArchivedRepository: true
Definition can now look like this:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: myapps
spec:
generators:
- scmProvider:
github:
# The GitHub organization to scan.
organization: myorg
# For GitHub Enterprise:
api: https://git.example.com/
# If true, scan every branch of every repository. If false, scan only the default branch. Defaults to false.
allBranches: true
# If true, archived repository will be include in the repositories list. If false, only active repositories. Defaults to true.
includeArchivedRepository: true
# Reference to a Secret containing an access token. (optional)
tokenRef:
secretName: github-token
key: token
# (optional) use a GitHub App to access the API instead of a PAT.
appSecretName: gh-app-repo-creds
template:
# ...
Solution 2
It's possible to add this value in the filter part:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: myapps
spec:
generators:
- scmProvider:
filters:
# Include any repository starting with "myapp" AND including a Kustomize config AND labeled with "deploy-ok" AND not archived
- repositoryMatch: ^myapp
pathsExist: [kubernetes/kustomization.yaml]
labelMatch: deploy-ok
archivedRepository: false
template:
# ...
This might be more flexible and maybe useful for other SCMProvider.
II like proposal 1, but for backward compatibility, especially with booleans, it is easier to add a variable with a default value to false, so in this case excludeArchivedRepository: true
Summary
Currently, definition of SCM Provider Github does not allows to filter out Archive repositories.
In the current situation, ApplicationSet will still try to create Application based on files hosted on Archive repositories.
Motivation
We currently have use cases we we want to keep our repository with the latest files but we have archived it as it should no more be deployed anywhere.
Proposal
Solution 1
I propose to add a parameter to the scmProvider Github to allow to filter out Archived repository. By default, i suggest to keep it to
true
to not change the current behavior.Definition can now look like this:
Solution 2
It's possible to add this value in the filter part:
This might be more flexible and maybe useful for other SCMProvider.