Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Custom Terraform Openstack Provider
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
Service Desk
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
cloud
g2-openstack
Custom Terraform Openstack Provider
Commits
7d1cbc34
Commit
7d1cbc34
authored
2 years ago
by
Josef Němec
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix/version-specific-terraform' into 'master'
Enable custom terraform version See merge request
!3
parents
b1067214
5ad8e5f7
Branches
master
No related tags found
1 merge request
!3
Enable custom terraform version
Pipeline
#290700
skipped
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+25
-10
25 additions, 10 deletions
.gitlab-ci.yml
Dockerfile
+7
-13
7 additions, 13 deletions
Dockerfile
with
32 additions
and
23 deletions
.gitlab-ci.yml
+
25
−
10
View file @
7d1cbc34
stages
:
stages
:
-
build
-
build
docker-build
:
.compile-sources
:
script
:
&compile-sources
-
env GOOS=linux GOARCH=amd64 go build -o terraform-provider-openstack
-
git clone --depth 1 --branch $TERRAFORM_VERSION https://github.com/hashicorp/terraform.git
-
go env -w GOBIN="$(pwd)"/terraform
-
cd terraform && go install && cd ..
.docker-build
:
stage
:
build
stage
:
build
image
:
registry.gitlab.ics.muni.cz:443/cloud/g2/container-registry/docker.io__debian:bullseye
image
:
registry.gitlab.ics.muni.cz:443/cloud/g2/container-registry/docker.io__debian:latest
variables
:
TERRAFORM_VERSION
:
v1.5.2
# Tag from Github https://github.com/hashicorp/terraform/tree/v1.5.2
before_script
:
before_script
:
-
apt-get update 1> /dev/null && apt-get install -y docker.io jq > install.log
-
apt-get update 1> /dev/null && apt-get install -y docker.io golang-go 1> dpkg-install.log
-
service docker start && sleep 5s
-
service docker start
script
:
-
PROVIDER_VERSION="$(cat VERSION)"
-
PROVIDER_VERSION="$(cat VERSION)"
-
TERRAFORM_VERSION="$(docker run hashicorp/terraform version -json | jq -r '.terraform_version')"
script
:
-
*compile-sources
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
docker build --no-cache -t "$CI_REGISTRY_IMAGE:v$TERRAFORM_VERSION-$PROVIDER_VERSION" .
-
docker build -t "$CI_REGISTRY_IMAGE:$TERRAFORM_VERSION-$PROVIDER_VERSION" .
-
docker push "$CI_REGISTRY_IMAGE:v$TERRAFORM_VERSION-$PROVIDER_VERSION"
-
docker push "$CI_REGISTRY_IMAGE:$TERRAFORM_VERSION-$PROVIDER_VERSION"
docker-build-tags
:
extends
:
.docker-build
only
:
only
:
-
master
-
tags
docker-build-manual
:
extends
:
.docker-build
when
:
manual
This diff is collapsed.
Click to expand it.
Dockerfile
+
7
−
13
View file @
7d1cbc34
FROM
ubuntu
FROM
ubuntu
:jammy
RUN
apt-get update 1> /dev/null
&&
\
COPY
terraform/terraform /usr/local/bin
apt-get
install
-y
wget gpg lsb-release golang-go 1> /dev/null
COPY
terraform-provider-openstack .
RUN
mkdir
-p
$HOME
/.terraform.d/plugins/gitlab.ics.muni.cz/cloud/openstack/0.0.1/linux_amd64
&&
\
mv
terraform-provider-openstack
$HOME
/.terraform.d/plugins/gitlab.ics.muni.cz/cloud/openstack/0.0.1/linux_amd64/terraform-provider-openstack
# Install terraform (+ get signature key for hashicorp)
# Terraform autocomplete
RUN
wget
-O-
https://apt.releases.hashicorp.com/gpg | gpg
--dearmor
|
tee
/usr/share/keyrings/hashicorp-archive-keyring.gpg 1> /dev/null
&&
\
RUN
touch
~/.bashrc
&&
terraform
-install-autocomplete
echo
"deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com
$(
lsb_release
-cs
)
main"
|
tee
/etc/apt/sources.list.d/hashicorp.list
&&
\
apt update 1> /dev/null
&&
apt
install
-y
terraform 1> /dev/null
# Init custom-terraform-provider-openstack
WORKDIR
/tmp/custom-terraform-provider-openstack
COPY
. .
RUN
env
GOOS
=
linux
GOARCH
=
amd64 go build
-o
$HOME
/.terraform.d/plugins/gitlab.ics.muni.cz/cloud/openstack/0.0.1/linux_amd64/terraform-provider-openstack
&&
\
terraform init
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