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
67acb93b
Unverified
Commit
67acb93b
authored
7 months ago
by
Timo Furrer
Browse files
Options
Downloads
Patches
Plain Diff
Check for dependencies when running gitlab-tofu
Changelog: feature
parent
ee16f015
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gitlab-tofu.sh
+28
-6
28 additions, 6 deletions
src/gitlab-tofu.sh
with
28 additions
and
6 deletions
src/gitlab-tofu.sh
+
28
−
6
View file @
67acb93b
#!/bin/sh -e
# ATTENTION: this script is yet JUST A COPY of https://gitlab.com/gitlab-org/terraform-images/-/blob/master/src/bin/gitlab-terraform.sh
# with some VERY MINIMAL MODIFICATIONS.
# It definitely needs cleanup in the future.
#!/usr/bin/env sh
# set some shell options
set
-o
errexit
if
[
"
${
DEBUG_OUTPUT
}
"
=
"true"
]
;
then
set
-
x
set
-
o
xtrace
fi
# Feature Flags
...
...
@@ -37,6 +36,29 @@ else # All other shells: examine $0 for known shell binary filenames.
case
${
0
##*/
}
in
sh|-sh|dash|-dash
)
sourced
=
1
;;
esac
fi
# Dependencies
# ============
# Defines all the external dependencies and checks if they exist, if not, abort with an error.
dependencies
=
"dirname basename pwd sed idn2 jq tofu"
if
[
-n
"
$ZSH_VERSION
"
]
;
then
# ZSH is the only supported SHELL that does not split by word by default,
# so we set this option to actually do it.
setopt sh_word_split
fi
for
dep
in
$dependencies
;
do
if
!
command
-v
"
$dep
"
>
/dev/null 2>&1
;
then
echo
"Error: gitlab-tofu is missing dependency: '
$dep
'"
>
&2
exit
1
fi
done
if
[
-n
"
$ZSH_VERSION
"
]
;
then
# see comment above when setting sh_word_split.
unsetopt sh_word_split
fi
JQ_PLAN
=
'
(
[.resource_changes[]?.change.actions?] | flatten
...
...
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