Loading .gitlab-ci.yml +7 −39 Original line number Diff line number Diff line stages: - test - createtag - releasetag - buildimage variables: Loading @@ -19,20 +18,6 @@ variables: # https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-the-overlayfs-driver DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "" TAGGER_OUTPUT: "false" .disable-for-tagger: rules: - if: $TAGGER_OUTPUT == "false" when: on_success - when: never .enable-for-tagger: rules: - if: $TAGGER_OUTPUT == "false" when: never - if: $CI_COMMIT_BRANCH == "main" && $CI_COMMIT_TAG when: on_success default: tags: Loading @@ -47,22 +32,16 @@ unit_tests: - poetry run black --check . - poetry run mypy . - poetry run python manage.py test extends: - .disable-for-tagger sast: variables: SAST_EXCLUDED_PATHS: tests, dev, definitions, docs allow_failure: true extends: - .disable-for-tagger dependency_scanning: variables: DS_EXCLUDED_PATHS: tests, dev, definitions, docs allow_failure: true extends: - .disable-for-tagger secret_detection: allow_failure: false Loading @@ -71,6 +50,9 @@ create-tag: image: python:3.8-buster stage: createtag variables: # this is the current default in the project # specified to prevent the pipeline from failing due to a seemingly unrelated change GIT_STRATEGY: fetch VERSION_TYPE: minor rules: - if: $CI_COMMIT_BRANCH == "main" Loading @@ -79,8 +61,6 @@ create-tag: - git config user.email "$GITLAB_USER_EMAIL" - git config user.name "$GITLAB_USER_NAME" script: # this syncs tags with remote, in case we delete tags or move them to a different commit - git fetch --prune-tags --force - old_version=$(sed -n "s/^VERSION = \"\(.*\)\"/\1/p" ttxbackend/settings.py) - new_version=$(python tagging.py "$old_version" "$VERSION_TYPE") - > Loading @@ -91,21 +71,11 @@ create-tag: - git add ttxbackend/settings.py - git commit -m "update version and create new tag" - git tag -f "$new_version" -m "backend version $new_version" - git push --tags https://tagger:$TAGGER_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH HEAD:$CI_COMMIT_REF_NAME -o ci.variable="TAGGER_OUTPUT=true" extends: - .disable-for-tagger # push the new commit - git push https://tagger:$TAGGER_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH HEAD:$CI_COMMIT_REF_NAME -o ci.skip # push the newly created tag, must be separated because the CI repo contains old deleted tags - git push https://tagger:$TAGGER_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH refs/tags/$new_version -o ci.skip release_job: stage: releasetag image: registry.gitlab.com/gitlab-org/release-cli:latest script: - echo "running release_job" release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties tag_name: '$CI_COMMIT_TAG' description: 'Version ${CI_COMMIT_TAG}, for more info please check the changelog in the documentation.' rules: - if: $CI_COMMIT_TAG when: manual create-image: image: docker:20.10.16 Loading @@ -130,8 +100,6 @@ create-image: - docker build --cache-from $IMAGE_LATEST -t $IMAGE_TAG -t $IMAGE_LATEST ${CI_PROJECT_DIR} - docker push $IMAGE_TAG - docker push $IMAGE_LATEST extends: - .disable-for-tagger include: - template: Security/SAST.gitlab-ci.yml Loading Loading
.gitlab-ci.yml +7 −39 Original line number Diff line number Diff line stages: - test - createtag - releasetag - buildimage variables: Loading @@ -19,20 +18,6 @@ variables: # https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-the-overlayfs-driver DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "" TAGGER_OUTPUT: "false" .disable-for-tagger: rules: - if: $TAGGER_OUTPUT == "false" when: on_success - when: never .enable-for-tagger: rules: - if: $TAGGER_OUTPUT == "false" when: never - if: $CI_COMMIT_BRANCH == "main" && $CI_COMMIT_TAG when: on_success default: tags: Loading @@ -47,22 +32,16 @@ unit_tests: - poetry run black --check . - poetry run mypy . - poetry run python manage.py test extends: - .disable-for-tagger sast: variables: SAST_EXCLUDED_PATHS: tests, dev, definitions, docs allow_failure: true extends: - .disable-for-tagger dependency_scanning: variables: DS_EXCLUDED_PATHS: tests, dev, definitions, docs allow_failure: true extends: - .disable-for-tagger secret_detection: allow_failure: false Loading @@ -71,6 +50,9 @@ create-tag: image: python:3.8-buster stage: createtag variables: # this is the current default in the project # specified to prevent the pipeline from failing due to a seemingly unrelated change GIT_STRATEGY: fetch VERSION_TYPE: minor rules: - if: $CI_COMMIT_BRANCH == "main" Loading @@ -79,8 +61,6 @@ create-tag: - git config user.email "$GITLAB_USER_EMAIL" - git config user.name "$GITLAB_USER_NAME" script: # this syncs tags with remote, in case we delete tags or move them to a different commit - git fetch --prune-tags --force - old_version=$(sed -n "s/^VERSION = \"\(.*\)\"/\1/p" ttxbackend/settings.py) - new_version=$(python tagging.py "$old_version" "$VERSION_TYPE") - > Loading @@ -91,21 +71,11 @@ create-tag: - git add ttxbackend/settings.py - git commit -m "update version and create new tag" - git tag -f "$new_version" -m "backend version $new_version" - git push --tags https://tagger:$TAGGER_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH HEAD:$CI_COMMIT_REF_NAME -o ci.variable="TAGGER_OUTPUT=true" extends: - .disable-for-tagger # push the new commit - git push https://tagger:$TAGGER_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH HEAD:$CI_COMMIT_REF_NAME -o ci.skip # push the newly created tag, must be separated because the CI repo contains old deleted tags - git push https://tagger:$TAGGER_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH refs/tags/$new_version -o ci.skip release_job: stage: releasetag image: registry.gitlab.com/gitlab-org/release-cli:latest script: - echo "running release_job" release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties tag_name: '$CI_COMMIT_TAG' description: 'Version ${CI_COMMIT_TAG}, for more info please check the changelog in the documentation.' rules: - if: $CI_COMMIT_TAG when: manual create-image: image: docker:20.10.16 Loading @@ -130,8 +100,6 @@ create-image: - docker build --cache-from $IMAGE_LATEST -t $IMAGE_TAG -t $IMAGE_LATEST ${CI_PROJECT_DIR} - docker push $IMAGE_TAG - docker push $IMAGE_LATEST extends: - .disable-for-tagger include: - template: Security/SAST.gitlab-ci.yml Loading