-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
config.yml
141 lines (123 loc) · 3.58 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
version: 2
.tags: &tags # tags need to be explicitely defined (whitelist)
tags: {only: "/.*/"}
.only-tags: &only-tags
<<: *tags
branches: { ignore: "/.*/" }
.tag-or-master: &tag-or-master
branches: { only: master }
<<: *tags
.no-master: &no-master # contrary to tags, the branches must be excluded (blacklist)
branches: { ignore: master }
workflows:
version: 2
default:
jobs:
# publish jobs depend on this as well,
# thus tags need to be allowed for these
- test: {filters: {<<: *tags}}
- build/promtail-windows:
requires: [ test ]
- build/docker-driver:
requires: [ test ]
filters: {<<: *no-master}
- publish/docker-driver:
requires: [ test ]
filters: { <<: *tag-or-master }
- publish/binaries:
requires: [ test ]
filters: { <<: *only-tags }
- test-helm:
requires: [ test ]
filters: {<<: *tags}
- publish-helm:
requires: [ test-helm ]
filters: {<<: *tag-or-master}
# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
.defaults: &defaults
docker:
- image: grafana/loki-build-image:0.8.0
working_directory: /src/loki
jobs:
test:
<<: *defaults
steps:
- checkout
- run:
name: Unit Tests
command: make BUILD_IN_CONTAINER=false test
# Promtail
build/promtail-windows:
<<: *defaults
steps:
- checkout
- run:
name: build
command: make GOOS=windows GOGC=10 promtail
# Docker driver
build/docker-driver:
<<: *defaults
steps:
- checkout
- setup_remote_docker
- run:
name: docker-driver
command: make docker-driver
publish/docker-driver:
<<: *defaults
steps:
- checkout
- setup_remote_docker
- run:
name: login
command: docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
- run:
name: docker-driver
command: make docker-driver-push
publish/binaries:
<<: *defaults
steps:
- checkout
- run:
name: github release
command: make BUILD_IN_CONTAINER=false publish
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