diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0f4d0934ccb2d3af06925c1764335ec56069854..f2dcd076ce3639c91952cf0012d64785623cbd1c 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,13 +14,24 @@ build-and-push-docker-image: DOCKER_TLS_VERIFY: "true" DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" HEALTHCHECK_TCP_PORT: "2376" - script: + 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: + extends: .build-config + 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 + +build-and-publish-image-sha: + extends: .build-and-publish + stage: build + variables: + TAG: "$CI_COMMIT_SHA" + rules: + - if: $CI_MERGE_REQUEST_DIFF_BASE_SHA lint: extends: .pre-commit @@ -45,4 +55,12 @@ 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-and-publish + stage: deploy + variables: + TAG: "$CI_COMMIT_TAG" + rules: + - if: $CI_COMMIT_TAG 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 diff --git a/.releaserc.yaml b/.releaserc.yaml index dfb6ad587293c19401c09ee1dc6ca2a2d0fac829..50c4dc320bfb107a2978bfb0141d624f19c47604 100644 --- a/.releaserc.yaml +++ b/.releaserc.yaml @@ -1,11 +1,10 @@ -branches: - - main - - alpha - - beta - - stable +extends: + - "@semantic-release/config-release-channels" plugins: - "@semantic-release/commit-analyzer" - "@semantic-release/release-notes-generator" - "@semantic-release/changelog" + - path: "@semantic-release/exec" + prepareCmd: "npx prettier -w CHANGELOG.md" - "@semantic-release/gitlab" diff --git a/README.md b/README.md index 1d2d3ec581e88dc65a2d9dd3ef40f03dada7906b..3656cd8ddf80d755f122880dc5e4ad94bdd5b7fb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Include the following in `.gitlab-ci.yml`: ```yaml include: - - component: gitlab.arm.com/ci/component/pre-commit@" + - component: gitlab.arm.com/ci/component/pre-commit/pre-commit@" pre-commit: extends: .pre-commit @@ -30,7 +30,7 @@ The image can be overridden with the [image][image] keyword in the `.gitlab-ci.y ```yaml include: - - component: "gitlab.arm.com/ci/component/pre-commit@" + - component: "gitlab.arm.com/ci/component/pre-commit/pre-commit@" inputs: image: registry.gitlab.arm.com/ci/component/pre-commit