Improve merge request pipelines

This commit is contained in:
Georg Krause 2022-09-08 12:09:51 +00:00
parent 9a6f3a0daf
commit 9a46a8a057
2 changed files with 17 additions and 26 deletions

View File

@ -14,17 +14,23 @@ variables:
DOCKER_TLS_CERTDIR: "" DOCKER_TLS_CERTDIR: ""
BUILD_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 BUILD_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
stages: stages:
- build - deploy
- review
- lint - lint
- test - test
- deploy - build
- deps - publish
review_front: review_front:
interruptible: true interruptible: true
stage: review stage: deploy
image: node:16-alpine image: node:16-alpine
when: manual when: manual
allow_failure: true allow_failure: true
@ -53,8 +59,6 @@ review_front:
paths: paths:
- front/node_modules - front/node_modules
- front/yarn.lock - front/yarn.lock
only:
- branches
tags: tags:
- docker - docker
environment: environment:
@ -63,7 +67,7 @@ review_front:
review_docs: review_docs:
interruptible: true interruptible: true
stage: review stage: deploy
when: manual when: manual
allow_failure: true allow_failure: true
image: python:3.10 image: python:3.10
@ -90,8 +94,6 @@ review_docs:
expire_in: 2 weeks expire_in: 2 weeks
paths: paths:
- docs-review - docs-review
only:
- branches
tags: tags:
- docker - docker
environment: environment:
@ -126,8 +128,6 @@ black:
script: script:
- black --check --diff . - black --check --diff .
only: only:
refs:
- branches
changes: changes:
- api/**/* - api/**/*
@ -146,8 +146,6 @@ flake8:
paths: paths:
- "$PIP_CACHE_DIR" - "$PIP_CACHE_DIR"
only: only:
refs:
- branches
changes: changes:
- api/**/* - api/**/*
@ -167,8 +165,6 @@ eslint:
paths: paths:
- front/node_modules - front/node_modules
only: only:
refs:
- branches
changes: changes:
- front/**/* - front/**/*
@ -189,9 +185,6 @@ test_api:
DJANGO_SETTINGS_MODULE: config.settings.local DJANGO_SETTINGS_MODULE: config.settings.local
POSTGRES_HOST_AUTH_METHOD: trust POSTGRES_HOST_AUTH_METHOD: trust
CACHE_URL: "redis://redis:6379/0" CACHE_URL: "redis://redis:6379/0"
only:
refs:
- branches
before_script: before_script:
- cd api - cd api
- poetry install --no-root - poetry install --no-root
@ -218,9 +211,6 @@ test_front:
before_script: before_script:
- cd front - cd front
- apk add --no-cache jq bash coreutils python3 - apk add --no-cache jq bash coreutils python3
only:
refs:
- branches
script: script:
- yarn install --check-files - yarn install --check-files
- yarn test:unit - yarn test:unit
@ -322,7 +312,7 @@ build_documentation:
- docker - docker
deploy_documentation: deploy_documentation:
stage: deploy stage: publish
image: alpine image: alpine
dependencies: dependencies:
- build_documentation - build_documentation
@ -340,7 +330,7 @@ deploy_documentation:
.docker_publish: .docker_publish:
stage: deploy stage: publish
image: egon0/docker-with-buildx-and-git:bash image: egon0/docker-with-buildx-and-git:bash
tags: tags:
- multiarch - multiarch
@ -407,7 +397,7 @@ docker_publish_non-release:
- COMPONENT: ["api", "front"] - COMPONENT: ["api", "front"]
docker_all_in_one_release: docker_all_in_one_release:
stage: deploy stage: publish
image: egon0/docker-with-buildx-and-git:bash image: egon0/docker-with-buildx-and-git:bash
allow_failure: true allow_failure: true
services: services:
@ -439,7 +429,7 @@ docker_all_in_one_release:
build_api: build_api:
# Simply publish a zip containing api/ directory # Simply publish a zip containing api/ directory
stage: deploy stage: publish
image: bash image: bash
artifacts: artifacts:
name: "api_${CI_COMMIT_REF_NAME}" name: "api_${CI_COMMIT_REF_NAME}"

View File

@ -0,0 +1 @@
Prevent running two pipelines for MRs