forked from PBWebMedia/airflow-prometheus-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
87 lines (78 loc) · 1.73 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
image: docker:latest
stages:
- validate
- build
- image
variables:
DOCKER_DRIVER: overlay2
fmt:
stage: validate
image: golang:1.10.0-alpine3.7
before_script:
- go version
script:
- apk add --no-cache git
- go get || true
- gofmt -l -s -e .
- exit $(gofmt -l -s -e . | wc -l)
lint:
stage: validate
image: golang:1.10.0-alpine3.7
before_script:
- go version
script:
- apk add --no-cache git
- go get -u golang.org/x/lint/golint
- golint -set_exit_status
test:
stage: validate
image: golang:1.10.0-alpine3.7
before_script:
- go version
script:
- apk add --no-cache git
- go get || true
- go test -cover
coverage: '/^coverage:\s(\d+(?:\.\d+)?%)/'
vet:
stage: validate
image: golang:1.10.0-alpine3.7
before_script:
- go version
script:
- apk add --no-cache git
- go get || true
- go vet
compile:
stage: build
image: golang:1.10.0-alpine3.7
before_script:
- go version
script:
- apk add --no-cache git
- go get || true
- CGO_ENABLED=0 go build -o airflow-prometheus-exporter .
artifacts:
name: "artifact_{$CI_COMMIT_SHA}"
expire_in: 30 min
paths:
- airflow-prometheus-exporter
- Dockerfile
build-docker:
stage: image
services:
- docker:dind
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- if [ "${CI_COMMIT_REF_SLUG}" == "master" ]; then IMAGE_TAG="latest"; else IMAGE_TAG="${CI_COMMIT_REF_SLUG}"; fi
- docker build --pull -t $CI_REGISTRY_IMAGE:$IMAGE_TAG .
- docker push $CI_REGISTRY_IMAGE:$IMAGE_TAG
dependencies:
- compile
variables:
GIT_STRATEGY: none
DOCKER_DRIVER: overlay2
tags:
- docker-images