diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e3397b84471a3c43caf6b334c7909479fbbe0ad9..6de90a544de87bcce757fd896a627e759a04c88b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,8 @@ variables: # OpenTofu image build variables: PLATFORMS: linux/amd64,linux/arm64 BASE_IMAGE: "alpine:3.19.0" - GITLAB_OPENTOFU_IMAGE_NAME: "$CI_REGISTRY_IMAGE/internal/gitlab-opentofu-$OPENTOFU_VERSION:$CI_COMMIT_SHA" + GITLAB_OPENTOFU_IMAGE_BASE: "$CI_REGISTRY_IMAGE/internal" + GITLAB_OPENTOFU_IMAGE_NAME: "$GITLAB_OPENTOFU_IMAGE_BASE/gitlab-opentofu:$CI_COMMIT_SHA-opentofu$OPENTOFU_VERSION" gitlab-opentofu-image:build: extends: .opentofu-versions diff --git a/Makefile b/Makefile index ac8327ac1742903f8011c7d1851e1b22233703ee..bd7973ee2693866ec280f7acc8d222624b7dc711 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,9 @@ backports: @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.stage_build \]\]/build/' @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.stage_deploy \]\]/deploy/' @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.stage_cleanup \]\]/cleanup/' - @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.gitlab_opentofu_image \]\]/$$GITLAB_OPENTOFU_IMAGE/' + @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs._image_registry_base \]\]/$$GITLAB_OPENTOFU_IMAGE_REGISTRY_BASE/' + @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.version \]\]/$$GITLAB_OPENTOFU_VERSION/' + @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.opentofu_version \]\]/$$OPENTOFU_VERSION/' @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.root_dir \]\]/$$TF_ROOT/' @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.state_name \]\]/$$TF_STATE_NAME/' @sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.auto_apply \]\]/$$TF_AUTO_APPLY/' diff --git a/README.md b/README.md index 260767cea9cde8b0edf636a7f026cda859a95973..a58044bba752bb24ebfe66eb023988fba978ac4e 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,6 @@ stages: [validate, test, build, deploy, cleanup] | `stage_cleanup` | `cleanup` | Defines the cleanup stage. This stage includes the `destroy` and `delete-state` jobs. | | `version` | `latest` | Version of this component. Has to be the same as the one in the component include entry. | | `opentofu_version` | `1.6.0` | OpenTofu version that should be used. Must be one of `1.6.0`, `1.6.0-rc1`. | -| `gitlab_opentofu_image` | `$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]` | Tag of the gitlab-opentofu image. | | `root_dir` | `${CI_PROJECT_DIR}` | Root directory for the OpenTofu project. | | `state_name` | `default` | Remote OpenTofu state name. | | `auto_apply` | `false` | Whether the apply job is manual or automatically run. | diff --git a/backports/OpenTofu/Base.gitlab-ci.yml b/backports/OpenTofu/Base.gitlab-ci.yml index 081da91b22891de49b0ffe325f8d8a22b0a033a3..1989cd9f6a55b0d7ca79af4bc66b5d10c8dc5569 100644 --- a/backports/OpenTofu/Base.gitlab-ci.yml +++ b/backports/OpenTofu/Base.gitlab-ci.yml @@ -26,7 +26,7 @@ variables: .opentofu:default: image: - name: $GITLAB_OPENTOFU_IMAGE + name: '$GITLAB_OPENTOFU_IMAGE_REGISTRY_BASE/gitlab-opentofu:$GITLAB_OPENTOFU_VERSION-opentofu$OPENTOFU_VERSION' cache: key: "$TF_ROOT" diff --git a/templates/full-pipeline.yml b/templates/full-pipeline.yml index d243a261247c16ad1d90eb5a17f03ea371f6cf21..fe22c0501dce3824652ec76b58976138cc166645 100644 --- a/templates/full-pipeline.yml +++ b/templates/full-pipeline.yml @@ -29,12 +29,15 @@ spec: description: 'OpenTofu version that should be used.' # Images - gitlab_opentofu_image: - # FIXME: This should reference the component tag that is used. - # Currently, blocked by https://gitlab.com/gitlab-org/gitlab/-/issues/438275 - # default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.opentofu_version ]]' - default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]' - description: 'Tag of the gitlab-opentofu image.' + _image_registry_base: + default: '$CI_REGISTRY/components/opentofu' + # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722 + # gitlab_opentofu_image: + # # FIXME: This should reference the component tag that is used. + # # Currently, blocked by https://gitlab.com/gitlab-org/gitlab/-/issues/438275 + # # default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.opentofu_version ]]' + # default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]' + # description: 'Tag of the gitlab-opentofu image.' # Configuration root_dir: @@ -60,7 +63,7 @@ spec: .default: image: - name: $[[ inputs.gitlab_opentofu_image ]] + name: '$[[ inputs._image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]' cache: key: "$[[ inputs.root_dir ]]" diff --git a/tests/integration-tests/Defaults.gitlab-ci.yml b/tests/integration-tests/Defaults.gitlab-ci.yml index 484b3132d7fbb23e1790a889ce28d3f2bdd51968..92da5eb131f925b5a5e420ed61c691c87aa12457 100644 --- a/tests/integration-tests/Defaults.gitlab-ci.yml +++ b/tests/integration-tests/Defaults.gitlab-ci.yml @@ -1,7 +1,9 @@ include: - component: gitlab.com/$CI_PROJECT_PATH/full-pipeline@$CI_COMMIT_SHA inputs: - gitlab_opentofu_image: $GITLAB_OPENTOFU_IMAGE_NAME + _image_registry_base: $GITLAB_OPENTOFU_IMAGE_BASE + version: $CI_COMMIT_SHA + opentofu_version: $OPENTOFU_VERSION root_dir: $TF_ROOT state_name: $TF_STATE_NAME diff --git a/tests/integration.gitlab-ci.yml b/tests/integration.gitlab-ci.yml index 1f8713972edf500ef7c7153284d681305d001fde..3f10624228529b7018622cc8fc57f5cd8f4000c6 100644 --- a/tests/integration.gitlab-ci.yml +++ b/tests/integration.gitlab-ci.yml @@ -17,8 +17,9 @@ component: backport-templates: stage: test-integration variables: + GITLAB_OPENTOFU_IMAGE_REGISTRY_BASE: $GITLAB_OPENTOFU_IMAGE_BASE + GITLAB_OPENTOFU_VERSION: $CI_COMMIT_SHA OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION - GITLAB_OPENTOFU_IMAGE: $GITLAB_OPENTOFU_IMAGE_NAME TF_STATE_NAME: ci-integration-backports-$CI_PIPELINE_IID-$CI_NODE_INDEX TF_ROOT: tests/terraform trigger: