Create Jira Issue button does not show in MRs if "Gitlab Issues" are disabled for project
Summary
There is an inconsistency on the way this button shows depending of the configuration.
Steps to reproduce
- Enable the Jira Integration for a project.
- Enable the option "Enable Jira issues creation from vulnerabilities" for the project.
- Create a merge request with some vulnerabilities detected by one of the scanner.
- Make sure the "Gitlab Issues" functionality is enabled.
- Open the the pipeline's security tab and click on one of the vulnerabilities / Click on one of the vulnerabilities in the MR widget
- Notice the create "jira issue button" is present.
- Disable the Gitlab Issues functionality for the project.
- Open the MR and click on one of the vulnerabilities.
- Notice the create "Jira issue button" is not longer present.
What is the current bug behavior?
Create Jira Issue button does not show in pipeline / MR widget if "Gitlab Issues" are disabled for project
What is the expected correct behavior?
The "Create Jira Issue" button should be present in pipeline / MR widget even when Gitlab issues are disabled.
Relevant logs and/or screenshots
Vulnerability view with "Gitlab Issues" enabled.
Vulnerability view with "Gitlab Issues" disabled.
Output of checks
This bug happens on a self managed instance of gitlab, installed with the Helm chart on Kubernetes.
Results of GitLab environment info
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.7.2p137
Gem Version: 3.1.4
Bundler Version:2.1.4
Rake Version: 13.0.3
Redis Version: unknown
Git Version: unknown
Sidekiq Version:5.2.9
Go Version: unknown
GitLab information
Version: 13.12.3-ee
Revision: 9d9769ba2ad
Directory: /srv/gitlab
DB Adapter: PostgreSQL
DB Version: 12.6
URL: https://gitlab.molops.io
HTTP Clone URL: https://gitlab.molops.io/some-group/some-project.git
SSH Clone URL: git@gitlab.molops.io:some-group/some-project.git
Elasticsearch: yes
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: bitbucket, saml
GitLab Shell
Version: 13.18.0
Repository storage paths:
- default: /var/opt/gitlab/repo
GitLab Shell path: /home/git/gitlab-shell
Git: /usr/bin/git
Implantation Plan
-
within ee/app/assets/javascripts/vue_shared/security_reports/components/modal_footer.vue
add a check that addsissueButton
to the buttons-array ifthis.vulnerability.create_jira_issue_url
is truthy -
Update specs to make sure the button shows under the newly added condition
Patch
diff --git a/ee/app/assets/javascripts/vue_shared/security_reports/components/modal_footer.vue b/ee/app/assets/javascripts/vue_shared/security_reports/components/modal_footer.vue
index e8d78a2f860..4a08a50ddef 100644
--- a/ee/app/assets/javascripts/vue_shared/security_reports/components/modal_footer.vue
+++ b/ee/app/assets/javascripts/vue_shared/security_reports/components/modal_footer.vue
@@ -63,6 +63,10 @@ export default {
},
},
computed: {
+ canCreateJiraIssue() {
+ return Boolean(this.vulnerability.create_jira_issue_url);
+ },
+
createIssueButtonText() {
return this.vulnerability.create_jira_issue_url
? s__('ciReport|Create Jira issue')
@@ -100,7 +104,7 @@ export default {
buttons.push(DownloadButton);
}
- if (this.canCreateIssue) {
+ if (this.canCreateIssue || this.canCreateJiraIssue) {
buttons.push(issueButton);
}
Edited by David Pisek