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

Merge branch 'release-with-correct-version-input-default' into 'main'

Change default for `version` input to match component version

See merge request components/opentofu!266
parents 7dfe099b 9b69280a
Branches
Tags
No related merge requests found
...@@ -29,10 +29,6 @@ together with an OpenTofu version. ...@@ -29,10 +29,6 @@ together with an OpenTofu version.
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
stages: [validate, test, build, deploy, cleanup] stages: [validate, test, build, deploy, cleanup]
...@@ -43,10 +39,6 @@ stages: [validate, test, build, deploy, cleanup] ...@@ -43,10 +39,6 @@ stages: [validate, test, build, deploy, cleanup]
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
stages: [validate, build, deploy] stages: [validate, build, deploy]
...@@ -55,10 +47,6 @@ stages: [validate, build, deploy] ...@@ -55,10 +47,6 @@ stages: [validate, build, deploy]
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
trigger_in_child_pipeline: true trigger_in_child_pipeline: true
``` ```
...@@ -70,10 +58,6 @@ A concrete example may look like this: ...@@ -70,10 +58,6 @@ A concrete example may look like this:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@0.10.0 - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@0.10.0
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: 0.10.0 # component version
opentofu_version: 1.6.1 opentofu_version: 1.6.1
stages: [validate, test, build, deploy, cleanup] stages: [validate, test, build, deploy, cleanup]
...@@ -100,10 +84,6 @@ Or import all jobs as hidden templates ready to be extended: ...@@ -100,10 +84,6 @@ Or import all jobs as hidden templates ready to be extended:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
stages: [...] stages: [...]
...@@ -188,10 +168,6 @@ The following snippet will auto-encrypt your state with a passphrase coming from ...@@ -188,10 +168,6 @@ The following snippet will auto-encrypt your state with a passphrase coming from
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
auto_encryption: true auto_encryption: true
auto_encryption_passphrase: $PASSPHRASE auto_encryption_passphrase: $PASSPHRASE
...@@ -220,10 +196,6 @@ An example setup may look like this: ...@@ -220,10 +196,6 @@ An example setup may look like this:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
enable_id_tokens: true enable_id_tokens: true
...@@ -298,10 +270,6 @@ and compose your own pipeline, for example, to just run the `fmt` job you can do ...@@ -298,10 +270,6 @@ and compose your own pipeline, for example, to just run the `fmt` job you can do
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/fmt@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/fmt@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION>
opentofu_version: 1.6.1 opentofu_version: 1.6.1
root_dir: tofu/ root_dir: tofu/
``` ```
...@@ -315,10 +283,6 @@ you want to extend the jobs: ...@@ -315,10 +283,6 @@ you want to extend the jobs:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION>
opentofu_version: 1.6.1 opentofu_version: 1.6.1
plan: plan:
......
...@@ -19,10 +19,6 @@ You can use the OpenTofu CI/CD component from the CI/CD catalog using: ...@@ -19,10 +19,6 @@ You can use the OpenTofu CI/CD component from the CI/CD catalog using:
include: include:
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/full-pipeline@$CI_COMMIT_TAG - component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/full-pipeline@$CI_COMMIT_TAG
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: $CI_COMMIT_TAG # component version
opentofu_version: $LATEST_OPENTOFU_VERSION opentofu_version: $LATEST_OPENTOFU_VERSION
stages: [validate, test, build, deploy, cleanup] stages: [validate, test, build, deploy, cleanup]
......
...@@ -26,6 +26,13 @@ echo "${version}" | "${script_dir}/check-semantic-version.sh" ...@@ -26,6 +26,13 @@ echo "${version}" | "${script_dir}/check-semantic-version.sh"
echo "Starting release process for ${version} ..." echo "Starting release process for ${version} ..."
echo "Updating default value for version input to match ${version} ..."
"${script_dir}/update-self-version.sh" "${version}"
git commit templates/*.yml -m "Update version input default for ${version} release"
git push origin main
echo "Determing last stable version ..." echo "Determing last stable version ..."
last_stable_version_sha="$(git tag | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$' | sort --version-sort --reverse | head -n1 | xargs git rev-list -n1)" last_stable_version_sha="$(git tag | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$' | sort --version-sort --reverse | head -n1 | xargs git rev-list -n1)"
echo "Using commit '${last_stable_version_sha}' to start the changelog from ..." echo "Using commit '${last_stable_version_sha}' to start the changelog from ..."
......
#!/usr/bin/env sh
set -e
script_dir="$(dirname "$0")"
project_dir="$script_dir/../.."
VERSION="$1"
if [ -z "$VERSION" ]; then
echo "Error: version must be passed as first argument" >&2
exit 1
fi
echo "Updating template files ..."
templates="templates/*.yml"
templates_exclude="templates/delete-state.yml templates/module-release.yml templates/__internal_id_tokens_base_job.yml"
for relative_template_file in $templates; do
if echo "$templates_exclude" | grep -q "$relative_template_file"; then continue; fi
template_file="$project_dir/$relative_template_file"
tmp_template_file=$(mktemp)
echo "Updating $template_file ... "
yq eval-all '
select(document_index == 0).spec.inputs.version.default
= "'"$VERSION"'"
' "$template_file" > "$tmp_template_file"
diff -Bw "$template_file" "$tmp_template_file" | patch "$template_file" -
done
...@@ -31,10 +31,6 @@ together with an OpenTofu version. ...@@ -31,10 +31,6 @@ together with an OpenTofu version.
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
stages: [validate, test, build, deploy, cleanup] stages: [validate, test, build, deploy, cleanup]
...@@ -45,10 +41,6 @@ stages: [validate, test, build, deploy, cleanup] ...@@ -45,10 +41,6 @@ stages: [validate, test, build, deploy, cleanup]
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
stages: [validate, build, deploy] stages: [validate, build, deploy]
...@@ -57,10 +49,6 @@ stages: [validate, build, deploy] ...@@ -57,10 +49,6 @@ stages: [validate, build, deploy]
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
trigger_in_child_pipeline: true trigger_in_child_pipeline: true
``` ```
...@@ -72,10 +60,6 @@ A concrete example may look like this: ...@@ -72,10 +60,6 @@ A concrete example may look like this:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@0.10.0 - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@0.10.0
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: 0.10.0 # component version
opentofu_version: 1.6.1 opentofu_version: 1.6.1
stages: [validate, test, build, deploy, cleanup] stages: [validate, test, build, deploy, cleanup]
...@@ -102,10 +86,6 @@ Or import all jobs as hidden templates ready to be extended: ...@@ -102,10 +86,6 @@ Or import all jobs as hidden templates ready to be extended:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
stages: [...] stages: [...]
...@@ -190,10 +170,6 @@ The following snippet will auto-encrypt your state with a passphrase coming from ...@@ -190,10 +170,6 @@ The following snippet will auto-encrypt your state with a passphrase coming from
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
auto_encryption: true auto_encryption: true
auto_encryption_passphrase: $PASSPHRASE auto_encryption_passphrase: $PASSPHRASE
...@@ -222,10 +198,6 @@ An example setup may look like this: ...@@ -222,10 +198,6 @@ An example setup may look like this:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION> # component version
opentofu_version: <OPENTOFU_VERSION> opentofu_version: <OPENTOFU_VERSION>
enable_id_tokens: true enable_id_tokens: true
...@@ -300,10 +272,6 @@ and compose your own pipeline, for example, to just run the `fmt` job you can do ...@@ -300,10 +272,6 @@ and compose your own pipeline, for example, to just run the `fmt` job you can do
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/fmt@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/fmt@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION>
opentofu_version: 1.6.1 opentofu_version: 1.6.1
root_dir: tofu/ root_dir: tofu/
``` ```
...@@ -317,10 +285,6 @@ you want to extend the jobs: ...@@ -317,10 +285,6 @@ you want to extend the jobs:
include: include:
- component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION>
inputs: inputs:
# The version must currently be specified explicitly as an input,
# to find the correctly associated images. # This can be removed
# once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
version: <VERSION>
opentofu_version: 1.6.1 opentofu_version: 1.6.1
plan: plan:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment