Skip to content
Snippets Groups Projects
Unverified Commit 85d09af4 authored by Timo Furrer's avatar Timo Furrer
Browse files

Avoid nested inputs

parent 941e5ea4
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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/'
......
......@@ -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. |
......
......@@ -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"
......
......@@ -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 ]]"
......
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
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment