Skip to content

Commit 6b64347

Browse files
authored
Merge branch 'bugfix' into anchoredocs
2 parents f8ee2e7 + 7eb1168 commit 6b64347

331 files changed

Lines changed: 20403 additions & 3768 deletions

File tree

Some content is hidden

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

.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/renovate.json

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
{
22
"extends": [
3-
"config:base"
3+
"config:recommended"
44
],
55
"dependencyDashboard": true,
66
"dependencyDashboardApproval": false,
7-
"baseBranches": ["dev"],
7+
"baseBranchPatterns": ["dev"],
88
"rebaseWhen": "conflicted",
99
"separateMinorPatch": true,
10-
"ignorePaths": ["requirements.txt", "requirements-lint.txt", "components/package.json", "components/package-lock.json", "dojo/components/yarn.lock", "dojo/components/package.json", "Dockerfile**"],
10+
"ignorePaths": [
11+
"requirements.txt",
12+
"requirements-lint.txt",
13+
"components/package.json",
14+
"components/package-lock.json",
15+
"dojo/components/yarn.lock",
16+
"dojo/components/package.json",
17+
"Dockerfile**"
18+
],
1119
"ignoreDeps": [],
1220
"packageRules": [{
13-
"packagePatterns": ["*"],
14-
"commitMessageExtra": "from {{currentVersion}} to {{#if isMajor}}v{{{newMajor}}}{{else}}{{#if isSingleVersion}}v{{{toVersion}}}{{else}}{{{newValue}}}{{/if}}{{/if}}",
21+
"matchPackageNames": ["*"],
22+
"commitMessageExtra": "from {{currentVersion}} to {{#if isMajor}}v{{{newMajor}}}{{else}}{{#if isSingleVersion}}v{{{newVersion}}}{{else}}{{{newValue}}}{{/if}}{{/if}}",
1523
"commitMessageSuffix": "({{packageFile}})",
1624
"labels": ["dependencies"]
1725
}],
18-
"registryAliases": {
19-
"bitnami": "https://charts.bitnami.com/bitnami"
20-
}
26+
"customManagers": [
27+
{
28+
"customType": "regex",
29+
"managerFilePatterns": [
30+
"/^.github/workflows//"
31+
],
32+
"matchStrings": [
33+
"\\w*:\\s[\"']?(?<currentValue>\\S*[^\"']?)[\"']?\\s#\\s*renovate:\\s*datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s"
34+
],
35+
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
36+
}
37+
]
2138
}

.github/workflows/build-docker-images-for-testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
echo $GITHUB_ENV
4141
4242
- name: Checkout
43-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4444
with:
4545
persist-credentials: false
4646

.github/workflows/close-stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
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.'
2828

2929
- name: Close stale issues and PRs
30-
uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
30+
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
3131
with:
3232
# Disable automatic stale marking - only close manually labeled items
3333
days-before-stale: -1

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ jobs:
1515
- name: Setup Hugo
1616
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
1717
with:
18-
hugo-version: '0.140.1'
18+
hugo-version: '0.140.1' # renovate: datasource=github-releases depName=gohugoio/hugo versioning=loose
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' # TODO: Renovate helper might not be needed here - needs to be fully tested
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') }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Update HELM docs for Renovate & Dependabot
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- dev
8+
- bugfix
9+
- release/**
10+
- hotfix/**
11+
12+
jobs:
13+
docs_updates:
14+
name: Update documentation
15+
runs-on: ubuntu-latest
16+
if: startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'dependabot/')
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
21+
- name: Run helm-docs
22+
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
23+
with:
24+
chart-search-root: "helm/defectdojo"
25+
git-push: true

.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' # renovate: datasource=github-releases depName=kubernetes/kubernetes versioning=loose
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' # renovate: datasource=github-releases depName=kubernetes/minikube versioning=loose
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: |

0 commit comments

Comments
 (0)