Skip to content

GitHub

Parameters

The GitHub notification service changes commit status using GitHub Apps and requires specifying the following settings:

  • appID - the app id
  • installationID - the app installation id
  • privateKey - the app private key
  • enterpriseBaseURL - optional URL, e.g. https://git.example.com/

Configuration

  1. Create a GitHub Apps using https://github.com/settings/apps/new
  2. Change repository permissions to enable write commit statuses 2
  3. Generate a private key, and download it automatically 3
  4. Install app to account
  5. Store privateKey in argocd-notifications-secret Secret and configure GitHub integration in argocd-notifications-cm ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
  name: <config-map-name>
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-----
  1. 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"

Notes: - If the message is set to 140 characters or more, it will be truncated. - If github.repoURLPath and github.revisionPath are same as above, they can be omitted.