diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0f4d0934ccb2d3af06925c1764335ec56069854..3fbbb54d21dd835e4382bd6918ee2045b5c23515 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,8 +3,7 @@ include: inputs: tag: $CI_COMMIT_SHA -build-and-push-docker-image: - stage: .pre +.build-config: image: docker:24.0.2 services: - name: docker:24.0.2-dind @@ -15,16 +14,25 @@ build-and-push-docker-image: DOCKER_TLS_VERIFY: "true" DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" HEALTHCHECK_TCP_PORT: "2376" - script: + TAG: "$CI_COMMIT_SHA" + before_script: - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin - - echo "CI_REGISTRY_IMAGE - $CI_REGISTRY_IMAGE" - - echo "CI_COMMIT_SHA - $CI_COMMIT_SHA" - - echo "Building and pushing image." - - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -f templates/Dockerfile . - - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA + +build-and-publish-image-sha: + stage: .pre + extends: .build-config + variables: + TAG: "$CI_COMMIT_SHA" + script: + - echo "Building Docker image..." + - docker build -t $CI_REGISTRY_IMAGE:$TAG -f templates/Dockerfile . + - echo "Pushing Image $CI_REGISTRY_IMAGE:$TAG" + - docker push $CI_REGISTRY_IMAGE:$TAG lint: extends: .pre-commit + needs: + - build-and-publish-image-sha semantic-release: stage: deploy @@ -45,4 +53,26 @@ semantic-release: rules: - if: $CI_COMMIT_TAG when: never - - if: $CI_COMMIT_REF_PROTECTED == "true" \ No newline at end of file + - if: $CI_COMMIT_REF_PROTECTED == "true" + +build-and-publish-image-version: + extends: .build-config + stage: deploy + variables: + TAG: "$CI_COMMIT_TAG" + script: + - echo "Pushing Image $CI_REGISTRY_IMAGE:$TAG" + - docker push $CI_REGISTRY_IMAGE:$TAG + rules: + - if: $CI_COMMIT_TAG + +build-and-publish-image-latest: + extends: .build-config + stage: deploy + variables: + TAG: "latest" + script: + - echo "Pushing Image $CI_REGISTRY_IMAGE:$TAG" + - docker push $CI_REGISTRY_IMAGE:$TAG + rules: + - if: $CI_COMMIT_BRANCH == "stable" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c810714a928a5739189988182e42020c2edcc49..79eb6e425832f8b4d3be17a744efe57c0a4dd32e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ default_install_hook_types: - pre-commit repos: - repo: https://gitlab.gpu.arm.com/pre-commit/hooks - rev: v2.9.1 + rev: v2.10.0 hooks: - id: check-added-large-files - id: check-filename-case-conflict