-
Notifications
You must be signed in to change notification settings - Fork 10
/
.gitlab-ci.yml
77 lines (68 loc) · 1.45 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
image: golang:1
stages:
- validate
- build
- image
variables:
DOCKER_DRIVER: overlay2
fmt:
stage: validate
before_script:
- go version
script:
- go get || true
- gofmt -l -s -e .
- exit $(gofmt -l -s -e . | wc -l)
lint:
stage: validate
before_script:
- go version
script:
- go get -u golang.org/x/lint/golint
- golint -set_exit_status
test:
stage: validate
before_script:
- go version
script:
- go get || true
- go test -cover
coverage: '/^coverage:\s(\d+(?:\.\d+)?%)/'
vet:
stage: validate
before_script:
- go version
script:
- go get || true
- go vet
compile:
stage: build
before_script:
- go version
script:
- go get || true
- CGO_ENABLED=0 go build -o airflow-prometheus-exporter .
artifacts:
expire_in: 30 min
paths:
- airflow-prometheus-exporter
- Dockerfile
build-docker:
stage: image
image: docker:latest
services:
- docker:dind
before_script:
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
- 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
tags:
- docker-images