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
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
components
OpenTofu
Commits
300f345e
Unverified
Commit
300f345e
authored
7 months ago
by
Timo Furrer
Browse files
Options
Downloads
Patches
Plain Diff
Remove `TF_FF_AUTO_URLENCODE_STATE_NAME` feature flag
This feature flag is now always enabled. Changelog: removed
parent
67a8ff85
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gitlab-tofu.sh
+3
-8
3 additions, 8 deletions
src/gitlab-tofu.sh
tests/unit/gitlab-tofu.bats
+6
-21
6 additions, 21 deletions
tests/unit/gitlab-tofu.bats
with
9 additions
and
29 deletions
src/gitlab-tofu.sh
+
3
−
8
View file @
300f345e
...
...
@@ -11,9 +11,7 @@ fi
# =============
# Below are a bunch of variables that we use as "feature flags".
if
[
-z
"
$TF_FF_AUTO_URLENCODE_STATE_NAME
"
]
;
then
TF_FF_AUTO_URLENCODE_STATE_NAME
=
true
fi
# There are no feature flags at the moment.
# Helpers
...
...
@@ -78,11 +76,8 @@ fi
# If TF_ADDRESS is unset but TF_STATE_NAME is provided, then default to GitLab backend in current project
if
[
-n
"
${
TF_STATE_NAME
}
"
]
&&
[
-z
"
${
TF_ADDRESS
}
"
]
;
then
# auto url-encode TF_STATE_NAME when FF is enabled
if
$TF_FF_AUTO_URLENCODE_STATE_NAME
;
then
TF_STATE_NAME
=
"
$(
jq
-rn
--arg
x
"
${
TF_STATE_NAME
}
"
'$x|@uri'
)
"
fi
# auto url-encode TF_STATE_NAME
TF_STATE_NAME
=
"
$(
jq
-rn
--arg
x
"
${
TF_STATE_NAME
}
"
'$x|@uri'
)
"
TF_ADDRESS
=
"
${
CI_API_V4_URL
}
/projects/
${
CI_PROJECT_ID
}
/terraform/state/
${
TF_STATE_NAME
}
"
fi
...
...
This diff is collapsed.
Click to expand it.
tests/unit/gitlab-tofu.bats
+
6
−
21
View file @
300f345e
...
...
@@ -84,13 +84,13 @@ EOF
@test "gitlab-tofu plan" {
export TF_PLAN_CACHE="test-plan.cache"
gitlab-tofu plan
if [ ! -f "$TF_ROOT/$TF_PLAN_CACHE" ]; then
if [ ! -f "$TF_ROOT/$TF_PLAN_CACHE" ]; then
echo "expected to find a plan.cache file"
exit 1
fi
gitlab-tofu plan-json
if [ ! -f "$TF_ROOT/plan.json" ]; then
if [ ! -f "$TF_ROOT/plan.json" ]; then
echo "expected to find a plan.json file"
exit 1
fi
...
...
@@ -111,28 +111,28 @@ EOF
@test "gitlab-tofu validate without implicit init" {
export TF_IMPLICIT_INIT=false
run ! gitlab-tofu validate -no-color
assert_output --partial 'This module is not yet installed'
}
@test "gitlab-tofu plan without implicit init" {
export TF_IMPLICIT_INIT=false
run ! gitlab-tofu plan -no-color
assert_output --partial 'Error: Backend initialization required'
}
@test "gitlab-tofu apply without implicit init" {
export TF_IMPLICIT_INIT=false
run ! gitlab-tofu apply -no-color
assert_output --partial 'Error: Failed to load '
}
@test "gitlab-tofu destroy without implicit init" {
export TF_IMPLICIT_INIT=false
run ! gitlab-tofu destroy -no-color
assert_output --partial 'Error: Backend initialization required'
}
...
...
@@ -195,21 +195,6 @@ EOF
$SHELL test.sh
}
# bats test_tags=source
@test "gitlab-tofu source state name auto urlencode FF disabled" {
test -n "$SHELL"
cat <<'EOF' > test.sh
set -x
export TF_FF_AUTO_URLENCODE_STATE_NAME=false
export TF_STATE_NAME=production/europe
. $(which gitlab-tofu)
test "$TF_STATE_NAME" = "production/europe"
EOF
$SHELL test.sh
}
# bats test_tags=source
@test "gitlab-tofu source init with prepared registry token" {
test -n "$SHELL"
...
...
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