|
| 1 | +# argocd-github-release-generator |
| 2 | +`argocd-github-release-generator` is an [ArgoCD Plugin Generator](https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Plugin/) for `ApplicationSet`s that generates an ArgoCD application for each Github Release on a given repository. |
| 3 | + |
| 4 | +## Installing |
| 5 | +> [!NOTE] |
| 6 | +> For installing this project we assume that you have a k8s cluster with ArgoCD installed up and running. |
| 7 | +
|
| 8 | +This project is composed of 4 components: |
| 9 | +- [Secret](k8s/install.yaml#L1): stores the ArgoCD Token (used to authorize requests coming from ArgoCD) and an optional GITHUB_PAT (used to access private repositories and/or have a bigger rate limit). |
| 10 | +- [ConfigMap](k8s/install.yaml#L13): contains the plugin configuration that ArgoCD reads to know how to communicate and authenticate with it. |
| 11 | +- [Deployment](k8s/install.yaml#L22): deploys the actual plugin that responds to HTTP requests coming from ArgoCD. |
| 12 | +- [Service](k8s/install.yaml#L69): exposes the deployment internally for ArgoCD to reach it. |
| 13 | + |
| 14 | +To install it in your cluster you can run: |
| 15 | +```terminal |
| 16 | +$ ARGOCD_TOKEN="$(echo -n '<strong_password>' | base64)" envsubst < [URL] | k apply -f - |
| 17 | +``` |
| 18 | + |
| 19 | +> [!TIP] |
| 20 | +> If you plan to watch private repositories or have a refresh interval lower than 1 per minute then you must specify a GITHUB_PAT. |
| 21 | +> `$ GITHUB_PAT=<YOUR_PAT> ARGOCD_TOKEN="$(echo -n '<strong_password>' | base64)" envsubst < [URL] | k apply -f -` |
| 22 | +
|
| 23 | +## Setting up your ApplicationSet |
| 24 | + |
| 25 | +The plugin receives two parameters that you must configure: |
| 26 | +- `repository`: specify the repository that should be used to look for releases. |
| 27 | +- `min_release`: specify the starting point for the releases. This value is useful to control how many applications you generate and remove applications related to old releases. |
| 28 | + |
| 29 | +> [!NOTE] |
| 30 | +> At the moment this project only supports releases that follow `semver` (e.g `v0.1.0`) |
| 31 | +
|
| 32 | +With plugin generators you also configure the interval with which ArgoCD polls this plugin. Keep this interval in mind given that each request to the plugin will make a request to Github's API. If you have not configured a GITHUB_PAT then you have a rate limit of 60 requests per hour (one per minute). |
| 33 | + |
| 34 | +An example ApplicationSet that watches the [dagger/dagger](https://github.com/dagger/dagger) repository every minute and creates applications for releases starting at `v0.9.8`: |
| 35 | +``` |
| 36 | +apiVersion: argoproj.io/v1alpha1 |
| 37 | +kind: ApplicationSet |
| 38 | +metadata: |
| 39 | + name: <YOUR_APPLICATION_SET_NAME> |
| 40 | +spec: |
| 41 | + generators: |
| 42 | + - plugin: |
| 43 | + configMapRef: |
| 44 | + # Specify argocd where the configuration of this plugin can be found |
| 45 | + name: argocd-github-release-generator |
| 46 | + input: |
| 47 | + parameters: |
| 48 | + repository: "dagger/dagger" |
| 49 | + min_release: v0.9.8 |
| 50 | + requeueAfterSeconds: 60 |
| 51 | +
|
| 52 | + template: |
| 53 | + [Your application configuration] |
| 54 | +``` |
0 commit comments