2021-09-27 16:58:59 +05:00
|
|
|
variables:
|
2021-09-28 08:35:03 +05:00
|
|
|
# Docker service related things.
|
2021-09-27 17:15:29 +05:00
|
|
|
DOCKER_IMAGE: registry.gitlab.pztrn.name/containers/mirror/docker:20.10.8-dind
|
2021-09-27 16:58:59 +05:00
|
|
|
DOCKER_HOST: tcp://docker:2375
|
|
|
|
DOCKER_TCP_PORT: 2375
|
|
|
|
DOCKER_TLS_CERTDIR: ""
|
2021-09-27 17:15:29 +05:00
|
|
|
LINTTEST_IMAGE: registry.gitlab.pztrn.name/containers/mirror/golangci/golangci-lint:v1.42.1
|
2021-09-28 08:35:03 +05:00
|
|
|
CURL_IMAGE: registry.gitlab.pztrn.name/containers/mirror/curlimages/curl:7.79.1
|
|
|
|
# Docker images names that we will push to registry.
|
2021-09-27 16:58:59 +05:00
|
|
|
REGISTRY_IMAGE_LATEST: ${CI_REGISTRY_IMAGE}:latest
|
|
|
|
REGISTRY_IMAGE_TAGGED: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
|
|
|
|
|
|
|
|
services:
|
|
|
|
- name: ${DOCKER_IMAGE}
|
|
|
|
alias: docker
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- release
|
|
|
|
|
|
|
|
lint:
|
|
|
|
stage: test
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
image: ${LINTTEST_IMAGE}
|
|
|
|
script:
|
|
|
|
- golangci-lint run
|
|
|
|
|
2021-09-28 08:35:03 +05:00
|
|
|
# Docker images building.
|
2021-09-27 16:58:59 +05:00
|
|
|
build_master_image:
|
2021-09-28 08:35:03 +05:00
|
|
|
stage: release
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
image: ${DOCKER_IMAGE}
|
|
|
|
script:
|
2021-09-28 10:46:20 +05:00
|
|
|
- apk add --no-cache git bash
|
2021-09-28 08:35:03 +05:00
|
|
|
- scripts/get_version.sh generate
|
|
|
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
2021-09-28 13:15:40 +05:00
|
|
|
- docker build --pull -t ${REGISTRY_IMAGE_LATEST} .
|
2021-09-28 08:35:03 +05:00
|
|
|
- docker push ${REGISTRY_IMAGE_LATEST}
|
2021-09-27 16:58:59 +05:00
|
|
|
|
|
|
|
build_tag_image:
|
2021-09-28 08:35:03 +05:00
|
|
|
stage: release
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
image: ${DOCKER_IMAGE}
|
|
|
|
script:
|
2021-09-28 10:46:20 +05:00
|
|
|
- apk add --no-cache git bash
|
2021-09-28 08:35:03 +05:00
|
|
|
- scripts/get_version.sh generate
|
|
|
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
2021-09-28 13:15:40 +05:00
|
|
|
- docker build -t ${REGISTRY_IMAGE_TAGGED} .
|
|
|
|
- docker build -t ${REGISTRY_IMAGE_LATEST} .
|
2021-09-28 08:35:03 +05:00
|
|
|
- docker push ${REGISTRY_IMAGE_TAGGED}
|
2021-09-28 13:15:40 +05:00
|
|
|
- docker push ${REGISTRY_IMAGE_LATEST}
|