GitHub
Parameters
The GitHub notification service changes commit status using GitHub Apps and requires specifying the following settings:
appID
- the app idinstallationID
- the app installation idprivateKey
- the app private keyenterpriseBaseURL
- optional URL, e.g. https://git.example.com/
Configuration
- Create a GitHub Apps using https://github.com/settings/apps/new
- Change repository permissions to enable write commit statuses and/or deployments and/or pull requests comments
- Generate a private key, and download it automatically
- Install app to account
- Store privateKey in
argocd-notifications-secret
Secret and configure GitHub integration inargocd-notifications-cm
ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
data:
service.github: |
appID: <app-id>
installationID: <installation-id>
privateKey: $github-privateKey
apiVersion: v1
kind: Secret
metadata:
name: <secret-name>
stringData:
github-privateKey: |
-----BEGIN RSA PRIVATE KEY-----
(snip)
-----END RSA PRIVATE KEY-----
- Create subscription for your GitHub integration
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.<trigger-name>.github: ""
Templates
template.app-deployed: |
message: |
Application {{.app.metadata.name}} is now running new version of deployments manifests.
github:
repoURLPath: "{{.app.spec.source.repoURL}}"
revisionPath: "{{.app.status.operationState.syncResult.revision}}"
status:
state: success
label: "continuous-delivery/{{.app.metadata.name}}"
targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
deployment:
state: success
environment: production
environmentURL: "https://{{.app.metadata.name}}.example.com"
logURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
requiredContexts: []
autoMerge: true
transientEnvironment: false
reference: v1.0.0
pullRequestComment:
content: |
Application {{.app.metadata.name}} is now running new version of deployments manifests.
See more here: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true
Notes:
- If the message is set to 140 characters or more, it will be truncated.
- If
github.repoURLPath
andgithub.revisionPath
are same as above, they can be omitted. - Automerge is optional and
true
by default for github deployments to ensure the requested ref is up to date with the default branch. Setting this option tofalse
is required if you would like to deploy older refs in your default branch. For more information see the GitHub Deployment API Docs. - If
github.pullRequestComment.content
is set to 65536 characters or more, it will be truncated. - Reference is optional. When set, it will be used as the ref to deploy. If not set, the revision will be used as the ref to deploy.