-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
48 lines (43 loc) · 1.57 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
services:
- name: registry.gitlab.pztrn.name/containers/mirror/docker:19.03.13-dind
alias: docker
variables:
DOCKER_IMAGE: registry.gitlab.pztrn.name/containers/mirror/docker:19.03.13-dind
DOCKER_HOST: tcp://docker:2375
DOCKER_TCP_PORT: 2375
DOCKER_TLS_CERTDIR: ""
LINTTEST_IMAGE: registry.gitlab.pztrn.name/containers/mirror/golangci/golangci-lint:v1.33.0
REGISTRY_IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
REGISTRY_IMAGE_TAGGED: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
stages:
- test
- release
lint:
stage: test
tags:
- docker
image: $LINTTEST_IMAGE
script:
- golangci-lint run
build_master_image:
stage: release
only:
- master
tags:
- docker
image: $DOCKER_IMAGE
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull -t $REGISTRY_IMAGE_LATEST --build-arg CI_COMMIT_TAG=${CI_COMMIT_TAG} --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} --build-arg CI_COMMIT_SHA=${CI_COMMIT_SHA} --build-arg CI_PROJECT_NAME=${CI_PROJECT_NAME} .
- docker push $REGISTRY_IMAGE_LATEST
build_tag_image:
stage: release
only:
- tags
tags:
- docker
image: $DOCKER_IMAGE
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $REGISTRY_IMAGE_TAGGED --build-arg CI_COMMIT_TAG=${CI_COMMIT_TAG} --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} --build-arg CI_COMMIT_SHA=${CI_COMMIT_SHA} --build-arg CI_PROJECT_NAME=${CI_PROJECT_NAME} .
- docker push $REGISTRY_IMAGE_TAGGED