diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 03f981279fcdaebce97069e40077983945f63d50..6ff19245af9252aaa90ddfbe4236465b703c5754 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -92,7 +92,7 @@ container_scanning: CS_IMAGE: $GITLAB_OPENTOFU_IMAGE_NAME CS_SCHEMA_MODEL: 15 -gitlab-opentofu-image:deploy: +gitlab-opentofu-image:deploy:with-opentofu-version: extends: .opentofu-versions stage: deploy image: @@ -112,7 +112,23 @@ gitlab-opentofu-image:deploy: rules: - if: $CI_COMMIT_TAG -gitlab-opentofu-image:latest:deploy: +gitlab-opentofu-image:deploy:latest-with-opentofu-version: + extends: .opentofu-versions + stage: deploy + image: + name: gcr.io/go-containerregistry/crane:debug + entrypoint: [""] + variables: + RELEASE_IMAGE_NAME: "$CI_REGISTRY_IMAGE/gitlab-opentofu" + RELEASE_SEMVER: "latest-opentofu${OPENTOFU_VERSION}" + before_script: + - crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" + script: + - crane copy "$GITLAB_OPENTOFU_IMAGE_NAME" "$RELEASE_IMAGE_NAME:$RELEASE_SEMVER" + rules: + - if: $CI_COMMIT_TAG + +gitlab-opentofu-image:deploy:latest: stage: deploy image: name: gcr.io/go-containerregistry/crane:debug @@ -129,8 +145,8 @@ gitlab-opentofu-image:latest:deploy: parallel: matrix: - RELEASE_IMAGE_TAG: ${CI_COMMIT_TAG} - - RELEASE_IMAGE_TAG: ${CI_COMMIT_TAG}-opentofu - RELEASE_IMAGE_TAG: ${CI_COMMIT_TAG}-opentofulatest + - RELEASE_IMAGE_TAG: latest-opentofulatest - RELEASE_IMAGE_TAG: latest # If the pipeline is for a new tag with a semantic version, and all previous jobs succeed,