This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
forked from giantswarm/prometheus-pingdom-exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
132 lines (118 loc) · 3.56 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
127
128
129
130
131
132
---
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
# build template
.build:
stage: build
image: golang:1.13
artifacts:
expire_in: 1 day
paths:
- .build
before_script:
- make promu
# docker template
.build-docker:
tags:
- docker
- dind
stage: docker
image: docker:latest
artifacts:
expire_in: 1 day
paths:
- image
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
before_script:
- apk add --no-cache make go
# push template
.push:
tags:
- docker
- dind
stage: push
image: docker:latest
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
before_script:
- docker login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD"
- apk add --no-cache make go git
stages:
- lint
- build
- docker
- push
# test
dockerlint:
stage: lint
image: vptech/linter:docker
script:
- find . -type f -name "Dockerfile" | xargs -I {} dockerlint {}
golang:
stage: lint
image: golang:1.13
script:
- make lint
amd64:build:
extends: .build
script:
- GOARCH=amd64 GOOS=linux GO111MODULE=on promu build --prefix .build/linux-amd64
arm64:build:
extends: .build
script:
- GOARCH=arm64 GOOS=linux GO111MODULE=on promu build --prefix .build/linux-arm64
armv7:build:
extends: .build
script:
- GOARCH=arm GOOS=linux GO111MODULE=on promu build --prefix .build/linux-armv7
amd64:docker:
extends: .build-docker
script:
- make docker BUILD_DOCKER_ARCHS=amd64 DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME}
- mkdir image
- docker save vptech/pingdom-exporter-linux-amd64:${CI_COMMIT_REF_NAME} > image/linux-amd64.${CI_COMMIT_REF_NAME}.tar
arm64:docker:
extends: .build-docker
script:
- make docker BUILD_DOCKER_ARCHS=arm64 DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME}
- mkdir image
- docker save vptech/pingdom-exporter-linux-arm64:${CI_COMMIT_REF_NAME} > image/linux-arm64.${CI_COMMIT_REF_NAME}.tar
armv7:docker:
extends: .build-docker
script:
- make docker BUILD_DOCKER_ARCHS=armv7 DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME}
- mkdir image
- docker save vptech/pingdom-exporter-linux-armv7:${CI_COMMIT_REF_NAME} > image/linux-armv7.${CI_COMMIT_REF_NAME}.tar
docker:push:
extends: .push
only:
- master
before_script:
- docker login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD"
- apk add --no-cache make go git
- docker load -i image/linux-amd64.${CI_COMMIT_REF_NAME}.tar
- docker load -i image/linux-arm64.${CI_COMMIT_REF_NAME}.tar
- docker load -i image/linux-armv7.${CI_COMMIT_REF_NAME}.tar
script:
- make docker-publish DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME} DOCKER_REPO=docker.io/vptech
- make docker-manifest DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME} DOCKER_REPO=docker.io/vptech
docker-release:push:
extends: .push
only:
- tags
before_script:
- docker login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD"
- apk add --no-cache make go git
- docker load -i image/linux-amd64.${CI_COMMIT_REF_NAME}.tar
- docker load -i image/linux-arm64.${CI_COMMIT_REF_NAME}.tar
- docker load -i image/linux-armv7.${CI_COMMIT_REF_NAME}.tar
script:
- make docker-publish DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME} DOCKER_REPO=docker.io/vptech
- make docker-manifest DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME} DOCKER_REPO=docker.io/vptech
- make docker-tag-latest DOCKER_IMAGE_TAG=${CI_COMMIT_REF_NAME} DOCKER_REPO=docker.io/vptech
- make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=docker.io/vptech
- make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=docker.io/vptech