Error creating new JIRA issue from Vulnerability after previous JIRA issue is deleted
Summary
As reported here by @jannik_lehmann
When using the vulnerabilityExternalIssueLinkCreate Mutation to create a Jira Issue to a Vulnerability. The mutation returns an error “Vulnerability already has a "created" issue link”. Even though the Issue got deleted from Jira in the meantime.
Steps to reproduce
Example Project
What is the current bug behavior?
Once a JIRA issue created from a GitLab vulnerability is deleted on the JIRA system, attempting to create another JIRA issue from the same vulnerability throws an error Vulnerability already has a "created" issue link
What is the expected correct behavior?
TBD
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
-
backend Update
VulnerabilityExternalIssueLinks::CreateService
(ee/app/services/vulnerability_external_issue_links/create_service.rb
) to remove existing associations if the underlying JIRA issue got removed