Skip to content

Commit

Permalink
feat: add argo-cd app preview template
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Jan 10, 2025
1 parent 6658789 commit 104c140
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

Utility tools & scripts.

## Devops

### ArgoCD app previews

Templates to configure preview environments with ArgoCD by using the Pull Request Generator. The Pull Request generator uses the API of an SCMaaS provider (GitHub, GitLab, Gitea, Bitbucket, ...) to automatically discover open pull requests within a repository, this fits well with the style of building a test environment when you create a pull request.

- [github-appset.yaml](./devops/argo-cd-app-preview/github-appset.yaml)

> For further information, see [ArgoCD documentation](https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Pull-Request).
## Docker

### Utils images
Expand Down
66 changes: 66 additions & 0 deletions devops/argo-cd-app-preview/github-appset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# ApplicationSet template used for preview app in CI/CD
#
# You need to replace all values following the `<variable_name>` pattern
# and adapt some values from the current template.
# see. https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Pull-Request/#github
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: <github_repository>-preview
namespace: <argocd_namespace>
spec:
generators:
- pullRequest:
github:
owner: <github_username>
repo: <github_repository>
labels:
- preview
- built
appSecretName: <repo_secret> # Secret containing Github App infos (see. https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#github-app-repositories)
template:
metadata:
name: <github_repository>-preview-pr-{{number}}
spec:
destination:
namespace: <github_repository>-pr-{{number}}
server: https://kubernetes.default.svc
project: <argocd_project>
source:
repoURL: https://github.com/<github_username>/<github_repository>.git
path: ./helm
targetRevision: main # 1.*.*
helm:
values: |
api:
image:
tag: pr-{{number}}
ingress:
annotations:
cert-manager.io/cluster-issuer: <cluster_issuer>
hosts:
- host: api.pr-{{number}}.domain.com
tls:
- secretName: api.pr-{{number}}.domain.com-tls
hosts:
- api.pr-{{number}}.domain.com
docs:
image:
tag: pr-{{number}}
ingress:
annotations:
cert-manager.io/cluster-issuer: <cluster_issuer>
hosts:
- host: docs.pr-{{number}}.domain.com
tls:
- secretName: docs.pr-{{number}}.domain.com-tls
hosts:
- docs.pr-{{number}}.domain.com
...
syncPolicy:
syncOptions:
- CreateNamespace=true
- ApplyOutOfSyncOnly=true
automated:
selfHeal: true

0 comments on commit 104c140

Please sign in to comment.