-
Notifications
You must be signed in to change notification settings - Fork 216
/
.gitlab-ci.yml
103 lines (92 loc) · 2.37 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
# Cache template
.default-cache: &default-cache
key: elastalert
paths:
- node_modules
.push-cache: &push-cache
cache:
<<: *default-cache
policy: push
.pull-cache: &pull-cache
cache:
<<: *default-cache
policy: pull
.node_test: &node-test
<<: *pull-cache
image: node:slim
stage: test
stages:
- build
- test
- deploy
cache:
key: elastalert
paths:
- node_modules/
policy: pull
build:
<<: *push-cache
image: node:slim
stage: build
script:
- npm install --quiet
- npm run build
test:
<<: *node-test
script:
- npm install --quiet
- npm test
deploy:docker:
stage: deploy
script:
- sh scripts/replace_templates.sh ${CI_JOB_TOKEN}
- docker info
- echo $BITSENSOR_PASSWORD | docker login -u $BITSENSOR_USERNAME --password-stdin docker.bitsensor.io
- docker build -t elastalert .
- docker tag elastalert docker.bitsensor.io/elastalert:latest
- docker tag elastalert docker.bitsensor.io/elastalert:$(git describe --abbrev=0)
- docker push docker.bitsensor.io/elastalert:latest
- docker push docker.bitsensor.io/elastalert:$(git describe --abbrev=0)
only:
- tags
tags:
- docker
deploy:docker:snapshot:
stage: deploy
script:
- sh scripts/replace_templates.sh ${CI_JOB_TOKEN}
- docker info
- echo $BITSENSOR_PASSWORD | docker login -u $BITSENSOR_USERNAME --password-stdin docker.bitsensor.io
- docker build -t elastalert .
- docker tag elastalert docker.bitsensor.io/elastalert:snapshot
- docker push docker.bitsensor.io/elastalert:snapshot
only:
- develop
tags:
- docker
deploy:docker-hub:
stage: deploy
script:
- docker info
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- docker build -t elastalert .
- docker tag elastalert bitsensor/elastalert:latest
- docker tag elastalert bitsensor/elastalert:$(git describe --abbrev=0)
- docker push bitsensor/elastalert:latest
- docker push bitsensor/elastalert:$(git describe --abbrev=0)
only:
- tags
tags:
- docker
deploy:docker-hub:snapshot:
stage: deploy
script:
- docker info
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- docker build -t elastalert .
- docker tag elastalert bitsensor/elastalert:snapshot
- docker push bitsensor/elastalert:snapshot
only:
- develop
tags:
- docker