github-for-jira icon indicating copy to clipboard operation
github-for-jira copied to clipboard

Delete builds and deployments when a repository is deleted

Open thombergs opened this issue 3 years ago • 0 comments

When a repository is deleted in GitHub, the build and deployment events are not deleted from Jira. Reproducable with these steps:

  1. send a build or deployment event from a GitHub repo
  2. build/deployment is visible in Jira issue
  3. delete the repo in GitHub
  4. build/deployment is still visible in Jira issue

Workaround: uninstall and reinstall the GitHub for Jira app. This deletes ALL commits, branches, pullrequests, builds and deployments from jira. Note that historical commits, branches, and pullrequests are going to be backfilled on reinstallation of the app, but historical builds and deployments will be lost.

Solution: when we're sending build and deployment events to Jira, we should tag them with a "repoId" property that tells Jira which repo it belongs to. Then, in the repository.delete webhook, we use the delete endpoints in the Jira API to delete all items with that repoId.

thombergs avatar Feb 16 '22 06:02 thombergs