Skip to content

Commit 60e7b23

Browse files
authored
BB2-448 Create multi stage PR checks for continuous-integration/jenkins/pr-merge (#886)
* Remove Travis/TOX completely - Remove .travis.yml and tox.ini files. Travis functionality is also being removed for BB2-449, so it makes sense to remove completely here. However, BB2-449 will have to be released together with this PR. BB2-448 * Rename Jenkins and Kubernetes POD config files - Rename Kubernetes POD config file from cbc-run-integration-tests.yaml to cbc-pod-deployment-config.yml. - Rename POD config file referrence and rename file Jenkinsfile.cbc-run-integration-tests to Jenkinsfile.cbc-run-multi-pr-checks BB2-448 * Add unit tests stage to pipeline - Add unit tests as a new stage in Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks BB2-448 * Test notifyGithubStatus * Unset ENV vars in runtests.py - Unset ENV vars in runtests.py for unit type tests for DJANGO_USER_ID_ITERATIONS' and 'DJANGO_USER_ID_SALT' BB2-448 * Add flake8 configuration file * Add flake8 lint/style check stage to pipeline - Add flake8 check as a new stage in Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks BB2-448 * Add pip install for flake8 check * Fix Jenkinsfile stage ordering * Fix flake8 stage with venv * Fix Jenkinsfile issue * Update requirements for require-hashes and DEV - In Makefile, update the "reqs-download" option to download package files for both requirements.txt and requirements.dev.txt in to the ./vendor/ directory. - In Makefile, update the "reqs-install" and "reqs-install-dev" options to require checking the hashes via the --require-hashes option. - Include extra DEV related packages under ./vendor/ directory. - Remove "make reqs-install" since "make reqs-install-dev" will install all needed packages in Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks BB2-448 * Remove require-hashes until after amz linux tests
1 parent 86bdfbb commit 60e7b23

27 files changed

+34
-53
lines changed

Diff for: .flake8

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 130
3+
ignore = F403,F405,W503
4+
exclude = migrations,docs,examples,bluebutton-css,vendor,venv,*/management/*

Diff for: .travis.yml

-23
This file was deleted.

Diff for: Jenkinsfiles/Jenkinsfile.cbc-run-integration-tests renamed to Jenkinsfiles/Jenkinsfile.cbc-run-multi-pr-checks

+25-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pipeline {
22
agent {
33
kubernetes {
44
defaultContainer "bb2-cbc-build"
5-
yamlFile "Jenkinsfiles/cbc-run-integration-tests.yaml"
5+
yamlFile "Jenkinsfiles/cbc-pod-deployment-config.yaml"
66
}
77
}
88

@@ -24,29 +24,46 @@ pipeline {
2424
}
2525

2626
stages {
27-
stage("Copy FHIR cert and key") {
27+
stage("SETUP FHIR cert and key") {
2828
steps {
2929
writeFile(file: "${env.DJANGO_FHIR_CERTSTORE}/certstore/ca.cert.pem", text: readFile(env.FHIR_CERT))
3030
writeFile(file: "${env.DJANGO_FHIR_CERTSTORE}/certstore/ca.key.nocrypt.pem", text: readFile(env.FHIR_KEY))
3131
}
3232
}
3333

34-
stage("Create venv and install dependencies") {
34+
stage("INSTALL Python Packages") {
3535
steps {
3636
sh """
3737
python -m venv venv
3838
. venv/bin/activate
39-
pip install -r requirements/requirements.txt --no-index --find-links ./vendor/
40-
pip install sqlparse
39+
make reqs-install-dev
4140
"""
4241
}
4342
}
4443

45-
stage("Run integration tests") {
44+
stage("CHECK Flake8 Python Lint/Style") {
4645
steps{
4746
sh """
48-
. venv/bin/activate
49-
python runtests.py --integration apps.integration_tests.integration_test_fhir_resources.IntegrationTestFhirApiResources
47+
. venv/bin/activate
48+
flake8
49+
"""
50+
}
51+
}
52+
53+
stage("RUN Django Unit Tests") {
54+
steps{
55+
sh """
56+
. venv/bin/activate
57+
python runtests.py
58+
"""
59+
}
60+
}
61+
62+
stage("RUN integration tests") {
63+
steps{
64+
sh """
65+
. venv/bin/activate
66+
python runtests.py --integration apps.integration_tests.integration_test_fhir_resources.IntegrationTestFhirApiResources
5067
"""
5168
}
5269
}

Diff for: Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ reqs-compile:
22
pip-compile --generate-hashes --output-file requirements/requirements.txt requirements/requirements.in
33
pip-compile --generate-hashes --output-file requirements/requirements.dev.txt requirements/requirements.dev.in
44

5+
# Note: requirements.dev.txt includes packages from requirements.txt also.
56
reqs-download:
6-
pip download -r requirements/requirements.txt --dest vendor --platform linux_x86_64 --no-deps
7+
pip download -r requirements/requirements.dev.txt --dest vendor --platform linux_x86_64 --no-deps
78

89
reqs-install:
910
pip install -r requirements/requirements.txt --no-index --find-links ./vendor/
1011

1112
reqs-install-dev:
12-
pip install -r requirements/requirements.dev.txt
13+
pip install -r requirements/requirements.dev.txt --no-index --find-links ./vendor/

Diff for: runtests.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
# Unset ENV variables for Django unit type tests so default values get set.
4949
for env_var in ['FHIR_URL', 'DJANGO_MEDICARE_LOGIN_URI',
5050
'DJANGO_SLS_USERINFO_ENDPOINT', 'DJANGO_SLS_TOKEN_ENDPOINT',
51-
'DJANGO_FHIR_CERTSTORE', 'DATABASES_CUSTOM', 'DJANGO_LOG_JSON_FORMAT_PRETTY']:
51+
'DJANGO_FHIR_CERTSTORE', 'DATABASES_CUSTOM', 'DJANGO_LOG_JSON_FORMAT_PRETTY',
52+
'DJANGO_USER_ID_ITERATIONS', 'DJANGO_USER_ID_SALT']:
5253
if env_var in os.environ:
5354
del os.environ[env_var]
5455

Diff for: tox.ini

-19
This file was deleted.

Diff for: vendor/PyYAML-5.4.1.tar.gz

171 KB
Binary file not shown.

Diff for: vendor/beautifulsoup4-4.9.1-py3-none-any.whl

112 KB
Binary file not shown.

Diff for: vendor/coverage-5.3.1.tar.gz

668 KB
Binary file not shown.

Diff for: vendor/django_debug_toolbar-3.2-py3-none-any.whl

196 KB
Binary file not shown.

Diff for: vendor/filelock-3.0.9-py3-none-any.whl

7.19 KB
Binary file not shown.

Diff for: vendor/flake8-3.8.4-py2.py3-none-any.whl

71.2 KB
Binary file not shown.

Diff for: vendor/httmock-1.4.0-py3-none-any.whl

4.64 KB
Binary file not shown.

Diff for: vendor/mccabe-0.6.1-py2.py3-none-any.whl

8.36 KB
Binary file not shown.

Diff for: vendor/packaging-20.8-py2.py3-none-any.whl

38.9 KB
Binary file not shown.

Diff for: vendor/pluggy-0.13.1-py2.py3-none-any.whl

17.7 KB
Binary file not shown.

Diff for: vendor/ptvsd-4.3.2-py2.py3-none-any.whl

4.69 MB
Binary file not shown.

Diff for: vendor/pycodestyle-2.6.0-py2.py3-none-any.whl

40.4 KB
Binary file not shown.

Diff for: vendor/pyflakes-2.2.0-py2.py3-none-any.whl

65.4 KB
Binary file not shown.

Diff for: vendor/pyparsing-2.4.7-py2.py3-none-any.whl

66.3 KB
Binary file not shown.

Diff for: vendor/python-openid-2.2.5.zip

350 KB
Binary file not shown.

Diff for: vendor/python_coveralls-2.9.3-py2.py3-none-any.whl

9.65 KB
Binary file not shown.

Diff for: vendor/soupsieve-2.0.1-py3-none-any.whl

31.9 KB
Binary file not shown.

Diff for: vendor/toml-0.10.0-py2.py3-none-any.whl

25.2 KB
Binary file not shown.

Diff for: vendor/tox-3.21.0-py2.py3-none-any.whl

82.5 KB
Binary file not shown.

Diff for: vendor/virtualenv-16.0.0-py2.py3-none-any.whl

1.83 MB
Binary file not shown.

0 commit comments

Comments
 (0)