-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
89 lines (82 loc) · 2.66 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
stages:
- test
- build
- deploy
services:
- postgres:latest
.elixir-task:
image: elixir:1.12.1
before_script:
- apt-get install -y libcurl4-openssl-dev libssl-dev libevent-dev
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
# dialyzer:
# stage: test
# extends: .elixir-task
# cache:
# paths:
# - _build/
# script:
# - mix dialyzer
credo:
stage: test
extends: .elixir-task
script:
- mix credo --strict
test:
stage: test
extends: .elixir-task
script:
- mix test --trace
variables:
POSTGRES_DATABASE: boruta_test
POSTGRES_HOST: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
MIX_ENV: test
build:
image: docker:19.03.12
stage: build
services:
- docker:19.03.12-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY/patatoid/boruta/app:latest
script:
- docker build --cache-from $CI_REGISTRY/patatoid/boruta/app:latest -t $CI_REGISTRY/patatoid/boruta/app:$CI_COMMIT_SHORT_SHA .
- docker tag $CI_REGISTRY/patatoid/boruta/app:$CI_COMMIT_SHORT_SHA $CI_REGISTRY/patatoid/boruta/app:latest
- docker push $CI_REGISTRY/patatoid/boruta/app:$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY/patatoid/boruta/app:latest
only:
- master
deploy:
stage: deploy
image: debian:latest
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
before_script:
- apt-get update
- apt-get install -y curl python3-pip apt-transport-https
- curl https://baltocdn.com/helm/signing.asc | apt-key add -
- echo "deb https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list
- apt-get update
- apt-get install -y helm
- pip3 install --upgrade setuptools pip
- pip3 install ansible pyhelm grpcio requests openshift kubernetes
- ansible-galaxy collection install kubernetes.core
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
- echo "$(<kubectl.sha256) kubectl" | sha256sum --check
- mv ./kubectl /usr/bin/kubectl
- chmod 755 /usr/bin/kubectl
script:
- cd ansible
- echo $VAULT_PASSWORD > vault_pass.txt
- ansible-vault decrypt ./.kube/kubeconfig-k8s-boruta.yaml --vault-password-file vault_pass.txt
- KUBECONFIG=./.kube/kubeconfig-k8s-boruta.yaml ansible-playbook -i ./inventories/scaleway deploy.yml -e release_tag=$CI_COMMIT_SHORT_SHA --vault-password-file vault_pass.txt
only:
- master