Skip to content

Commit 3ae5865

Browse files
authored
Merge pull request #64 from VNG-Realisatie/develop
Develop to master
2 parents 586cc58 + cd3b6e9 commit 3ae5865

20 files changed

+667
-28
lines changed

.travis.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
language: python
2+
cache: pip
3+
4+
python:
5+
- "3.6"
6+
7+
services:
8+
- postgresql
9+
10+
addons:
11+
postgresql: "10"
12+
13+
env:
14+
global:
15+
- DJANGO_SETTINGS_MODULE=brc.conf.jenkins
16+
- SECRET_KEY=dummy
17+
- DB_USER=postgres
18+
- DB_PASSWORD=
19+
- DEPLOYMENT=brc
20+
matrix:
21+
- TOXENV=django_tests
22+
- TOXENV=isort
23+
- TOXENV=black
24+
25+
install:
26+
- pip install tox tox-travis
27+
28+
script: tox
29+
30+
jobs:
31+
include:
32+
# First stage is 'Tests' by default and populated from env matrix
33+
# expansion
34+
- stage: Docker images
35+
name: Test docker image build
36+
services:
37+
- docker
38+
install: skip
39+
script:
40+
- bash bin/release-docker-image.sh
41+
after_success: echo "deploying..."
42+
deploy:
43+
- provider: script
44+
script: bash bin/cicd.sh latest yes
45+
on:
46+
branch: master
47+
48+
- provider: script
49+
script: bash bin/cicd.sh $TRAVIS_TAG yes
50+
on:
51+
tags: true
52+
53+
after_success:
54+
- pip install codecov
55+
- codecov

Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ FROM python:3.6-alpine AS production
6767
RUN apk --no-cache add \
6868
ca-certificates \
6969
mailcap \
70+
make \
7071
musl \
7172
pcre \
7273
postgresql \
@@ -80,6 +81,7 @@ RUN apk --no-cache add \
8081

8182
COPY --from=build /usr/local/lib/python3.6 /usr/local/lib/python3.6
8283
COPY --from=build /usr/local/bin/uwsgi /usr/local/bin/uwsgi
84+
COPY --from=build /usr/local/bin/sphinx-build /usr/local/bin/sphinx-build
8385
# required for swagger2openapi conversion
8486
COPY --from=frontend-build /app/node_modules /app/node_modules
8587

@@ -91,11 +93,15 @@ RUN mkdir /app/log
9193
COPY --from=frontend-build /app/src/brc/static/fonts /app/src/brc/static/fonts
9294
COPY --from=frontend-build /app/src/brc/static/css /app/src/brc/static/css
9395
COPY ./src /app/src
96+
COPY ./docs /app/docs
9497

9598
ENV DJANGO_SETTINGS_MODULE=brc.conf.docker
9699

97100
ARG SECRET_KEY=dummy
98101

102+
# build docs
103+
RUN make -C docs html
104+
99105
# Run collectstatic, so the result is already included in the image
100106
RUN python src/manage.py collectstatic --noinput
101107

README.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ besluitregistratiecomponent
77
:Keywords: zaken, zaakgericht werken, GEMMA, RGBZ, BRC
88
:PythonVersion: 3.6
99

10-
|build-status|
10+
|build-status| |black|
1111

1212
Referentieimplementatie van de besluitregistratiecomponent (BRC).
1313

@@ -42,14 +42,17 @@ References
4242
* `Code <https://github.com/VNG-Realisatie/gemma-besluitregistratiecomponent/>`_
4343

4444

45-
.. |build-status| image:: http://jenkins.nlx.io/buildStatus/icon?job=gemma-besluitregistratiecomponent-stable
45+
.. |build-status| image:: https://travis-ci.org/VNG-Realisatie/gemma-besluitregistratiecomponent.svg?branch=develop
4646
:alt: Build status
47-
:target: http://jenkins.nlx.io/job/gemma-besluitregistratiecomponent-stable
47+
:target: https://travis-ci.org/VNG-Realisatie/gemma-besluitregistratiecomponent
4848

4949
.. |requirements| image:: https://requires.io/github/VNG-Realisatie/gemma-besluitregistratiecomponent/requirements.svg?branch=master
5050
:target: https://requires.io/github/VNG-Realisatie/gemma-besluitregistratiecomponent/requirements/?branch=master
5151
:alt: Requirements status
5252

53+
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
54+
:target: https://github.com/psf/black
55+
5356
.. _testomgeving: https://ref.tst.vng.cloud/brc/
5457

5558
Licentie

bin/cicd.sh

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -u
4+
5+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
6+
7+
release_tag=$1
8+
do_deploy=$2
9+
shift
10+
11+
JOB_NAME=push ./bin/release-docker-image.sh $release_tag
12+
13+
14+
deploy() {
15+
set +x
16+
17+
# Trigger deploy
18+
curl https://deploy-bot-zgw.vng.cloud/api/v1/deployments \
19+
-H "Authorization: Token ${DEPLOY_BOT_TOKEN}" \
20+
-H "Content-Type: application/json" \
21+
--request POST \
22+
--data @- << EOF
23+
{
24+
"name":"${DEPLOYMENT}",
25+
"namespace":"zgw",
26+
"containerName":"${DEPLOYMENT}",
27+
"image": "vngr/besluiten-api:${release_tag}"
28+
}
29+
EOF
30+
set -x
31+
32+
echo "Deploy triggered"
33+
}
34+
35+
36+
if [[ $do_deploy == "yes" ]]; then
37+
deploy
38+
fi

bin/docker_start.sh

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ uwsgi \
4242
--module brc.wsgi \
4343
--static-map /static=/app/static \
4444
--static-map /media=/app/media \
45+
--static-map /_docs=/app/docs/_build/html \
4546
--chdir src \
4647
--processes 2 \
4748
--threads 2 \

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
sys.path.insert(0, os.path.abspath('../src'))
2020

21-
os.environ['DJANGO_SETTINGS_MODULE'] = 'brc.conf.dev'
21+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drc.conf.dev')
2222

2323
django.setup()
2424

requirements/base.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Pillow
21
pip-tools
32
psycopg2-binary
43
python-dotenv
@@ -17,4 +16,4 @@ django-markup==1.3
1716
django_redis
1817

1918
djangorestframework
20-
vng-api-common<1.1.0
19+
vng-api-common

requirements/base.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# pip-compile --no-index requirements/base.in
5+
# pip-compile --no-index --output-file requirements/base.txt requirements/base.in
66
#
77
alabaster==0.7.12 # via sphinx
88
babel==2.6.0 # via sphinx
@@ -19,6 +19,7 @@ django-filter==2.1.0 # via vng-api-common
1919
django-ipware==2.1.0 # via django-axes
2020
django-markup==1.3
2121
django-redis==4.10.0
22+
django-rest-framework-condition==0.1.1 # via vng-api-common
2223
django-solo==1.1.3 # via vng-api-common
2324
django==2.2.8
2425
djangorestframework-camel-case==0.2.0 # via vng-api-common
@@ -33,12 +34,11 @@ inflection==0.3.1 # via drf-yasg
3334
iso-639==0.4.5 # via vng-api-common
3435
isodate==0.6.0 # via vng-api-common
3536
itypes==1.1.0 # via coreapi
36-
jinja2==2.10.1 # via coreschema, sphinx
37+
jinja2==2.11.2 # via coreschema, sphinx
3738
markdown==3.1
38-
markupsafe==1.0 # via jinja2
39+
markupsafe==1.1.1 # via jinja2
3940
oyaml==0.7 # via vng-api-common
4041
packaging==19.0 # via sphinx
41-
pillow==5.2.0
4242
pip-tools==4.2.0
4343
psycopg2-binary==2.7.5
4444
pygments==2.3.1 # via sphinx
@@ -61,7 +61,7 @@ sqlparse==0.3.0 # via django
6161
unidecode==1.0.22 # via vng-api-common
6262
uritemplate==3.0.0 # via coreapi, drf-yasg
6363
urllib3==1.24.3 # via requests
64-
vng-api-common==1.0.34
64+
vng-api-common==1.4.4
6565

6666
# The following packages are considered to be unsafe in a requirements file:
6767
# setuptools==42.0.2 # via markdown, sphinx

requirements/jenkins.txt

+5-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# pip-compile --no-index --output-file=requirements/jenkins.txt requirements/base.txt requirements/jenkins.in requirements/testing.in
5+
# pip-compile --no-index --output-file requirements/jenkins.txt requirements/base.txt requirements/testing.in requirements/jenkins.in
66
#
77
alabaster==0.7.12
88
astroid==1.6.5 # via pylint
@@ -22,6 +22,7 @@ django-ipware==2.1.0
2222
django-jenkins==0.110.0
2323
django-markup==1.3
2424
django-redis==4.10.0
25+
django-rest-framework-condition==0.1.1
2526
django-solo==1.1.3
2627
django==2.2.8
2728
djangorestframework-camel-case==0.2.0
@@ -40,15 +41,14 @@ iso-639==0.4.5
4041
isodate==0.6.0
4142
isort==4.3.4
4243
itypes==1.1.0
43-
jinja2==2.10.1
44+
jinja2==2.11.2
4445
lazy-object-proxy==1.3.1 # via astroid
4546
markdown==3.1
46-
markupsafe==1.0
47+
markupsafe==1.1.1
4748
mccabe==0.6.1 # via pylint
4849
oyaml==0.7
4950
packaging==19.0
5051
pep8==1.7.1
51-
pillow==5.2.0
5252
pip-tools==4.2.0
5353
psycopg2-binary==2.7.5
5454
pygments==2.3.1
@@ -75,8 +75,5 @@ text-unidecode==1.2 # via faker
7575
unidecode==1.0.22
7676
uritemplate==3.0.0
7777
urllib3==1.24.3
78-
vng-api-common==1.0.34
78+
vng-api-common==1.4.4
7979
wrapt==1.10.11 # via astroid
80-
81-
# The following packages are considered to be unsafe in a requirements file:
82-
# setuptools==42.0.2 # via markdown, sphinx

src/brc/api/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Meta:
7171
IsImmutableValidator(),
7272
PublishValidator(
7373
"BesluitType", settings.ZTC_API_SPEC, get_auth=get_ztc_auth
74-
)
74+
),
7575
]
7676
},
7777
}

src/brc/api/tests/test_besluit.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from rest_framework.test import APITestCase
33
from vng_api_common.tests import JWTAuthMixin, get_operation_url, get_validation_errors
44

5-
from brc.datamodel.models import BesluitInformatieObject
6-
from brc.datamodel.tests.factories import BesluitFactory, BesluitInformatieObjectFactory
5+
from brc.datamodel.tests.factories import BesluitFactory
76

87
from .mixins import MockSyncMixin
98

0 commit comments

Comments
 (0)