Skip to content

Commit a9f18b4

Browse files
authored
Merge pull request DefectDojo#5979 from DefectDojo/release/2.8.0
Release: Merge release into master from: release/2.8.0
2 parents 9be7b81 + 0207c33 commit a9f18b4

File tree

96 files changed

+2948
-442
lines changed

Some content is hidden

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

96 files changed

+2948
-442
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
extended: true
2121

2222
- name: Setup Node
23-
uses: actions/setup-node@v2
23+
uses: actions/setup-node@v3
2424
with:
2525
node-version: '12.x'
2626

.github/workflows/integration-tests.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272

7373
integration_tests:
7474
# run tests with docker-compose
75-
name: integration tests
75+
name: test
7676
needs: build
7777
runs-on: ubuntu-latest
7878
strategy:
@@ -101,6 +101,7 @@ jobs:
101101
"tests/check_various_pages.py",
102102
"tests/notifications_test.py",
103103
]
104+
profile: ["mysql-rabbitmq", "postgres-redis"]
104105
fail-fast: false
105106

106107
steps:
@@ -122,24 +123,28 @@ jobs:
122123
- name: Set integration-test mode
123124
run: ln -s docker-compose.override.integration_tests.yml docker-compose.override.yml
124125

125-
# phased startup so we can use the exit code from integrationtest container
126+
# phased startup with MySQL and RabbitMQ so we can use the exit code from integrationtest container
126127

127-
- name: Start Dojo
128-
# implicity starts uwsgi and rabbitmq
129-
run: docker-compose up -d mysql nginx celerybeat celeryworker mailhog
128+
- name: Start Dojo MySQL + RabbitMQ
129+
if: matrix.profile == 'mysql-rabbitmq'
130+
run: docker-compose --profile ${{ matrix.profile }} --env-file ./docker/environments/${{ matrix.profile }}.env up --no-deps -d mysql nginx celerybeat celeryworker mailhog uwsgi rabbitmq
131+
132+
- name: Start Dojo PostgreSQL + Redis
133+
if: matrix.profile == 'postgres-redis'
134+
run: docker-compose --profile ${{ matrix.profile }} --env-file ./docker/environments/${{ matrix.profile }}.env up --no-deps -d postgres nginx celerybeat celeryworker mailhog uwsgi redis
130135

131136
- name: Initialize
132-
run: docker-compose up --exit-code-from initializer initializer
137+
run: docker-compose --profile ${{ matrix.profile }} --env-file ./docker/environments/${{ matrix.profile }}.env up --no-deps --exit-code-from initializer initializer
133138

134139
- name: Integration tests
135-
run: docker-compose up --exit-code-from integration-tests integration-tests
140+
run: docker-compose --profile ${{ matrix.profile }} --env-file ./docker/environments/${{ matrix.profile }}.env up --no-deps --exit-code-from integration-tests integration-tests
136141
env:
137142
DD_INTEGRATION_TEST_FILENAME: ${{ matrix.test-case }}
138143

139144
- name: Logs
140145
if: always()
141-
run: docker-compose logs --tail="2500"
146+
run: docker-compose --profile ${{ matrix.profile }} --env-file ./docker/environments/${{ matrix.profile }}.env logs --tail="2500"
142147

143148
- name: Shutdown
144149
if: always()
145-
run: docker-compose down
150+
run: docker-compose --profile ${{ matrix.profile }} --env-file ./docker/environments/${{ matrix.profile }}.env down

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
- name: Create Pull Request
8181
env:
8282
REPO_ORG: ${{ steps.set-repo-org.outputs.repoorg }}
83-
uses: actions/github-script@v5
83+
uses: actions/github-script@v6
8484
with:
8585
github-token: ${{ secrets.GITHUB_TOKEN }}
8686
script: |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Create Pull Request
6262
env:
6363
REPO_ORG: ${{ steps.set-repo-org.outputs.repoorg }}
64-
uses: actions/github-script@v5
64+
uses: actions/github-script@v6
6565
with:
6666
github-token: ${{ secrets.GITHUB_TOKEN }}
6767
script: |

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
update_release_draft:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: release-drafter/release-drafter@v5.17.6
22+
- uses: release-drafter/release-drafter@v5.18.1
2323
with:
2424
version: ${{github.event.inputs.version}}
2525
env:

.github/workflows/unit-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ jobs:
6161

6262
# phased startup so we can use the exit code from unit test container
6363
- name: Start MySQL
64-
run: docker-compose up -d mysql
64+
run: docker-compose --env-file ./docker/environments/mysql-redis.env up -d mysql
6565

6666
# no celery or initializer needed for unit tests
6767
- name: Unit tests
68-
run: docker-compose up --no-deps --exit-code-from uwsgi uwsgi
68+
run: docker-compose --profile mysql-redis --env-file ./docker/environments/mysql-redis.env up --no-deps --exit-code-from uwsgi uwsgi
6969

7070
- name: Logs
7171
if: failure()
72-
run: docker-compose logs --tail="2500" uwsgi
72+
run: docker-compose --profile mysql-redis --env-file ./docker/environments/mysql-redis.env logs --tail="2500" uwsgi
7373

7474
- name: Shutdown
7575
if: always()
76-
run: docker-compose down
76+
run: docker-compose --profile mysql-redis --env-file ./docker/environments/mysql-redis.env down

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ dojo/uploads/threat/*
8282
*.db
8383
celerybeat.pid
8484
*.env*
85+
!docker/environments/*.env
8586

8687
weekly.txt
8788
Monthly.txt

Dockerfile.django

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
# Dockerfile.nginx to use the caching mechanism of Docker.
66

77
# Ref: https://devguide.python.org/#branchstatus
8-
FROM python:3.8.12-slim-buster@sha256:7e732593f25983fa7d4b2d54444be4a785f2397c1cf2f815d2e3638337eee012 as base
8+
FROM python:3.8.12-slim-bullseye@sha256:3d3edc52cfae3ed6fb8303559f10184f962a8069194b2dee93baaac66ebedeb5 as base
99
FROM base as build
1010
WORKDIR /app
1111
RUN \
1212
apt-get -y update && \
1313
apt-get -y install --no-install-recommends \
14+
gcc \
1415
build-essential \
1516
dnsutils \
1617
default-mysql-client \
@@ -24,7 +25,9 @@ RUN \
2425
rm -rf /var/lib/apt/lists && \
2526
true
2627
COPY requirements.txt ./
27-
RUN pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
28+
# CPUCOUNT=1 is needed, otherwise the wheel for uwsgi won't always be build succesfully
29+
# https://github.com/unbit/uwsgi/issues/1318#issuecomment-542238096
30+
RUN CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
2831

2932
FROM base as django
3033
WORKDIR /app
@@ -103,19 +106,12 @@ RUN \
103106
mkdir -p media/threat && chown -R ${uid} media
104107
USER ${uid}
105108
ENV \
109+
# Only variables that are not defined in settings.dist.py
106110
DD_ADMIN_USER=admin \
107111
108112
DD_ADMIN_PASSWORD='' \
109-
DD_ADMIN_FIRST_NAME=Administrator \
113+
DD_ADMIN_FIRST_NAME=Admin \
110114
DD_ADMIN_LAST_NAME=User \
111-
DD_ALLOWED_HOSTS="*" \
112-
DD_CELERY_BEAT_SCHEDULE_FILENAME="/run/celery-beat-schedule" \
113-
DD_CELERY_BROKER_SCHEME="amqp" \
114-
DD_CELERY_BROKER_USER="defectdojo" \
115-
DD_CELERY_BROKER_PASSWORD="defectdojo" \
116-
DD_CELERY_BROKER_HOST="rabbitmq" \
117-
DD_CELERY_BROKER_PORT="5672" \
118-
DD_CELERY_BROKER_PATH="//" \
119115
DD_CELERY_LOG_LEVEL="INFO" \
120116
DD_CELERY_WORKER_POOL_TYPE="solo" \
121117
# Enable prefork and options below to ramp-up celeryworker performance. Presets should work fine for a machine with 8GB of RAM, while still leaving room.
@@ -125,19 +121,11 @@ ENV \
125121
# DD_CELERY_WORKER_AUTOSCALE_MAX="8" \
126122
# DD_CELERY_WORKER_CONCURRENCY="8" \
127123
# DD_CELERY_WORKER_PREFETCH_MULTIPLIER="128" \
128-
DD_DATABASE_ENGINE="django.db.backends.mysql" \
129-
DD_DATABASE_HOST="mysql" \
130-
DD_DATABASE_NAME="defectdojo" \
131-
DD_DATABASE_PASSWORD="defectdojo" \
132-
DD_DATABASE_PORT="3306" \
133-
DD_DATABASE_USER="defectdojo" \
134124
DD_INITIALIZE=true \
135125
DD_UWSGI_MODE="socket" \
136126
DD_UWSGI_ENDPOINT="0.0.0.0:3031" \
137127
DD_UWSGI_NUM_OF_PROCESSES="2" \
138-
DD_UWSGI_NUM_OF_THREADS="2" \
139-
DD_TRACK_MIGRATIONS="True" \
140-
DD_DJANGO_METRICS_ENABLED="False"
128+
DD_UWSGI_NUM_OF_THREADS="2"
141129
ENTRYPOINT ["/entrypoint-uwsgi.sh"]
142130

143131
FROM django as django-unittests

Dockerfile.integration-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# code: language=Dockerfile
33

4-
FROM python:3.8.12-slim-buster@sha256:7e732593f25983fa7d4b2d54444be4a785f2397c1cf2f815d2e3638337eee012 as build
4+
FROM python:3.8.12-slim-bullseye@sha256:3d3edc52cfae3ed6fb8303559f10184f962a8069194b2dee93baaac66ebedeb5 as build
55
WORKDIR /app
66
RUN \
77
apt-get -y update && \

Dockerfile.nginx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
12
# code: language=Dockerfile
23

34
# The code for the build image should be identical with the code in
45
# Dockerfile.django to use the caching mechanism of Docker.
56

6-
FROM python:3.8.12-slim-buster@sha256:7e732593f25983fa7d4b2d54444be4a785f2397c1cf2f815d2e3638337eee012 as build
7+
# Ref: https://devguide.python.org/#branchstatus
8+
FROM python:3.8.12-slim-bullseye@sha256:3d3edc52cfae3ed6fb8303559f10184f962a8069194b2dee93baaac66ebedeb5 as base
9+
FROM base as build
710
WORKDIR /app
811
RUN \
912
apt-get -y update && \
10-
apt-get -y install \
13+
apt-get -y install --no-install-recommends \
14+
gcc \
1115
build-essential \
1216
dnsutils \
1317
default-mysql-client \
@@ -21,7 +25,10 @@ RUN \
2125
rm -rf /var/lib/apt/lists && \
2226
true
2327
COPY requirements.txt ./
24-
RUN pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
28+
# CPUCOUNT=1 is needed, otherwise the wheel for uwsgi won't always be build succesfully
29+
# https://github.com/unbit/uwsgi/issues/1318#issuecomment-542238096
30+
RUN CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
31+
2532

2633
FROM build AS collectstatic
2734

@@ -32,10 +39,10 @@ ENV \
3239
node="nodejs"
3340
RUN \
3441
apt-get -y update && \
35-
apt-get -y install --no-install-recommends apt-transport-https ca-certificates curl wget && \
42+
apt-get -y install --no-install-recommends apt-transport-https ca-certificates curl wget gnupg && \
3643
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add --no-tty - && \
37-
echo 'deb https://deb.nodesource.com/node_14.x buster main' > /etc/apt/sources.list.d/nodesource.list && \
38-
echo 'deb-src https://deb.nodesource.com/node_14.x buster main' >> /etc/apt/sources.list.d/nodesource.list && \
44+
echo 'deb https://deb.nodesource.com/node_14.x bullseye main' > /etc/apt/sources.list.d/nodesource.list && \
45+
echo 'deb-src https://deb.nodesource.com/node_14.x bullseye main' >> /etc/apt/sources.list.d/nodesource.list && \
3946
apt-get update -y -o Dir::Etc::sourcelist="sources.list.d/nodesource.list" \
4047
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" && \
4148
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \

0 commit comments

Comments
 (0)