-
Notifications
You must be signed in to change notification settings - Fork 18
/
.gitlab-ci.yml
126 lines (110 loc) · 2.53 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
114
115
116
117
118
119
120
121
122
123
124
125
126
stages:
- init
- tests
- build
- release
variables:
FAILFASTCI_NAMESPACE: 'failfast-ci'
IMAGE: quay.io/appr/appr
cache:
paths:
- cache
.job: &job
before_script:
- pip install -e .
- pip install jsonnet
- pip install -r requirements_dev.txt -U
script:
- make test db=$APPR_TEST_DB
tags:
- kubernetes
image: quay.io/appr/appr:base
test-filesystem:
<<: *job
stage: tests
script:
- pip install -U python-coveralls
- make test
- coveralls
variables:
APPR_TEST_DB: filesystem
test-etcd:
<<: *job
stage: tests
services:
- quay.io/coreos/etcd:v3.0.6
variables:
APPR_TEST_DB: etcd
ETCD_HOST: localhost
test-redis:
<<: *job
stage: tests
services:
- redis:3
variables:
APPR_TEST_DB: redis
REDIS_HOST: localhost
flake8:
<<: *job
stage: tests
script:
- make flake8
pylint:
<<: *job
stage: tests
script:
- pip install pylint
- make pylint
compile:
variables:
GIT_STRATEGY: none
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
image: docker:17.06-git
stage: release
services:
- docker:17.06-dind
script:
- mkdir /dist
- docker run --rm --entrypoint="/bin/sh" -v /dist:/dist quay.io/appr/appr:$CI_BUILD_REF_NAME -c 'cp /opt/bin/appr /dist/appr-alpine-x64'
- docker run --rm -v /dist:/dist quay.io/ant31/ghrelease:master --api-key $GITHUB_TOKEN --repo app-registry/appr --file /dist/appr-alpine-x64 --tag $CI_BUILD_REF_NAME
tags:
- kubernetes
only:
- tags
.docker: &docker
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
image: docker:17.06-git
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
services:
- docker:17.06-dind
tags:
- kubernetes
docker-build:
<<: *docker
stage: build
script:
- docker build -t $IMAGE:$CI_BUILD_REF_NAME .
- docker push $IMAGE:$CI_BUILD_REF_NAME
docker-build-base:
<<: *docker
stage: init
script:
- docker build -f Dockerfile.base -t quay.io/appr/appr:base .
- docker push quay.io/appr/appr:base
when: manual
docker-release:
<<: *docker
stage: release
script:
- docker build --build-arg with_kubectl=true -t quay.io/appr/appr:v$(VERSION)-kubectl .
- docker build --build-arg with_kubectl=false -t quay.io/appr/appr .
- docker tag quay.io/appr/appr:v$(VERSION)-kubectl quay.io/appr/appr:kubectl
- docker push quay.io/appr/appr:v$(VERSION)-kubectl
- docker push quay.io/appr/appr:kubectl
- docker push quay.io/appr/appr
only:
- master