/
.gitlab-ci.yml
106 lines (98 loc) · 1.53 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
variables:
GITLAB_USER: ci
AWS_REGION: ap-southeast-2
AWS_ACCOUNT: 984310022655
BUILD_ENV: production
before_script:
- touch .env
- make --version
- aws --version
- terraform --version
- docker --version
stages:
- build
- upload
- deploy
tf:plan:
tags:
- linode
stage: build
script:
- make plan
only:
refs:
- merge_request
- main
artifacts:
name: tfplan
paths:
- plans/.tfplan
reports:
terraform: plans/tfplan.json
build:ingress:
tags:
- linode
stage: build
script:
- make docker-login
- ./bin/gen_cert
- make build-ci-ingress
only:
refs:
- merge_request
- main
build:certbot:
tags:
- linode
stage: build
script:
- make docker-login
- make build-ci-certbot
only:
refs:
- merge_request
- main
tf:apply:
tags:
- linode
stage: deploy
script:
- make apply
only:
refs:
- main
environment:
name: linode
url: https://cloud.linode.com/search/?query=label:ingress-controller
on_stop: tf:destroy
dependencies:
- tf:plan
when: manual
tf:destroy:
stage: deploy
variables:
GIT_STRATEGY: none
tags:
- linode
script:
- make destroy
when: manual
environment:
name: linode
action: stop
artifacts:
name: tfdestroy
paths:
- plans/.tfdestroy
reports:
terraform: plans/tfdestroy.json
push:docker:
tags:
- linode
stage: deploy
script:
- make docker-login
- make push-ci
only:
refs:
- main