2020-12-23 16:31:14 +05:00
|
|
|
services:
|
|
|
|
- name: registry.gitlab.pztrn.name/containers/mirror/docker:19.03.13-dind
|
|
|
|
alias: docker
|
|
|
|
|
|
|
|
variables:
|
2020-12-23 20:08:47 +05:00
|
|
|
DOCKER_IMAGE: registry.gitlab.pztrn.name/containers/mirror/docker:19.03.13-dind
|
2020-12-23 16:31:14 +05:00
|
|
|
DOCKER_HOST: tcp://docker:2375
|
|
|
|
DOCKER_TCP_PORT: 2375
|
|
|
|
DOCKER_TLS_CERTDIR: ""
|
2020-12-23 20:08:47 +05:00
|
|
|
LINTTEST_IMAGE: registry.gitlab.pztrn.name/containers/mirror/golangci/golangci-lint:v1.33.0
|
2020-12-23 20:07:14 +05:00
|
|
|
REGISTRY_IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
|
|
|
|
REGISTRY_IMAGE_TAGGED: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
2020-12-23 16:31:14 +05:00
|
|
|
|
2020-11-29 03:22:39 +05:00
|
|
|
stages:
|
|
|
|
- test
|
2020-12-23 20:07:14 +05:00
|
|
|
- release
|
2020-11-29 03:22:39 +05:00
|
|
|
|
|
|
|
lint:
|
|
|
|
stage: test
|
|
|
|
tags:
|
|
|
|
- docker
|
2020-12-23 20:08:47 +05:00
|
|
|
image: $LINTTEST_IMAGE
|
2020-11-29 03:22:39 +05:00
|
|
|
script:
|
|
|
|
- golangci-lint run
|
2020-12-23 20:07:14 +05:00
|
|
|
|
|
|
|
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
|