-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
107 lines (102 loc) · 2.69 KB
/
.drone.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
107
---
kind: pipeline
type: kubernetes
name: Terraform Daily Plan
trigger:
event:
- cron
steps:
- name: plan
image: alpine/terragrunt:1.3.6
environment:
KUBICONFIG:
from_secret: kubi
SOPS_GPG_KEY:
from_secret: sops
TF_TOKEN_app_terraform_io:
from_secret: terraform_cloud_token
commands:
- mkdir -p /root/.gnupg /root/.kube
- chmod 0700 /root/.gnupg
- echo "$SOPS_GPG_KEY" > /root/.gnupg/sops.asc
- echo "$KUBICONFIG" > /root/.kube/kubi.yaml
- apk update
- apk add gpg gpg-agent
- gpg --import /root/.gnupg/sops.asc
- wget https://github.com/mozilla/sops/releases/download/v3.7.3/sops-v3.7.3.linux.amd64 -O /usr/local/bin/sops
- chmod +x /usr/local/bin/sops
- cd terraform
- terragrunt run-all init -lockfile=readonly
- terragrunt run-all plan -detailed-exitcode
- name: notify
image: drillster/drone-email
settings:
from.address:
from_secret: email_from
from.name: Drone CI
host: smtp.sendgrid.net
username: apikey
password:
from_secret: sendgrid_apikey
recipients:
from_secret: email_address
recipients_only: true
subject: Terraform Daily Plan failed
when:
status:
- failure
node_selector:
kubernetes.io/arch: amd64
---
kind: pipeline
type: kubernetes
name: Terraform Apply
trigger:
branch:
- main
event:
- push
steps:
- name: apply
image: alpine/terragrunt:1.3.6
environment:
KUBICONFIG:
from_secret: kubi
SOPS_GPG_KEY:
from_secret: sops
TF_INPUT: 'false'
TF_TOKEN_app_terraform_io:
from_secret: terraform_cloud_token
commands:
- mkdir -p /root/.gnupg /root/.kube
- chmod 0700 /root/.gnupg
- echo "$SOPS_GPG_KEY" > /root/.gnupg/sops.asc
- echo "$KUBICONFIG" > /root/.kube/kubi.yaml
- apk update
- apk add gpg gpg-agent
- gpg --import /root/.gnupg/sops.asc
- wget https://github.com/mozilla/sops/releases/download/v3.7.3/sops-v3.7.3.linux.amd64 -O /usr/local/bin/sops
- chmod +x /usr/local/bin/sops
- cd terraform
- terragrunt run-all init -lockfile=readonly
- terragrunt run-all validate
- terragrunt run-all apply
- name: notify
image: drillster/drone-email
settings:
from.address:
from_secret: email_from
from.name: Drone CI
host: smtp.sendgrid.net
username: apikey
password:
from_secret: sendgrid_apikey
recipients:
from_secret: email_address
recipients_only: true
subject: Terraform Apply failed
when:
status:
- failure
node_selector:
kubernetes.io/arch: amd64