-
Notifications
You must be signed in to change notification settings - Fork 21
/
.gitlab-ci.yml
42 lines (35 loc) · 978 Bytes
/
.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
image: registry.git.a/pet4adm/images/docker/gitlab-runner:latest
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
stages:
- build
- test
- release
variables:
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
#CI_DEBUG_TRACE: "true"
.common_rules_onTag: &common_rules_onTag
rules:
- if: '$CI_COMMIT_TAG != null'
build:
stage: build
script:
- docker build --pull -t $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
<<: *common_rules_onTag
run:
stage: test
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker run $CONTAINER_TEST_IMAGE sonar-scanner --version
<<: *common_rules_onTag
push:
stage: release
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
rules:
- if: '$CI_COMMIT_TAG != null'
when: manual