Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Opentofu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Components
Opentofu
Commits
ab387c7d
Unverified
Commit
ab387c7d
authored
Jun 10, 2024
by
Timo Furrer
Browse files
Options
Downloads
Patches
Plain Diff
Get version from SSoT
parent
5f274c72
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+13
-7
13 additions, 7 deletions
.gitlab-ci.yml
.gitlab/scripts/update-opentofu-versions.sh
+13
-0
13 additions, 0 deletions
.gitlab/scripts/update-opentofu-versions.sh
Makefile
+1
-1
1 addition, 1 deletion
Makefile
opentofu_versions.yaml
+12
-0
12 additions, 0 deletions
opentofu_versions.yaml
with
39 additions
and
8 deletions
.gitlab-ci.yml
+
13
−
7
View file @
ab387c7d
...
...
@@ -6,6 +6,7 @@ workflow:
-
if
:
$CI_COMMIT_REF_PROTECTED == "true"
include
:
-
local
:
opentofu_versions.yaml
-
local
:
tests/unit.gitlab-ci.yml
rules
:
-
if
:
$SKIP_TESTS == "true"
...
...
@@ -55,19 +56,14 @@ stages:
.opentofu-versions
:
parallel
:
matrix
:
-
OPENTOFU_VERSION
:
'
1.7.1'
-
OPENTOFU_VERSION
:
'
1.7.0'
-
OPENTOFU_VERSION
:
'
1.7.0-alpha1'
-
OPENTOFU_VERSION
:
'
1.6.2'
-
OPENTOFU_VERSION
:
'
1.6.1'
-
OPENTOFU_VERSION
:
'
1.6.0'
-
OPENTOFU_VERSION
:
!reference
[
.data
,
supported_versions
]
variables
:
# Pipeline configuration
DOCKER_DIND_IMAGE
:
"
docker:26.1.4-dind"
# OpenTofu variables
LATEST_OPENTOFU_VERSION
:
'
1.7.1'
LATEST_OPENTOFU_VERSION
:
!reference
[
.data
,
latest_version
]
# OpenTofu image build variables:
PLATFORMS
:
linux/amd64,linux/arm64
...
...
@@ -122,6 +118,16 @@ gitlab-opentofu-image:build:
-
templates/**/*
-
tests/**/*
check-versions
:
stage
:
test
needs
:
[]
image
:
alpine:latest
before_script
:
-
apk add coreutils yq patch git
script
:
-
./.gitlab/scripts/update-opentofu-versions.sh
-
git diff --exit-code
check-readme
:
stage
:
test
needs
:
[]
...
...
This diff is collapsed.
Click to expand it.
.gitlab/scripts/update-opentofu-versions.sh
0 → 100755
+
13
−
0
View file @
ab387c7d
#!/usr/bin/env sh
echo
"Updating template files ..."
templates
=
"templates/apply.yml templates/custom-command.yml templates/destroy.yml templates/fmt.yml templates/full-pipeline.yml templates/job-templates.yml templates/plan.yml templates/test.yml templates/validate-plan-apply.yml templates/validate-plan-destroy.yml templates/validate-plan.yml templates/validate.yml"
for
template_file
in
$templates
;
do
tmp_template_file1
=
$(
mktemp
)
tmp_template_file2
=
$(
mktemp
)
echo
"Updating
$template_file
... "
yq eval-all
'select(fileIndex == 0 and document_index == 0).spec.inputs.opentofu_version.default = select(fileIndex == 1).".data".latest_version | select(fileIndex == 0)'
"
$template_file
"
opentofu_versions.yaml
>
"
$tmp_template_file1
"
yq eval-all
'select(fileIndex == 0 and document_index == 0).spec.inputs.opentofu_version.options = (select(fileIndex == 1).".data".hack_templates_supported_versions | explode(.) | flatten) | select(fileIndex == 0)'
"
$tmp_template_file1
"
opentofu_versions.yaml
>
"
$tmp_template_file2
"
diff
-Bw
"
$template_file
"
"
$tmp_template_file2
"
| patch
"
$template_file
"
-
done
This diff is collapsed.
Click to expand it.
Makefile
+
1
−
1
View file @
ab387c7d
...
...
@@ -12,7 +12,7 @@ docs:
echo
>>
README.md
echo
'The following OpenTofu versions are available with this component via the `opentofu_version` input:'
>>
README.md
echo
>>
README.md
yq
-r
'.
spec.inputs.opentofu_version.options | filter((. | test("\$$.*")) == false)
| .[] | "- [`" + . + "`](https://github.com/opentofu/opentofu/releases/tag/v" + . + ")"'
templates/full-pipeline
.yml
>>
README.md
yq
-r
'.
".data".supported_versions
| .[] | "- [`" + . + "`](https://github.com/opentofu/opentofu/releases/tag/v" + . + ")"'
opentofu_versions
.y
a
ml
>>
README.md
tail
-n
+2 readme1
>>
README.md
rm
-f
readme0 readme1 readme_inputs.md
...
...
This diff is collapsed.
Click to expand it.
opentofu_versions.yaml
0 → 100644
+
12
−
0
View file @
ab387c7d
.data
:
latest_version
:
'
1.7.1'
supported_versions
:
&supported_versions
-
'
1.7.1'
-
'
1.7.0'
-
'
1.7.0-alpha1'
-
'
1.6.2'
-
'
1.6.1'
-
'
1.6.0'
hack_templates_supported_versions
:
-
*supported_versions
-
'
$OPENTOFU_VERSION'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment