Add ci cd

This commit is contained in:
spengreb 2022-12-01 14:51:27 +00:00
parent e47b0cd446
commit b130a75f87

37
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,37 @@
stages:
- 🤞 test
- 🤞 test docker build
- 🚀 publish
test:
stage: 🤞 test
script:
- python3 -m unittest
test-docker-build:
stage: 🤞 test docker build
image: docker:latest
services:
- docker:dind
before_script:
- apk add jq curl
script:
- TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')
- docker build --pull -t "$CI_REGISTRY_IMAGE:$TERRAFORM_VERSION" .
except:
- master
publish:
stage: 🚀 publish
image: docker:latest
services:
- docker:dind
before_script:
- apk add jq curl
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')
- docker build --pull -t "$CI_REGISTRY_IMAGE:$TERRAFORM_VERSION" .
- docker push "$CI_REGISTRY_IMAGE:$TERRAFORM_VERSION"
only:
- master