Skip to content
Snippets Groups Projects

L2SS-752: Seperate jobs for merge and master in CI/CD

Closed L2SS-752: Seperate jobs for merge and master in CI/CD
Closed Corné Lukken requested to merge L2SS-752 into master
1 file
+ 117
16
Compare changes
  • Side-by-side
  • Inline
+ 117
16
@@ -557,15 +557,24 @@ docker_build_image_hdbppts_es:
@@ -557,15 +557,24 @@ docker_build_image_hdbppts_es:
script:
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh hdbppts-es $tag
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh hdbppts-es $tag
newline_at_eof:
.newline_at_eof:
stage: linting
stage: linting
before_script:
before_script:
- pip3 install -r tangostationcontrol/test-requirements.txt
- pip3 install -r tangostationcontrol/test-requirements.txt
script:
script:
# TODO(Corne): Ignore shell files in submodules more cleanly
# TODO(Corne): Ignore shell files in submodules more cleanly
- flake8 --filename *.sh,*.conf,*.md,*.yml --select=W292 --exclude docker-compose/tango-prometheus-exporter,.tox,.egg-info,docker
- flake8 --filename *.sh,*.conf,*.md,*.yml --select=W292 --exclude docker-compose/tango-prometheus-exporter,.tox,.egg-info,docker
 
newline_at_eof_merge:
 
extends: .newline_at_eof
 
only:
 
refs:
 
- merge_requests
 
newline_at_eof_master:
 
extends: .newline_at_eof
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
run_black:
.run_black:
stage: linting
stage: linting
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
@@ -576,38 +585,95 @@ run_black:
@@ -576,38 +585,95 @@ run_black:
when: always
when: always
paths:
paths:
- tangostationcontrol/black.patch
- tangostationcontrol/black.patch
 
run_black_merge:
 
extends: .run_black
 
only:
 
refs:
 
- merge_requests
 
run_black_master:
 
extends: .run_black
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
run_flake8:
.run_flake8:
stage: linting
stage: linting
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
- tox -e pep8
- tox -e pep8
 
run_flake8_merge:
 
extends: .run_flake8
 
only:
 
refs:
 
- merge_requests
 
run_flake8_master:
 
extends: .run_flake8
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
run_pylint:
.run_pylint:
stage: linting
stage: linting
allow_failure: true
allow_failure: true
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
- tox -e pylint
- tox -e pylint
 
run_pylint_merge:
 
extends: .run_pylint
 
only:
 
refs:
 
- merge_requests
 
run_pylint_master:
 
extends: .run_pylint
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
bandit:
.bandit:
stage: static-analysis
stage: static-analysis
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
- tox -e bandit
- tox -e bandit
xenon:
bandit_merge:
 
extends: .bandit
 
only:
 
refs:
 
- merge_requests
 
bandit_master:
 
extends: .bandit
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
 
 
.xenon:
stage: static-analysis
stage: static-analysis
allow_failure: true
allow_failure: true
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
- tox -e xenon
- tox -e xenon
shellcheck:
xenon_merge:
 
extends: .xenon
 
only:
 
refs:
 
- merge_requests
 
xenon_master:
 
extends: .xenon
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
 
 
.shellcheck:
stage: static-analysis
stage: static-analysis
script:
script:
# TODO(Corne): L2SS-962: Ignore shell files in submodules
# TODO(Corne): L2SS-962: Ignore shell files in submodules
- shellcheck --version
- shellcheck --version
- shellcheck **/*.sh
- shellcheck **/*.sh
sphinx-documentation:
shellcheck_merge:
 
extends: .shellcheck
 
only:
 
refs:
 
- merge_requests
 
shellcheck_master:
 
extends: .shellcheck
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
 
 
.sphinx_documentation:
stage: documentation
stage: documentation
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
@@ -615,7 +681,17 @@ sphinx-documentation:
@@ -615,7 +681,17 @@ sphinx-documentation:
artifacts:
artifacts:
paths:
paths:
- tangostationcontrol/docs/build/
- tangostationcontrol/docs/build/
unit_test:
sphinx_documentation_merge:
 
extends: .sphinx_documentation
 
only:
 
refs:
 
- merge_requests
 
sphinx_documentation_master:
 
extends: .sphinx_documentation
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
 
 
.unit_test:
stage: unit-tests
stage: unit-tests
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
@@ -629,7 +705,17 @@ unit_test:
@@ -629,7 +705,17 @@ unit_test:
paths:
paths:
- tangostationcontrol/cover/*
- tangostationcontrol/cover/*
- tangostationcontrol/.coverage
- tangostationcontrol/.coverage
integration_test_docker:
unit_test_merge:
 
extends: .unit_test
 
only:
 
refs:
 
- merge_requests
 
unit_test_master:
 
extends: .unit_test
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
 
 
.integration_test_docker:
stage: integration-tests
stage: integration-tests
image: docker:latest
image: docker:latest
tags:
tags:
@@ -638,12 +724,6 @@ integration_test_docker:
@@ -638,12 +724,6 @@ integration_test_docker:
- name: docker:dind
- name: docker:dind
variables:
variables:
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_CERTDIR: "/certs"
needs:
- unit_test
artifacts:
when: always
paths:
- log/
before_script:
before_script:
- |
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" && -z "$CI_COMMIT_TAG" ]]; then
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" && -z "$CI_COMMIT_TAG" ]]; then
@@ -682,14 +762,35 @@ integration_test_docker:
@@ -682,14 +762,35 @@ integration_test_docker:
docker logs "${container}" >& "log/${container}.log"
docker logs "${container}" >& "log/${container}.log"
done
done
PGPASSWORD=password pg_dump --host=docker --username=postgres hdb 2>log/archiver-timescale-dump.log | gzip > log/archiver-timescale-dump.txt.gz
PGPASSWORD=password pg_dump --host=docker --username=postgres hdb 2>log/archiver-timescale-dump.log | gzip > log/archiver-timescale-dump.txt.gz
 
artifacts:
 
when: always
 
paths:
 
- log/
 
integration_test_docker_merge:
 
extends: .integration_test_docker
 
needs:
 
- unit_test_merge
 
only:
 
refs:
 
- merge_requests
 
integration_test_docker_master:
 
extends: .integration_test_docker
 
needs:
 
- unit_test_master
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
 
wheel_packaging:
wheel_packaging:
stage: packaging
stage: packaging
 
rules:
 
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
artifacts:
artifacts:
paths:
paths:
- tangostationcontrol/dist/*.whl
- tangostationcontrol/dist/*.whl
script:
script:
- cd tangostationcontrol
- cd tangostationcontrol
- tox -e build
- tox -e build
 
.base_deploy:
.base_deploy:
stage: deploy
stage: deploy
image: ubuntu:bionic
image: ubuntu:bionic
Loading