-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
66 lines (63 loc) · 1.76 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
stages:
- check_prebuild
- build
# Job to test that all pre-commit checks pass
check_prebuild:
stage: check_prebuild
tags:
- docker
- around25
variables:
image: around25/docker-precommit-base:latest
script:
# install precommit check
- pre-commit install
# optionally install dependencies
- go get github.com/fzipp/gocyclo
- go get -u golang.org/x/lint/golint
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.22.2
# run the check
- pre-commit run --all-files
build:
tags:
- docker
- around25
stage: build
dependencies:
- check_prebuild
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_IID
APP_VERSION: $CI_COMMIT_REF_NAME-$CI_PIPELINE_IID
GIT_COMMIT: $CI_COMMIT_SHORT_SHA
services:
- docker:18.09.7-dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --build-arg GIT_COMMIT=$GIT_COMMIT --build-arg APP_VERSION=$APP_VERSION -t $IMAGE_TAG .
- docker push $IMAGE_TAG
only:
- develop
- master
release:
tags:
- docker
- around25
stage: build
dependencies:
- check_prebuild
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
APP_VERSION: $CI_COMMIT_REF_NAME-$CI_PIPELINE_IID
GIT_COMMIT: $CI_COMMIT_SHORT_SHA
services:
- docker:18.09.7-dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --build-arg GIT_COMMIT=$GIT_COMMIT --build-arg APP_VERSION=$APP_VERSION -t $IMAGE_TAG .
- docker push $IMAGE_TAG
only:
- tags