diff --git a/.gitlab/README.md.template b/.gitlab/README.md.template index 5c9e3a156270960dac68b09d5fe238d7c3b644e5..4c3d68cc3b0506503e900924a17566b693edd670 100644 --- a/.gitlab/README.md.template +++ b/.gitlab/README.md.template @@ -29,10 +29,6 @@ together with an OpenTofu version. include: - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@<VERSION> 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> stages: [validate, test, build, deploy, cleanup] @@ -43,10 +39,6 @@ stages: [validate, test, build, deploy, cleanup] include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> stages: [validate, build, deploy] @@ -55,10 +47,6 @@ stages: [validate, build, deploy] include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> trigger_in_child_pipeline: true ``` @@ -70,10 +58,6 @@ A concrete example may look like this: include: - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@0.10.0 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 stages: [validate, test, build, deploy, cleanup] @@ -100,10 +84,6 @@ Or import all jobs as hidden templates ready to be extended: include: - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> 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> stages: [...] @@ -188,10 +168,6 @@ The following snippet will auto-encrypt your state with a passphrase coming from include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> auto_encryption: true auto_encryption_passphrase: $PASSPHRASE @@ -220,10 +196,6 @@ An example setup may look like this: include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> enable_id_tokens: true @@ -298,10 +270,6 @@ and compose your own pipeline, for example, to just run the `fmt` job you can do include: - component: $CI_SERVER_FQDN/components/opentofu/fmt@<VERSION> 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 root_dir: tofu/ ``` @@ -315,10 +283,6 @@ you want to extend the jobs: include: - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> 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 plan: diff --git a/.gitlab/release-notes.md.template b/.gitlab/release-notes.md.template index aa5790cc63b027fd7c288ac971e57dddc922644e..3cb628d84cce76220b907cc78ee497699e1474bb 100644 --- a/.gitlab/release-notes.md.template +++ b/.gitlab/release-notes.md.template @@ -19,10 +19,6 @@ You can use the OpenTofu CI/CD component from the CI/CD catalog using: include: - component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/full-pipeline@$CI_COMMIT_TAG 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 stages: [validate, test, build, deploy, cleanup] diff --git a/.gitlab/scripts/release.sh b/.gitlab/scripts/release.sh index d6ed49bec1aceb0a6418e9dd7341d73a10cd93ae..d4ec83b17482749e03187487462d07f3d6283b06 100755 --- a/.gitlab/scripts/release.sh +++ b/.gitlab/scripts/release.sh @@ -26,6 +26,13 @@ echo "${version}" | "${script_dir}/check-semantic-version.sh" 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 ..." 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 ..." diff --git a/.gitlab/scripts/update-self-versions.sh b/.gitlab/scripts/update-self-versions.sh new file mode 100755 index 0000000000000000000000000000000000000000..595b4469f7d39b133d440c7961609eca28da535d --- /dev/null +++ b/.gitlab/scripts/update-self-versions.sh @@ -0,0 +1,29 @@ +#!/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 diff --git a/README.md b/README.md index 4f490c5065775ebde64263861b3436519a502f43..c5d7dba2cb27e3e0f865023d1e6f97e50c9f54c8 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,6 @@ together with an OpenTofu version. include: - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@<VERSION> 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> stages: [validate, test, build, deploy, cleanup] @@ -45,10 +41,6 @@ stages: [validate, test, build, deploy, cleanup] include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> stages: [validate, build, deploy] @@ -57,10 +49,6 @@ stages: [validate, build, deploy] include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> trigger_in_child_pipeline: true ``` @@ -72,10 +60,6 @@ A concrete example may look like this: include: - component: $CI_SERVER_FQDN/components/opentofu/full-pipeline@0.10.0 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 stages: [validate, test, build, deploy, cleanup] @@ -102,10 +86,6 @@ Or import all jobs as hidden templates ready to be extended: include: - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> 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> stages: [...] @@ -190,10 +170,6 @@ The following snippet will auto-encrypt your state with a passphrase coming from include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> auto_encryption: true auto_encryption_passphrase: $PASSPHRASE @@ -222,10 +198,6 @@ An example setup may look like this: include: - component: $CI_SERVER_FQDN/components/opentofu/validate-plan-apply@<VERSION> 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> enable_id_tokens: true @@ -300,10 +272,6 @@ and compose your own pipeline, for example, to just run the `fmt` job you can do include: - component: $CI_SERVER_FQDN/components/opentofu/fmt@<VERSION> 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 root_dir: tofu/ ``` @@ -317,10 +285,6 @@ you want to extend the jobs: include: - component: $CI_SERVER_FQDN/components/opentofu/job-templates@<VERSION> 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 plan: