-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
113 lines (106 loc) · 2.44 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
104
105
106
107
108
109
110
111
112
113
---
variables:
PROMETHEUS_VERSION: v2.14.0
COMPOSE_HTTP_TIMEOUT: "300"
# GET_SOURCES_ATTEMPTS: 3
# GIT_CLEAN_FLAGS: none
GIT_STRATEGY: clone
stages:
- lint
- .pre
- test
clear_stage:
stage: .pre
script:
- chmod 777 -R ./
- rm -rf ./*
allow_failure: true
tags:
- shell
lint_bash:
stage: lint
before_script:
- apk update && apk add bash shellcheck
script:
- shellcheck pre.sh clean.sh ./backup/backup.sh ./backup/restore.sh
rules:
- changes:
- pre.sh
- clean.sh
- ./backup/backup.sh
- ./backup/restore.sh
tags:
- docker
lint_yaml:
stage: lint
image: registry.getnoc.com/infrastructure/ansible_linter:master
script:
- yamllint docker-*.yml
rules:
- changes:
- "docker-*.yml"
tags:
- docker
lint_prometheus:
stage: lint
image:
name: prom/prometheus:${PROMETHEUS_VERSION}
entrypoint: [""]
script:
- promtool check config ./data/vmagent/etc/prometheus.yml
rules:
- changes:
- "./data/prometheus/etc/prometheus.yml"
tags:
- docker
lint_grafana:
stage: lint
image:
name: grafana/grafana:6.3.6
entrypoint: [""]
script:
- grafana-cli --homepath=/usr/share/grafana
--config ./data/grafana/etc/grafana.ini admin reset-admin-password admin
rules:
- changes:
- ./data/grafana/etc/grafana.ini
tags:
- docker
docker.compose:
stage: test
allow_failure: true
before_script:
# TODO
# need auth in registry
# docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY or use
- rm /home/gitlab-runner/.docker/config.json || true
- ./pre.sh -p env -d $PWD
- env
- ./pre.sh -p sentry -d $PWD
- ./pre.sh -p env -d $PWD
- docker-compose down -v --remove-orphans
- docker-compose -f docker-compose-infra.yml down -v --remove-orphans
- chmod +x clean.sh
- ./clean.sh -p all
# - rm -rf ./*
#artifacts:
# untracked: true
#when: always
#expire_in: 6h
#paths:
# - ./data/grafana/plugins/*
#- ./data/promgrafana/plugins/*
script:
- ./pre.sh -p all -d $PWD
- docker --version
- docker-compose --version
- docker-compose up migrate
- docker-compose up -d
- docker-compose -f docker-compose-infra.yml up -d
after_script:
- docker-compose down -v --remove-orphans
- docker-compose -f docker-compose-infra.yml down -v --remove-orphans
- chmod +x clean.sh
- ./clean.sh -p all
tags:
- shell