Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:DefectDojo/django-DefectDojo into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
inesmartins-swordhealth committed Mar 8, 2024
2 parents 94692d0 + be59027 commit 7f22cbc
Show file tree
Hide file tree
Showing 17 changed files with 392 additions and 266 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/test-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ jobs:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.4.0
uses: azure/setup-helm@v4.1.0

- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.9

- name: Configure Helm repos
run: |-
Expand All @@ -36,14 +34,17 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
with:
yamale_version: 4.0.4
yamllint_version: 1.35.1

- name: Determine target branch
id: ct-branch-target
run: |
if [ ! -z ${GITHUB_BASE_REF} ]; then
echo "ct-branch=${GITHUB_BASE_REF}" >> $GITHUB_ENV
echo "ct-branch=${GITHUB_BASE_REF}" >> $GITHUB_ENV
else
echo "ct-branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "ct-branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
fi
- name: Run chart-testing (list-changed)
Expand All @@ -58,7 +59,7 @@ jobs:
# x.y.z gets bumped automatically when doing a release
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml --target-branch ${{ env.ct-branch }} --check-version-increment=true
if: ${{ env.changed == 'true' && env.ct-branch != 'dev' && env.ct-branch != 'bugfix' }}
if: ${{ env.changed == 'true' && env.ct-branch != 'dev' && env.ct-branch != 'bugfix' }}

# run all checks but version increment always when something changed
- name: Run chart-testing (lint)
Expand Down
2 changes: 1 addition & 1 deletion components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "defectdojo",
"version": "2.32.0-dev",
"version": "2.33.0-dev",
"license" : "BSD-3-Clause",
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion dc-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ while [[ $# -gt 0 ]]; do
usage
exit 0
;;
-*|--*)
-*)
echo "Unknown option $1"
usage
exit 1
Expand Down
7 changes: 7 additions & 0 deletions docs/content/en/getting_started/upgrading/2.33.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: 'Upgrading to DefectDojo Version 2.33.x'
toc_hide: true
weight: -20240304
description: No special instructions.
---
There are no special instructions for upgrading to 2.33.x. Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.33.0) for the contents of the release.
2 changes: 1 addition & 1 deletion dojo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# Django starts so that shared_task will use this app.
from .celery import app as celery_app # noqa: F401

__version__ = '2.32.0-dev'
__version__ = '2.33.0-dev'
__url__ = 'https://github.com/DefectDojo/django-DefectDojo'
__docs__ = 'https://documentation.defectdojo.com'
18 changes: 18 additions & 0 deletions dojo/db_migrations/0204_jira_project_epic_issue_type_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.13 on 2024-03-01 20:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dojo', '0203_alter_finding_options_finding_epss_percentile_and_more'),
]

operations = [
migrations.AddField(
model_name='jira_project',
name='epic_issue_type_name',
field=models.CharField(default='Epic', blank=True, help_text='The name of the of structure that represents an Epic', max_length=64),
),
]
15 changes: 10 additions & 5 deletions dojo/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2710,7 +2710,7 @@ class JIRAProjectForm(forms.ModelForm):
class Meta:
model = JIRA_Project
exclude = ['product', 'engagement']
fields = ['inherit_from_product', 'jira_instance', 'project_key', 'issue_template_dir', 'component', 'custom_fields', 'jira_labels', 'default_assignee', 'add_vulnerability_id_to_jira_label', 'push_all_issues', 'enable_engagement_epic_mapping', 'push_notes', 'product_jira_sla_notification', 'risk_acceptance_expiration_notification']
fields = ['inherit_from_product', 'jira_instance', 'project_key', 'issue_template_dir', 'epic_issue_type_name', 'component', 'custom_fields', 'jira_labels', 'default_assignee', 'add_vulnerability_id_to_jira_label', 'push_all_issues', 'enable_engagement_epic_mapping', 'push_notes', 'product_jira_sla_notification', 'risk_acceptance_expiration_notification']

def __init__(self, *args, **kwargs):
from dojo.jira_link import helper as jira_helper
Expand Down Expand Up @@ -2743,6 +2743,7 @@ def __init__(self, *args, **kwargs):
self.fields['jira_instance'].disabled = False
self.fields['project_key'].disabled = False
self.fields['issue_template_dir'].disabled = False
self.fields['epic_issue_type_name'].disabled = False
self.fields['component'].disabled = False
self.fields['custom_fields'].disabled = False
self.fields['default_assignee'].disabled = False
Expand All @@ -2766,6 +2767,7 @@ def __init__(self, *args, **kwargs):
self.initial['jira_instance'] = jira_project_product.jira_instance.id if jira_project_product.jira_instance else None
self.initial['project_key'] = jira_project_product.project_key
self.initial['issue_template_dir'] = jira_project_product.issue_template_dir
self.initial['epic_issue_type_name'] = jira_project_product.epic_issue_type_name
self.initial['component'] = jira_project_product.component
self.initial['custom_fields'] = jira_project_product.custom_fields
self.initial['default_assignee'] = jira_project_product.default_assignee
Expand All @@ -2780,6 +2782,7 @@ def __init__(self, *args, **kwargs):
self.fields['jira_instance'].disabled = True
self.fields['project_key'].disabled = True
self.fields['issue_template_dir'].disabled = True
self.fields['epic_issue_type_name'].disabled = True
self.fields['component'].disabled = True
self.fields['custom_fields'].disabled = True
self.fields['default_assignee'].disabled = True
Expand All @@ -2799,6 +2802,7 @@ def __init__(self, *args, **kwargs):
if self.instance.id:
self.fields['jira_instance'].required = True
self.fields['project_key'].required = True
self.fields['epic_issue_type_name'].required = True

def clean(self):
logger.debug('validating jira project form')
Expand All @@ -2808,17 +2812,18 @@ def clean(self):
if not self.cleaned_data.get('inherit_from_product', False):
jira_instance = self.cleaned_data.get('jira_instance')
project_key = self.cleaned_data.get('project_key')
epic_issue_type_name = self.cleaned_data.get('epic_issue_type_name')

if project_key and jira_instance:
if project_key and jira_instance and epic_issue_type_name:
return cleaned_data

if not project_key and not jira_instance:
if not project_key and not jira_instance and not epic_issue_type_name:
return cleaned_data

if self.target == 'engagement':
raise ValidationError('JIRA Project needs a JIRA Instance and JIRA Project Key, or choose to inherit settings from product')
raise ValidationError('JIRA Project needs a JIRA Instance, JIRA Project Key, and Epic issue type name, or choose to inherit settings from product')
else:
raise ValidationError('JIRA Project needs a JIRA Instance and JIRA Project Key, leave empty to have no JIRA integration setup')
raise ValidationError('JIRA Project needs a JIRA Instance, JIRA Project Key, and Epic issue type name, leave empty to have no JIRA integration setup')


class GITHUBFindingForm(forms.Form):
Expand Down
2 changes: 1 addition & 1 deletion dojo/jira_link/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def add_epic(engagement, **kwargs):
'summary': epic_name,
'description': epic_name,
'issuetype': {
'name': 'Epic'
'name': getattr(jira_project, "epic_issue_type_name", "Epic"),
},
get_epic_name_field_name(jira_instance): epic_name,
}
Expand Down
1 change: 1 addition & 0 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3927,6 +3927,7 @@ class JIRA_Project(models.Model):
help_text=_("Automatically maintain parity with JIRA. Always create and update JIRA tickets for findings in this Product."))
enable_engagement_epic_mapping = models.BooleanField(default=False,
blank=True)
epic_issue_type_name = models.CharField(max_length=64, blank=True, default="Epic", help_text=_("The name of the of structure that represents an Epic"))
push_notes = models.BooleanField(default=False, blank=True)
product_jira_sla_notification = models.BooleanField(default=False, blank=True, verbose_name=_("Send SLA notifications as comment?"))
risk_acceptance_expiration_notification = models.BooleanField(default=False, blank=True, verbose_name=_("Send Risk Acceptance expiration notifications as comment?"))
Expand Down
6 changes: 3 additions & 3 deletions dojo/reports/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
re_path(r'^reports/custom$',
views.custom_report, name='custom_report'),
re_path(r'^reports/quick$',
views.quick_report, name='quick_report'),
views.QuickReportView.as_view(), name='quick_report'),
re_path(r'^reports/csv_export$',
views.csv_export, name='csv_export'),
views.CSVExportView.as_view(), name='csv_export'),
re_path(r'^reports/excel_export$',
views.excel_export, name='excel_export'),
views.ExcelExportView.as_view(), name='excel_export'),
]
Loading

0 comments on commit 7f22cbc

Please sign in to comment.