forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
252 lines (224 loc) · 6.57 KB
/
config.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
version: 2
workflows:
version: 2
test-build-deploy:
jobs:
- test
- test-helm
- build
- lint
- publish:
requires:
- test
- test-helm
- build
- lint
filters:
branches:
only: master
- publish-master:
requires:
- test
- test-helm
- build
- lint
filters:
branches:
only: master
- publish-helm:
requires:
- test
- test-helm
- build
- lint
filters:
branches:
only: master
- deploy:
requires:
- publish
filters:
branches:
only: master
# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
defaults: &defaults
docker:
- image: grafana/loki-build-image:0.2.1
working_directory: /go/src/github.com/grafana/loki
jobs:
test:
<<: *defaults
steps:
- checkout
- run:
name: Run Unit Tests
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false test
lint:
<<: *defaults
steps:
- checkout
- run:
name: Lint
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false lint
- run:
name: Check Generated Fies
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false check-generated-files
build:
<<: *defaults
steps:
- checkout
- setup_remote_docker
- run:
name: Promtail cross platform
command: |
touch loki-build-image/.uptodate &&
make GOOS=linux BUILD_IN_CONTAINER=false cmd/promtail/promtail
rm cmd/promtail/promtail
make GOOS=windows BUILD_IN_CONTAINER=false cmd/promtail/promtail
- run:
name: Build Images
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false
- run:
name: Save Images
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false save-images
- save_cache:
key: v1-loki-{{ .Branch }}-{{ .Revision }}
paths:
- images/
- save_cache:
key: v1-loki-plugin-{{ .Branch }}-{{ .Revision }}
paths:
- cmd/docker-driver/docker-driver
publish:
<<: *defaults
steps:
- checkout
- setup_remote_docker
- restore_cache:
key: v1-loki-{{ .Branch }}-{{ .Revision }}
- restore_cache:
key: v1-loki-plugin-{{ .Branch }}-{{ .Revision }}
- run:
name: Load Images
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false load-images
- run:
name: Push Images
command: |
if [ -n "$DOCKER_USER" ]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make push-images
fi
- run:
name: Push Docker Plugin
command: |
if [ -n "$DOCKER_USER" ]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make BUILD_IN_CONTAINER=false push-plugin
fi
publish-master:
<<: *defaults
steps:
- checkout
- setup_remote_docker
- restore_cache:
key: v1-loki-{{ .Branch }}-{{ .Revision }}
- restore_cache:
key: v1-loki-plugin-{{ .Branch }}-{{ .Revision }}
- run:
name: Load Images
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false load-images
- run:
name: Push Images
command: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make push-latest
- run:
name: Push Docker Plugin
command: |
if [ -n "$DOCKER_USER" ]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
PLUGIN_TAG=master make BUILD_IN_CONTAINER=false push-plugin && PLUGIN_TAG=latest make BUILD_IN_CONTAINER=false push-plugin
fi
test-helm:
environment:
CT_VERSION: 2.3.3
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Install k3s
command: |
curl -sfL https://get.k3s.io | sh -
sudo chmod 755 /etc/rancher/k3s/k3s.yaml
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- run:
name: Install Helm
command: |
curl -L https://git.io/get_helm.sh | bash
kubectl apply -f tools/helm.yaml
helm init --service-account helm --wait
- run:
name: Install Chart Testing tool
command: |
pip install yamale yamllint
curl -Lo ct.tgz https://github.com/helm/chart-testing/releases/download/v${CT_VERSION}/chart-testing_${CT_VERSION}_linux_amd64.tar.gz
sudo tar -C /usr/local/bin -xvf ct.tgz
sudo mv /usr/local/bin/etc /etc/ct/
- run:
name: Run Chart Tests
command: |
ct lint --chart-dirs=production/helm --check-version-increment=false --validate-maintainers=false
ct install --build-id=${CIRCLE_BUILD_NUM} --charts production/helm/loki-stack
publish-helm:
<<: *defaults
steps:
- add_ssh_keys:
fingerprints:
- "5a:d3:08:5e:f7:53:a0:c4:e9:5d:83:c6:02:6a:d9:bd"
- checkout
- run: make helm-publish
deploy:
<<: *defaults
steps:
- checkout
- run: |
curl -s --header "Content-Type: application/json" \
--data "{\"build_parameters\": {\"CIRCLE_JOB\": \"deploy\", \"IMAGE_NAMES\": \"$(make images)\"}}" \
--request POST \
https://circleci.com/api/v1.1/project/github/raintank/deployment_tools/tree/master?circle-token=$CIRCLE_TOKEN
release:
<<: *defaults
steps:
- checkout
- setup_remote_docker
- restore_cache:
key: v1-loki-{{ .Branch }}-{{ .Revision }}
- run:
name: Load Images
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false load-images
- run:
name: "Print Tag"
command: echo ${CIRCLE_TAG}
- run:
name: "Release"
command: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make VERSION=${CIRCLE_TAG} release-perform