-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
45 lines (40 loc) · 1.06 KB
/
.gitlab-ci.yml
File metadata and controls
45 lines (40 loc) · 1.06 KB
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
before_script:
- build_tag=ci-$CI_PROJECT_ID-$CI_BUILD_REF
- project=${CI_PROJECT_DIR##*/}
- export REGISTRYS="docker-aws.ostrovok.ru/releases"
- docker info
stages:
- build
- test
- push_and_deploy
- cleanup
build_image:
stage: build
script:
- commit_hash=$CI_BUILD_REF
- echo "vcs build number __ $commit_hash __"
- echo "vcs build branch __ $CI_BUILD_REF_NAME __"
- docker build --force-rm=true --rm=true --pull=true -t ${build_tag} .
run_tests:
stage: test
only:
- master
script:
- echo "tests skipped __ $commit_hash __"
push_to_registry:
stage: push_and_deploy
only:
- master
script:
- VERSION=b${CI_BUILD_ID}
- for i in ${REGISTRYS}; do \
- docker tag ${build_tag} ${i}/${project}:latest; \
- docker tag ${build_tag} ${i}/${project}:$VERSION; \
- docker push ${i}/${project}:latest; \
- docker push ${i}/${project}:$VERSION; \
- done
- echo "Deploy complete with build $VERSION"
remove_build_images:
stage: cleanup
script:
- docker rmi --force ${build_tag}