Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
terraform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
702
HADOOP
terraform
Commits
c3195652
Commit
c3195652
authored
3 years ago
by
František Dvořák
Browse files
Options
Downloads
Patches
Plain Diff
gitLab CI: remote terraform state
parent
254b5e09
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#695
passed
3 years ago
Stage: test
Changes
1
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+18
-7
18 additions, 7 deletions
.gitlab-ci.yml
with
18 additions
and
7 deletions
.gitlab-ci.yml
+
18
−
7
View file @
c3195652
...
...
@@ -12,6 +12,12 @@ variables:
JOB
:
check
PYTHONUNBUFFERED
:
1
SENSITIVE
:
1
TF_HTTP_LOCK_METHOD
:
POST
TF_HTTP_PASSWORD
:
${CI_JOB_TOKEN}
TF_HTTP_RETRY_WAIT_MIN
:
5
TF_HTTP_UNLOCK_METHOD
:
DELETE
TF_HTTP_USERNAME
:
gitlab-ci-token
TF_IN_AUTOMATION
:
'
true'
flake8
:
stage
:
build
...
...
@@ -20,14 +26,20 @@ flake8:
rules
:
-
if
:
'
$JOB
=~
/all|check/'
te
rraform
-single
:
te
st
-single
:
stage
:
test
variables
:
&tfvars
TF_HTTP_ADDRESS
:
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${CI_JOB_NAME}
TF_HTTP_LOCK_ADDRESS
:
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${CI_JOB_NAME}/lock
TF_HTTP_UNLOCK_ADDRESS
:
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${CI_JOB_NAME}/lock
before_script
:
&before
-
sudo apt-get update
-
sudo apt-get install -y --no-install-recommends git
-
rm -fv clouds.yaml testsuite.auto.tfvars
-
rm -fv clouds.yaml testsuite.auto.tfvars
gitlab.tf
-
ln -sfv $CLOUDS_YAML clouds.yaml
-
ln -sfv $TERRAFORM_CONFIG testsuite.auto.tfvars
# GitLab remote terraform state
-
printf 'terraform {\n backend "http" {\n }\n}\n' > gitlab.tf
# https://github.com/terraform-provider-openstack/terraform-provider-openstack/issues/1160
-
touch ./secure.yml
-
ip=`openstack floating ip create -c floating_ip_address -f value public-muni-147-251-21-GROUP`
...
...
@@ -36,9 +48,8 @@ terraform-single:
key
:
single
paths
:
-
"
.terraform/"
-
"
*.tfstate"
script
:
-
terraform init
-
terraform init
-input=false
-
args="-auto-approve -var type=hadoop-single -var flavor=standard.large -var n=0 -var domain=terra1 -var image_name=$IMAGE_NAME -var image_visibility=$IMAGE_VISIBILITY -var floating_ip=$ip"
-
terraform apply $args
-
eval $(ssh-agent -s)
...
...
@@ -52,17 +63,17 @@ terraform-single:
paths
:
-
"
*.log"
te
rraform
-cluster
:
te
st
-cluster
:
stage
:
test
variables
:
*tfvars
before_script
:
*before
cache
:
when
:
always
key
:
cluster
paths
:
-
"
.terraform/"
-
"
*.tfstate"
script
:
-
terraform init
-
terraform init
-input=false
-
args="-auto-approve -var type=hadoop -var domain=terra2 -var image_name=$IMAGE_NAME -var image_visibility=$IMAGE_VISIBILITY -var floating_ip=$ip"
-
terraform apply $args
-
eval $(ssh-agent -s)
...
...
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