-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbitbucket-pipelines.yml
192 lines (182 loc) · 6.04 KB
/
bitbucket-pipelines.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
definitions:
services:
postgres:
image:
name: us.gcr.io/enroute-interne/enroute-postgresql:dev
username: _json_key
password: "$GCLOUD_API_KEYFILE"
environment:
POSTGRES_DB: ara
POSTGRES_USER: ara
POSTGRES_PASSWORD: ara
steps:
- step: &go-mod
name: Go Mod
image:
name: us.gcr.io/enroute-interne/enroute-golang:dev
username: _json_key
password: "$GCLOUD_API_KEYFILE"
script:
- eval "$(build.sh bitbucket::env)"
- go mod vendor
artifacts:
- vendor/**
- step: &static-check
name: Static Check
image:
name: us.gcr.io/enroute-interne/enroute-golang:dev
username: _json_key
password: "$GCLOUD_API_KEYFILE"
script:
- eval "$(build.sh bitbucket::env)"
- build.sh golang::dev::dependencies
- staticcheck ./...
- step: &build
name: Build
image:
name: us.gcr.io/enroute-interne/enroute-golang:dev
username: _json_key
password: "$GCLOUD_API_KEYFILE"
script:
- eval "$(build.sh bitbucket::env)"
- build.sh golang::dev::dependencies
- make build
artifacts:
- build/**
- step: &unit-tests
name: Unit tests
image:
name: us.gcr.io/enroute-interne/enroute-golang:dev
username: _json_key
password: "$GCLOUD_API_KEYFILE"
script:
- eval "$(build.sh bitbucket::env)"
- build.sh golang::dev::dependencies
- build.sh bitbucket::database
- make test_migrations
- make tests
- build.sh codacy::report
services:
- postgres
- step: &bundle-audit
name: Bundle Audit
image:
name: us.gcr.io/enroute-interne/enroute-ruby:3.3-dev
username: _json_key
password: '$GCLOUD_API_KEYFILE'
script:
- build.sh bundle::audit
- step: &cucumber
name: Cucumber Tests
image:
name: us.gcr.io/enroute-interne/enroute-ruby:3.3-dev
username: _json_key
password: "$GCLOUD_API_KEYFILE"
script:
- eval "$(build.sh bitbucket::env)"
- build.sh cucumber::install
- export ARA_ROOT=build
- build.sh bitbucket::database
- cd build && ARA_ENV=test ARA_ROOT=${PWD} ARA_CONFIG=${PWD}/config ./ara migrate up && cd ..
- TZ=Europe/Paris bundle exec cucumber --tags "not @wip" --publish
services:
- postgres
pipelines:
default:
- step: *go-mod
- parallel:
fail-fast: true
steps:
- step: *static-check
- step: *unit-tests
- step: *build
- step: *bundle-audit
- step: *cucumber
branches:
master:
- step: *go-mod
- parallel:
fail-fast: true
steps:
- step: *static-check
- step: *unit-tests
- step: *build
- step: *bundle-audit
- parallel:
steps:
- step: *cucumber
- step:
name: Build Docker
image:
name: us.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
caches:
- docker
services:
- docker
script:
- build.sh gcloud::setup
- build.sh bitbucket::docker::build
- step:
name: Deploy to test
image:
name: eu.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
deployment: test
runs-on:
- self.hosted
- env.interne
- deploy
script:
- git clone [email protected]:enroute-mobi/ara-env.git env
- env/deploy-with-runner.sh
- pipe: atlassian/datadog-send-event:2.3.1
variables:
API_KEY: $DATADOG_KEY
TITLE: "Build ${BITBUCKET_BUILD_NUMBER} deployed on ara ${BITBUCKET_DEPLOYMENT_ENVIRONMENT}"
PAYLOAD: >
{ "source_type_name": "BITBUCKET", "tags":["env:test","app:ara","repository:ara"] }
- step:
name: Deploy to staging
image:
name: eu.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
deployment: staging
trigger: manual
runs-on:
- self.hosted
- env.interne
- deploy
script:
- git clone [email protected]:enroute-mobi/ara-env.git env
- env/deploy-with-runner.sh
- pipe: atlassian/datadog-send-event:2.3.1
variables:
API_KEY: $DATADOG_KEY
TITLE: "Build ${BITBUCKET_BUILD_NUMBER} deployed on ara ${BITBUCKET_DEPLOYMENT_ENVIRONMENT}"
PAYLOAD: >
{ "source_type_name": "BITBUCKET", "tags":["env:staging","app:ara","repository:ara"] }
- step:
name: Deploy to production
image:
name: eu.gcr.io/enroute-interne/enroute-cloud-sdk:latest
username: _json_key
password: "$GCLOUD_API_KEYFILE"
deployment: production
trigger: manual
runs-on:
- self.hosted
- env.production
- deploy
script:
- git clone [email protected]:enroute-mobi/ara-env.git env
- env/deploy-with-runner.sh
- pipe: atlassian/datadog-send-event:2.3.1
variables:
API_KEY: $DATADOG_KEY
TITLE: "Build ${BITBUCKET_BUILD_NUMBER} deployed on ara ${BITBUCKET_DEPLOYMENT_ENVIRONMENT}"
PAYLOAD: >
{ "source_type_name": "BITBUCKET", "tags":["env:production","app:ara","repository:ara"] }