diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f04ddf50b0dc96d9a73942114f9c85f0585e9809..cfac0d49534527925eb81647a925fde37cc1824c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,10 +13,11 @@ run-tox-pipeline: tags: - docker-executor image: python:3.12 - + rules: + - if: $CI_COMMIT_BRANCH =~ /^release\/*/ + when: never # Don't run on release branches since these are short-lived and result in errors services: - postgres:14 - # Change pip's cache directory to be inside the project directory since we can # only cache local items. variables: @@ -25,22 +26,18 @@ run-tox-pipeline: POSTGRES_PASSWORD: nwa DATABASE_HOST: "postgres" PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - cache: key: tox-virtualenv paths: - .cache/pip - venv/ - before_script: - pip install virtualenv - virtualenv venv - . venv/bin/activate - pip install tox - script: - tox - artifacts: paths: - htmlcov @@ -51,12 +48,10 @@ build-documentation: tags: - docker-executor image: python:3.12 - before_script: - cd $CI_PROJECT_DIR/docs script: - /bin/sh ./build-docs.sh - artifacts: paths: - docs/public @@ -67,17 +62,14 @@ lint-documentation: image: name: jdkato/vale:latest entrypoint: [""] - tags: - docker-executor needs: - job: build-documentation # Only run when documentation has been built artifacts: true - before_script: - cd $CI_PROJECT_DIR/docs/vale - vale sync - script: - vale --glob='!*/migrations/*' $CI_PROJECT_DIR/docs/source $CI_PROJECT_DIR/gso/ @@ -87,8 +79,8 @@ publish-docs-prod-1: # First deploy to prod-1 tags: - gap-docs-prod-1 - only: - - master # Only publish when on the main branch + rules: + - if: $CI_COMMIT_BRANCH == "master" # Only publish when on the main branch needs: - job: build-documentation artifacts: true @@ -101,8 +93,8 @@ publish-docs-prod-2: # When successful, also deploy to prod-2 tags: - gap-docs-prod-2 - only: - - master # Only publish when on the main branch + rules: + - if: $CI_COMMIT_BRANCH == "master" # Only publish when on the main branch needs: - job: build-documentation artifacts: true @@ -117,6 +109,8 @@ sonarqube: - sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dproject.settings=./sonar.properties tags: - docker-executor + needs: + - job: tox trigger_jenkins_build: stage: trigger_jenkins_build @@ -126,7 +120,7 @@ trigger_jenkins_build: script: curl -u "$JENKINS_USERNAME:$JENKINS_API_TOKEN" --data "PROJECT=geant-service-orchestrator" "http://test-swd-release-service01.geant.org:8080/job/build-python-snapshot/buildWithParameters" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == "develop" tags: - docker-executor