Skip to content

Commit 1b338e2

Browse files
authored
Merge pull request #13350 from DefectDojo/release/2.51.0
Release: Merge release into master from: release/2.51.0
2 parents 4527392 + f3e1ffb commit 1b338e2

File tree

320 files changed

+24205
-3720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

320 files changed

+24205
-3720
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This checklist is for your information.
2626
- [ ] Bugfixes should be submitted against the `bugfix` branch.
2727
- [ ] Give a meaningful name to your PR, as it may end up being used in the release notes.
2828
- [ ] Your code is flake8 compliant.
29-
- [ ] Your code is python 3.11 compliant.
29+
- [ ] Your code is python 3.12 compliant.
3030
- [ ] If this is a new feature and not a bug fix, you've included the proper documentation in the docs at https://github.com/DefectDojo/django-DefectDojo/tree/dev/docs as part of this PR.
3131
- [ ] Model changes must include the necessary migrations in the dojo/db_migrations folder.
3232
- [ ] Add applicable tests to the unit tests.

.github/workflows/close-stale.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,24 @@ jobs:
1515
close-stale:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Close stale issues and PRs
18+
- name: Close issues and PRs that are pending closure
1919
uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
20+
with:
21+
# Disable automatic stale marking - only close manually labeled items
22+
days-before-stale: -1
23+
days-before-close: 7
24+
stale-issue-label: 'pending-closure'
25+
stale-pr-label: 'pending-closure'
26+
close-issue-message: 'This issue has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
27+
close-pr-message: 'This PR has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
28+
29+
- name: Close stale issues and PRs
30+
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
2031
with:
2132
# Disable automatic stale marking - only close manually labeled items
2233
days-before-stale: -1
2334
days-before-close: 7
2435
stale-issue-label: 'stale'
2536
stale-pr-label: 'stale'
26-
close-issue-message: 'This issue has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
27-
close-pr-message: 'This PR has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
37+
close-issue-message: 'This issue has been automatically closed because it was labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
38+
close-pr-message: 'This PR has been automatically closed because it was labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'

.github/workflows/gh-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
extended: true
2020

2121
- name: Setup Node
22-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
22+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
2323
with:
24-
node-version: '22.19.0'
24+
node-version: '22.20.0'
2525

2626
- name: Cache dependencies
27-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
27+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
2828
with:
2929
path: ~/.npm
3030
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ name: Integration tests
22

33
on:
44
workflow_call:
5+
inputs:
6+
auditlog_type:
7+
type: string
8+
default: "django-auditlog"
59

610
jobs:
711
integration_tests:
812
# run tests with docker compose
913
name: User Interface Tests
1014
runs-on: ubuntu-latest
15+
env:
16+
AUDITLOG_TYPE: ${{ inputs.auditlog_type }}
1117
strategy:
1218
matrix:
1319
test-case: [

.github/workflows/k8s-tests.yml

Lines changed: 63 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
# are tested (https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html#available-versions)
2828
- databases: pgsql
2929
brokers: redis
30-
k8s: 'v1.33.4'
30+
k8s: 'v1.34.0'
3131
os: debian
3232
steps:
3333
- name: Checkout
@@ -36,7 +36,7 @@ jobs:
3636
- name: Setup Minikube
3737
uses: manusa/actions-setup-minikube@b589f2d61bf96695c546929c72b38563e856059d # v2.14.0
3838
with:
39-
minikube version: 'v1.33.1'
39+
minikube version: 'v1.37.0'
4040
kubernetes version: ${{ matrix.k8s }}
4141
driver: docker
4242
start args: '--addons=ingress --cni calico'
@@ -108,43 +108,46 @@ jobs:
108108
echo "INFO: status:"
109109
kubectl get pods
110110
echo "INFO: logs:"
111-
kubectl logs --selector=$3 --all-containers=true
111+
kubectl logs --selector=$3 --all-containers=true
112112
exit 1
113113
fi
114114
return ${?}
115115
}
116116
echo "Waiting for init job..."
117-
to_complete "condition=Complete" job "defectdojo.org/component=initializer"
117+
to_complete "condition=Complete" job "defectdojo.org/component=initializer"
118118
echo "Waiting for celery pods..."
119-
to_complete "condition=ready" pod "defectdojo.org/component=celery"
119+
to_complete "condition=ready" pod "defectdojo.org/component=celery"
120120
echo "Waiting for django pod..."
121-
to_complete "condition=ready" pod "defectdojo.org/component=django"
121+
to_complete "condition=ready" pod "defectdojo.org/component=django"
122122
echo "Pods up and ready to rumbole"
123123
kubectl get pods
124+
125+
- name: Test login page
126+
timeout-minutes: 10
127+
run: |-
124128
RETRY=0
125129
while :
126130
do
127131
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
128132
OUT=$(kubectl run curl --quiet=true --image=curlimages/curl:8.15.0 \
129-
--overrides='{ "apiVersion": "v1" }' \
130133
--restart=Never -i --rm -- \
131134
--silent \
132135
--max-time 20 \
133136
--head \
134137
--header "Host: $DD_HOSTNAME" \
135-
http://$DJANGO_IP/login?next=/)
138+
"http://${DJANGO_IP}/login?next=/")
136139
echo $OUT
137-
CR=`echo $OUT | egrep "^HTTP" | cut -d' ' -f2`
140+
CR=$(echo $OUT | egrep "^HTTP" | cut -d' ' -f2)
138141
echo $CR
139142
if [[ $CR -ne 200 ]]; then
140143
echo $RETRY
141144
if [[ $RETRY -gt 2 ]]; then
142145
kubectl get pods
143-
echo `kubectl logs --tail=30 -l defectdojo.org/component=django -c uwsgi`
146+
echo $(kubectl logs --tail=30 -l defectdojo.org/component=django -c uwsgi)
144147
echo "ERROR: cannot display login screen; got HTTP code $CR"
145148
exit 1
146149
else
147-
((RETRY++))
150+
RETRY=$((RETRY+1))
148151
echo "Attempt $RETRY to get login page"
149152
sleep 5
150153
fi
@@ -153,29 +156,51 @@ jobs:
153156
break
154157
fi
155158
done
159+
160+
- name: Test API auth call
161+
timeout-minutes: 10
162+
run: |-
156163
ADMIN_PASS=$(kubectl get secret/defectdojo -o jsonpath='{.data.DD_ADMIN_PASSWORD}' | base64 -d)
157164
echo "Simple API check"
158165
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
159-
CR=$(kubectl run curl --quiet=true --image=curlimages/curl:8.15.0 \
160-
--overrides='{ "apiVersion": "v1" }' \
161-
--restart=Never -i --rm -- \
162-
--silent \
163-
--max-time 20 \
164-
--header "Host: $DD_HOSTNAME" \
165-
--data-raw "username=admin&password=$ADMIN_PASS" \
166-
--output /dev/null \
167-
--write-out "%{http_code}\n" \
168-
http://$DJANGO_IP/api/v2/api-token-auth/)
169-
echo $CR
170-
if [[ $CR -ne 200 ]]; then
171-
echo "ERROR: login is not possible; got HTTP code $CR"
172-
exit 1
173-
else
174-
echo "Result received"
175-
fi
166+
RETRY=0
167+
while :
168+
do
169+
OUT=$(kubectl run curl --quiet=true --image=curlimages/curl:8.15.0 \
170+
--restart=Never -i --rm -- \
171+
--dump-header - \
172+
--no-progress-meter \
173+
--max-time 20 \
174+
--header "Host: $DD_HOSTNAME" \
175+
--data-raw "username=admin&password=$ADMIN_PASS" \
176+
"http://${DJANGO_IP}/api/v2/api-token-auth/")
177+
CR=$(echo $OUT | egrep "^HTTP" | cut -d' ' -f2)
178+
echo "Return code $CR"
179+
if [[ $CR -ne 200 ]]; then
180+
echo "Retry: $RETRY"
181+
if [[ $RETRY -gt 2 ]]; then
182+
kubectl get pods
183+
echo $(kubectl logs --tail=30 -l defectdojo.org/component=django -c uwsgi)
184+
echo "ERROR: cannot perform API login; got HTTP code $CR; Full response:"
185+
echo $OUT
186+
exit 1
187+
else
188+
RETRY=$((RETRY+1))
189+
echo "Attempt $RETRY to perform API login"
190+
sleep 5
191+
fi
192+
else
193+
echo "Result received"
194+
break
195+
fi
196+
done
197+
198+
- name: Check of logs
199+
timeout-minutes: 10
200+
run: |-
176201
echo "Final Check of components"
177-
errors=`kubectl get pods | grep Error | awk '{print $1}'`
178-
if [[ ! -z $errors ]]; then
202+
errors=$(kubectl get pods | grep Error | awk '{print $1}')
203+
if [[ ! -z $errors ]]; then
179204
echo "Few pods with errors"
180205
for line in $errors; do
181206
echo "Dumping log from $line"
@@ -185,3 +210,11 @@ jobs:
185210
else
186211
echo "DD K8S successfully deployed"
187212
fi
213+
214+
- name: Failed Logs
215+
if: failure()
216+
run: |-
217+
echo "ERROR: Here are logs from deployment/defectdojo-django containers:"
218+
kubectl logs deployment/defectdojo-django --all-pods=true --all-containers=true --tail=100
219+
echo "And all pod status one more time"
220+
kubectl get pods

.github/workflows/pr-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: "Autolabeler"
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
18+
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
1919
with:
2020
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2121
sync-labels: true

.github/workflows/release-1-create-pr.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,23 @@ jobs:
8080
sed -ri "0,/version/s/version: \S+/$NEW_CHART_VERSION/" helm/defectdojo/Chart.yaml
8181
fi
8282
83+
- name: Update values in HELM chart
84+
run: |
85+
yq -i '.annotations."artifacthub.io/prerelease" = "false"' helm/defectdojo/Chart.yaml
86+
yq -i '.annotations."artifacthub.io/changes" += "- kind: changed\n description: Bump DefectDojo to ${{ inputs.release_number }}\n"' helm/defectdojo/Chart.yaml
87+
8388
- name: Check version numbers
8489
run: |
8590
grep -H version dojo/__init__.py
8691
grep -H version components/package.json
8792
grep -H appVersion helm/defectdojo/Chart.yaml
8893
grep -H version helm/defectdojo/Chart.yaml
8994
95+
- name: Run helm-docs
96+
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
97+
with:
98+
chart-search-root: "helm/defectdojo"
99+
90100
- name: Push version changes
91101
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
92102
with:
@@ -97,7 +107,7 @@ jobs:
97107
branch: ${{ env.NEW_BRANCH }}
98108

99109
- name: Create Pull Request
100-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
110+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
101111
with:
102112
github-token: ${{ secrets.GITHUB_TOKEN }}
103113
script: |

.github/workflows/release-3-master-into-dev.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ jobs:
7474
git add docs/content/en/open_source/upgrading/$minorv.md
7575
if: endsWith(inputs.release_number_new, '.0') && endsWith(inputs.release_number_dev, '.0-dev')
7676

77+
- name: Update values in HELM chart
78+
run: |
79+
yq -i '.annotations = {}' helm/defectdojo/Chart.yaml
80+
yq -i '.annotations."artifacthub.io/prerelease" = "true"' helm/defectdojo/Chart.yaml
81+
yq -i '.annotations."artifacthub.io/changes" = ""' helm/defectdojo/Chart.yaml
82+
83+
- name: Run helm-docs
84+
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
85+
with:
86+
chart-search-root: "helm/defectdojo"
87+
7788
- name: Push version changes
7889
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
7990
with:
@@ -84,7 +95,7 @@ jobs:
8495
branch: ${{ env.NEW_BRANCH }}
8596

8697
- name: Create Pull Request
87-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
98+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
8899
with:
89100
github-token: ${{ secrets.GITHUB_TOKEN }}
90101
script: |
@@ -139,6 +150,17 @@ jobs:
139150
grep appVersion helm/defectdojo/Chart.yaml
140151
grep version components/package.json
141152
153+
- name: Update values in HELM chart
154+
run: |
155+
yq -i '.annotations = {}' helm/defectdojo/Chart.yaml
156+
yq -i '.annotations."artifacthub.io/prerelease" = "true"' helm/defectdojo/Chart.yaml
157+
yq -i '.annotations."artifacthub.io/changes" = ""' helm/defectdojo/Chart.yaml
158+
159+
- name: Run helm-docs
160+
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
161+
with:
162+
chart-search-root: "helm/defectdojo"
163+
142164
- name: Push version changes
143165
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
144166
with:
@@ -149,7 +171,7 @@ jobs:
149171
branch: ${{ env.NEW_BRANCH }}
150172

151173
- name: Create Pull Request
152-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
174+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
153175
with:
154176
github-token: ${{ secrets.GITHUB_TOKEN }}
155177
script: |

.github/workflows/release-x-manual-docker-containers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: echo "DOCKER_ORG=$(echo ${GITHUB_REPOSITORY%%/*} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
5353

5454
- name: Login to DockerHub
55-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
55+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
5656
with:
5757
username: ${{ secrets.DOCKERHUB_USERNAME }}
5858
password: ${{ secrets.DOCKERHUB_TOKEN }}

.github/workflows/release-x-manual-helm-chart.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ jobs:
6666

6767
- name: Configure HELM repos
6868
run: |-
69-
helm repo add bitnami https://charts.bitnami.com/bitnami
7069
helm dependency list ./helm/defectdojo
7170
helm dependency update ./helm/defectdojo
7271
7372
- name: Add yq
74-
uses: mikefarah/yq@f03c9dc599c37bfcaf533427211d05e51e6fee64 # v4.47.1
73+
uses: mikefarah/yq@6251e95af8df3505def48c71f3119836701495d6 # v4.47.2
7574

7675
- name: Pin version docker version
7776
id: pin_image
@@ -88,7 +87,7 @@ jobs:
8887
echo "chart_version=$(ls build | cut -d '-' -f 2,3 | sed 's|\.tgz||')" >> $GITHUB_ENV
8988
9089
- name: Create release ${{ inputs.release_number }}
91-
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
90+
uses: softprops/action-gh-release@62c96d0c4e8a889135c1f3a25910db8dbe0e85f7 # v2.3.4
9291
with:
9392
name: '${{ inputs.release_number }} 🌈'
9493
tag_name: ${{ inputs.release_number }}

0 commit comments

Comments
 (0)