Add ci cd
This commit is contained in:
parent
e47b0cd446
commit
b130a75f87
1 changed files with 37 additions and 0 deletions
37
.gitlab-ci.yml
Normal file
37
.gitlab-ci.yml
Normal 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
|
||||
Loading…
Add table
Reference in a new issue