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 and/or deployments and/or pull requests comments 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
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: <config-map-name>
  5. data:
  6. service.github: |
  7. appID: <app-id>
  8. installationID: <installation-id>
  9. privateKey: $github-privateKey
  1. apiVersion: v1
  2. kind: Secret
  3. metadata:
  4. name: <secret-name>
  5. stringData:
  6. github-privateKey: |
  7. -----BEGIN RSA PRIVATE KEY-----
  8. (snip)
  9. -----END RSA PRIVATE KEY-----
  1. Create subscription for your GitHub integration
  1. apiVersion: argoproj.io/v1alpha1
  2. kind: Application
  3. metadata:
  4. annotations:
  5. notifications.argoproj.io/subscribe.<trigger-name>.github: ""

Templates

GitHub - 图3

  1. template.app-deployed: |
  2. message: |
  3. Application {{.app.metadata.name}} is now running new version of deployments manifests.
  4. github:
  5. repoURLPath: "{{.app.spec.source.repoURL}}"
  6. revisionPath: "{{.app.status.operationState.syncResult.revision}}"
  7. status:
  8. state: success
  9. label: "continuous-delivery/{{.app.metadata.name}}"
  10. targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
  11. deployment:
  12. state: success
  13. environment: production
  14. environmentURL: "https://{{.app.metadata.name}}.example.com"
  15. logURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
  16. requiredContexts: []
  17. autoMerge: true
  18. pullRequestComment:
  19. content: |
  20. Application {{.app.metadata.name}} is now running new version of deployments manifests.
  21. 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 and github.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 to false 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.