Newer
Older
spec:
inputs:
# Job and Stage name
as:
default: 'fmt'
description: 'Defines the name of this job.'
stage:
default: 'validate'
description: 'Defines the stage that this job will belong to.'
# Versions
# This version is only required, because we cannot access the context of the component,
# see https://gitlab.com/gitlab-org/gitlab/-/issues/438275
version:
default: 'latest'
description: 'Version of this component. Has to be the same as the one in the component include entry.'
base_os:
default: 'alpine'
options:
- 'alpine'
- 'debian'
- '$GITLAB_OPENTOFU_BASE_IMAGE_OS'
description: 'Base OS of GitLab OpenTofu image.'
default: '1.8.4'
- '1.8.4'
- '1.8.3'
- '1.8.2'
- '1.8.1'
- '1.8.0'
- '1.7.3'
- '1.7.2'
description: 'OpenTofu version that should be used.'
# Images
image_registry_base:
Thomas de Grenier de Latour
committed
default: '$CI_TEMPLATE_REGISTRY_HOST/components/opentofu'
description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
# 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
Thomas de Grenier de Latour
committed
# # default: '$CI_TEMPLATE_REGISTRY_HOST/components/opentofu/gitlab-opentofu:$[[ inputs.opentofu_version ]]'
# default: '$CI_TEMPLATE_REGISTRY_HOST/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
image_name:
default: 'gitlab-opentofu'
description: 'Image name for the job images. Hosted under `image_registry_base`.'
# FIXME: we cannot use regex yet because of a bug that rejects
# empty strings from ever being checked against the regex.
# see https://gitlab.com/gitlab-org/gitlab/-/issues/477707
# regex: '^(@sha256:[a-z0-9]{64})?$'
description: 'Image digest of the image you want to use. The format must be `@<image_digest>`, e.g. `@sha256:abc..`, see regex of this input. Please consult the release page at https://gitlab.com/components/opentofu/-/releases to obtain the image digests.'
default: ${CI_PROJECT_DIR}
description: 'Root directory for the OpenTofu project.'
allow_failure:
default: true
type: boolean
description: 'If the job is allowed to fail or not.'
needs:
# FIXME: eventually, we'll want to define `null` as the default,
# but this is NOT support yet, see
# https://gitlab.com/gitlab-org/gitlab/-/issues/440468
default: []
type: array
description: 'Defines the `needs` of the job.'
rules:
# FIXME: eventually, we'll want to define `null` as the default,
# but this is NOT support yet, see
# https://gitlab.com/gitlab-org/gitlab/-/issues/440468
type: array
description: 'Defines the `rules` of the job.'
cache_policy:
default: pull-push
type: string
description: 'Defines the cache policy of the job.'
---
'$[[ inputs.as ]]':
stage: $[[ inputs.stage ]]
needs: $[[ inputs.needs ]]
rules: $[[ inputs.rules ]]
allow_failure: $[[ inputs.allow_failure ]]
policy: $[[ inputs.cache_policy ]]
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'