Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Commit f877e23

Browse files
author
Søren Howe Gersager
committed
Merge branch 'release/3.8.0' into 'master'
Release 3.8.0 - master See merge request bevillingsplatform/bevillingsplatform!1210
2 parents 71cf475 + ccc8fb4 commit f877e23

Some content is hidden

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

53 files changed

+4241
-2658
lines changed

.gitlab-ci.yml

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
# the private key needs to be set in the environment variable:
2020
# DOCS_SSH_KEY
2121

22+
include:
23+
- project: 'labs/salt-automation'
24+
ref: 'master'
25+
file:
26+
- '/gitlab-ci-templates/common/rules.v1.yml'
27+
- '/gitlab-ci-templates/common/config-updater-meta.v1.yml'
28+
- '/gitlab-ci-templates/common/saltbert.v1.yml'
29+
2230
stages:
2331
- lint
2432
# build stage is not blocked by lint stage, as we have a DAG:
@@ -49,7 +57,7 @@ variables:
4957
.lint-default: &lint-default
5058
stage: lint
5159
needs: []
52-
image: python:3.7
60+
image: python:3.10
5361
tags:
5462
- docker
5563

@@ -88,13 +96,12 @@ Lint Dockerfiles:
8896
Build docs:
8997
stage: build
9098
needs: []
91-
image: python:3.7
99+
image: python:3.10
92100
tags:
93101
- docker
94102
before_script:
95103
- pip3 install -r backend/requirements-test.txt
96104
- pip3 install -r backend/requirements.txt
97-
- apt-get update && apt-get install npm -y && npm install -g [email protected]
98105
script:
99106
- sphinx-build docs/source doc-build
100107
artifacts:
@@ -170,7 +177,9 @@ FrontendTest:
170177
SIMPLESAMLPHP_BASEURLPATH: http://idp:8080/simplesaml
171178
SIMPLESAMLPHP_SP_ENTITY_ID: http://bev:5000
172179
SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE: http://bev:5000/api/saml2_auth/acs/
173-
image: magentalabs/frontend-test:v0.2 #includes npm, chrome, firefox and ffmpeg
180+
image:
181+
name: testcafe/testcafe:latest
182+
entrypoint: ["/bin/sh", "-c"]
174183
tags:
175184
- docker
176185
- high-mem
@@ -182,14 +191,18 @@ FrontendTest:
182191
- name: magentalabs/os2bos-idp-test:2.0.1
183192
alias: idp
184193
before_script:
194+
- npm --version
185195
- cd frontend-tests
186196
- npm install
187197
script:
188-
- ./node_modules/.bin/testcafe chrome:headless tests/*.js --baseurl http://bev:5000 --screenshot $CI_PROJECT_DIR/artifacts --video $CI_PROJECT_DIR/artifacts --assertion-timeout 15000 --selector-timeout 15000
198+
- /opt/testcafe/docker/testcafe-docker.sh chromium:headless tests/*.js --baseurl http://bev:5000 --cache --cs node_modules/axe-core/axe.min.js --screenshots $CI_PROJECT_DIR/artifacts --video $CI_PROJECT_DIR/artifacts --video-options pathPattern='${DATE}_${TIME}/${FIXTURE} - ${TEST}.mp4' --assertion-timeout 10000 --selector-timeout 10000 --pageRequestTimeout 10000 --reporter spec,xunit:$CI_PROJECT_DIR/testcafe.xml
189199
artifacts:
190200
when: always
191201
paths:
192202
- $CI_PROJECT_DIR/artifacts
203+
reports:
204+
junit: $CI_PROJECT_DIR/testcafe.xml
205+
193206

194207
# Release stage
195208
###############
@@ -291,7 +304,6 @@ Publish database docs:
291304

292305
.deploy-default: &deploy-default
293306
stage: deploy
294-
image: magentalabs/pepper:latest
295307
services: []
296308
dependencies: []
297309
tags:
@@ -340,44 +352,53 @@ Deploy dev:
340352
url: https://cburdev.magenta.dk
341353

342354

355+
Update staging salt config:
356+
extends:
357+
- .rules:semver-all
358+
- .config:endpoint-with-tag
359+
needs: ["Release rc"]
360+
when: manual
361+
variables:
362+
ENDPOINT: os2bos/salt/ballerup/update-staging
363+
CONFIG_UPDATER_USERNAME: os2bos
364+
343365
Deploy tag to staging:
344366
<<: *deploy-default
345-
needs: ["Release rc"]
367+
extends:
368+
- .rules:semver-all
369+
- .saltbert
370+
needs: ["Update staging salt config"]
346371
when: manual
347-
only:
348-
variables:
349-
# Matches all of SemVer 2.0.0
350-
- $CI_COMMIT_TAG =~ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
351372
variables:
352-
DEPLOYMENT_NAMESPACE: cbur.ballerup.staging
353-
SALTAPI_URL: https://ctrl1.magenta-aps.dk/api/
354-
SALTAPI_EAUTH: file
355-
GIT_STRATEGY: none
356-
PILLAR_OVERRIDE: "{\"OS2BOS_APPLICATION_DOCKER_IMAGE\":\"${IMAGE}:${CI_COMMIT_TAG}\"}"
357-
script:
358-
- echo Deploying ${IMAGE_TAG} to https://test-bevilling.balk.dk
359-
- pepper --client runner --fail-any state.orchestrate ${DEPLOYMENT_NAMESPACE} pillar=$(echo $PILLAR_OVERRIDE)
373+
SALTBERT_ORCHESTRATION: cbur.ballerup.staging
374+
SALTBERT_URL: https://ctrl1.magenta-aps.dk
375+
SALTBERT_PASSWORD: $SALTBERT_STAGING_PASSWORD
360376
environment:
361377
name: ballerup-staging
362378
url: https://test-bevilling.balk.dk
363379

380+
Update production salt config:
381+
extends:
382+
- .rules:semver-core
383+
- .config:endpoint-with-tag
384+
needs: ["Release master"]
385+
when: manual
386+
variables:
387+
ENDPOINT: os2bos/salt/ballerup/update-production
388+
CONFIG_UPDATER_USERNAME: os2bos
389+
364390

365-
Deploy master:
391+
Deploy tag to production:
366392
<<: *deploy-default
367-
needs: ["Release master"]
393+
extends:
394+
- .rules:semver-core
395+
- .saltbert
396+
needs: ["Update production salt config"]
368397
when: manual
369-
only:
370-
variables:
371-
# Matches <version core> from SemVer 2.0.0 BNF grammar. Ex. 2.3.4, but not 2.3.4-rc
372-
- $CI_COMMIT_TAG =~ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
373398
variables:
374-
DEPLOYMENT_NAMESPACE: cbur.ballerup.production
375-
SALTAPI_URL: https://ctrl1.magenta-aps.dk/api/
376-
SALTAPI_EAUTH: file
377-
GIT_STRATEGY: none
378-
script:
379-
- echo Deploying ${IMAGE_TAG} to https://bevilling.balk.dk
380-
- pepper --client runner --fail-any state.orchestrate ${DEPLOYMENT_NAMESPACE}
399+
SALTBERT_ORCHESTRATION: cbur.ballerup.production
400+
SALTBERT_URL: https://ctrl1.magenta-aps.dk
401+
SALTBERT_PASSWORD: $SALTBERT_PROD_PASSWORD
381402
environment:
382403
name: ballerup-production
383404
url: https://bevilling.balk.dk

NEWS.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
Version 3.8.0, 2022-03-08
2+
-------------------------
3+
4+
New in this version:
5+
6+
Features
7+
^^^^^^^^
8+
9+
* Allow readonly users readonly access to GraphQL API.
10+
* Remove soft-deleted functionality for activities.
11+
* Enforce only one adjustment/modifies per activity on the database level.
12+
* Update Python to 3.10, Django to 3.2 and update dependencies in general
13+
* Overhaul and speed-up frontend E2E tests in the CI pipeline.
14+
115
Version 3.7.1, 2022-01-24
216
-------------------------
317

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.1
1+
3.8.0

backend/bevillingsplatform/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"django_filters",
112112
"simple_history",
113113
"constance",
114-
"constance.backends.database",
114+
"core.apps.ModifiedConstanceDatabaseConfig",
115115
"core.apps.CoreConfig",
116116
"django_saml2_auth",
117117
"graphene_django",
@@ -172,6 +172,8 @@
172172
}
173173
}
174174

175+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
176+
175177

176178
# Password validation
177179
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

backend/core/admin.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def has_view_permission(self, request, obj=None):
7272
user = request.user
7373
return user.is_authenticated and user.is_workflow_engine_or_admin()
7474

75-
def has_add_permission(self, request):
75+
def has_add_permission(self, request, obj=None):
7676
"""Override has_add_permission for InlineModelAdmin."""
7777
user = request.user
7878
return user.is_authenticated and user.is_workflow_engine_or_admin()
@@ -447,6 +447,18 @@ class CustomUserAdmin(BaseUserAdmin):
447447
("Organisation", {"fields": ("team",)}),
448448
) + BaseUserAdmin.fieldsets
449449

450+
list_display = (
451+
"username",
452+
"email",
453+
"first_name",
454+
"last_name",
455+
"team",
456+
"is_staff",
457+
"is_active",
458+
)
459+
460+
list_filter = ("team", "is_staff", "is_superuser", "is_active")
461+
450462
def has_view_permission(self, request, obj=None):
451463
"""Override has_view_permission for ModelAdmin."""
452464
user = request.user

backend/core/apps.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ class CoreConfig(AppConfig):
1717
def ready(self):
1818
"""Defer import of signals until ready."""
1919
import core.signals # noqa
20+
21+
22+
class ModifiedConstanceDatabaseConfig(AppConfig):
23+
"""Modified django-constance AppConfig.
24+
25+
While we wait for django-constance to provide their
26+
own apps.py specifying default_auto_field:
27+
https://github.com/jazzband/django-constance/pull/449
28+
"""
29+
30+
name = "constance.backends.database"
31+
default_auto_field = "django.db.models.AutoField"

backend/core/managers.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,22 @@ def paid_date_or_date_lte(self, date):
7575
def strict_amount_sum(self):
7676
"""Sum over Payments amount."""
7777
return (
78-
self.aggregate(amount_sum=Coalesce(Sum("amount"), 0))["amount_sum"]
78+
self.aggregate(
79+
amount_sum=Coalesce(
80+
Sum("amount"), 0, output_field=DecimalField()
81+
)
82+
)["amount_sum"]
7983
or 0
8084
)
8185

8286
def amount_sum(self):
8387
"""Sum over Payments with paid_amount overruling amount."""
8488
return (
85-
self.aggregate(amount_sum=Coalesce(Sum(self.amount_case), 0))[
86-
"amount_sum"
87-
]
89+
self.aggregate(
90+
amount_sum=Coalesce(
91+
Sum(self.amount_case), 0, output_field=DecimalField()
92+
)
93+
)["amount_sum"]
8894
or 0
8995
)
9096

@@ -454,7 +460,14 @@ def get_duplicate_sbsys_id_appropriations_for_dst(self):
454460
.exclude(sbsys_common=None)
455461
.values("sbsys_common")
456462
.annotate(ids=ArrayAgg("id", distinct=True))
457-
.annotate(id_count=Func("ids", Value(1), function="array_length"))
463+
.annotate(
464+
id_count=Func(
465+
"ids",
466+
Value(1),
467+
function="array_length",
468+
output_field=IntegerField(),
469+
)
470+
)
458471
.filter(id_count__gt=1)
459472
)
460473

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Django 2.2.16 on 2021-10-28 09:27
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("core", "0104_auto_20220118_1324"),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name="activity",
16+
name="modifies",
17+
field=models.OneToOneField(
18+
blank=True,
19+
null=True,
20+
on_delete=django.db.models.deletion.CASCADE,
21+
related_name="modified_by",
22+
to="core.Activity",
23+
verbose_name="justeres af aktivitet",
24+
),
25+
),
26+
]

0 commit comments

Comments
 (0)