argoproj / notifications-engine

Affordable notifications for Kubernetes
Apache License 2.0
263 stars 134 forks source link

Support for Atlassian's Jira #24

Open alexmt opened 3 years ago

alexmt commented 3 years ago

By @AlexDHoffer: https://github.com/argoproj-labs/argocd-notifications/issues/240

Some existing CD systems e.g. Jenkins can post build results to Jira issues as well as natively link commits in the build to those issues. See here for details: https://plugins.jenkins.io/jira/

This is a slick feature for a CD system and since Atlassian's Jira is in such widespread usage these days it would be cool to have something similar, where ArgoCD can key off a Jira issue tag in a commit message and post when a successful sync of that tag occurred back to the issue itself in Jira.

onmomo commented 2 years ago

Has anybody worked around this? Thinking about a PostSync hook but this would require a dedicated pod to connect with the Jira API and a solution to get the git diff of the sync inside this pod. Or probably easier to listen for ArgoCD webhooks and do the work.

JeffreyGarrett commented 2 years ago

Hello Is there a status on this for bringing this in? Either that or possibly suggestions on how it could be incorporated?

Aditya-velotio commented 2 years ago

Hi , any updates here?

nweiler commented 1 year ago

Bump

mjallday commented 1 year ago

Where would ArgoCD get the deployment information from? I'm looking at the deployment API and you need to pass an issue key to annotate the Jira issue with the deployment information.

It's not clear where this would come from. Potentially it could be build into the container as a label I guess?

johan-lejdung commented 1 year ago

Where would ArgoCD get the deployment information from? I'm looking at the deployment API and you need to pass an issue key to annotate the Jira issue with the deployment information.

It's not clear where this would come from. Potentially it could be build into the container as a label I guess?

We have that information attached to commits in the Git repo used to build the docker image Argo uses. But that repo is of course not connected to Argo in any way. If this is a common setup one idea would be to link a repo to read issue keys from commit messages

trash-anger commented 1 year ago

Did someone tried with that? : https://developer.atlassian.com/cloud/jira/software/rest/api-group-deployments/#api-rest-deployments-0-1-bulk-post

The jira/gha integration works by looking for issue keys in each commits deployed. I guess most of the time the deployment trigger comes from a PR, then we can fill the issue key array with all issue id found.

jessesuen commented 11 months ago

In case it helps others, I found this example in slack (I haven't tested if it works):

  trigger.on-sync-succeeded: |
    - description: Application syncing has succeeded
      send:
      - atlassian
      when: app.status.operationState.phase in ['Succeeded']
  template.atlassian: |
    webhook:
      atlassian:
        method: POST
        body: |
           {"fields": {"project":{"key": "OP"},"summary": "please ignore {{.app.metadata.name}}","description": "argocd notification check this out {{.context.argocdUrl}}/applications/{{.app.metadata.name}} is in status {{.app.status.sync.status}}","issuetype": {"name": "Bug"},"components": [{"name" : "OES"}],"priority": { "name": "Low"}}}
  service.webhook.atlassian: |
    url: https://devops.atlassian.net/rest/api/2/issue/
    basicAuth:
      username: $jira-username
      password: $jira-password
    headers:
    - name: Content-Type
      value: application/json
bernard0le commented 3 months ago

any update here?

jdepp commented 1 month ago

Bump. This would be a big help for us, as we are trying to keep feature parity when switching deployment tools from GitHub Actions to ArgoCD. We tag all commits with JIRA tickets like so: TICKET-1234 deploy X to env Y.

One hacky idea would be to have a PostSync k8s job that got the commit message from the commit ID that was deployed via ArgoCD, and then parse out the Jira ticket number. Then use the Jira Deployment's REST API to update the Jira ticket with the deployment information.