-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path.gitlab-ci.yml
84 lines (76 loc) · 1.95 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
before_script:
- apk add --no-cache --update bash ca-certificates curl openssl git
- /bin/bash -c 'echo $BASH_VERSION'
- mkdir -p build
variables:
DOCKER_DIND_SERVICE: $CI_REGISTRY/docker/dind:latest
TEMP_IMAGE: ci-build/$CI_PROJECT_PATH:$CI_PIPELINE_ID
BUILD_PATH: build/
TEMP_IMAGE_LOCAL: $BUILD_PATH/wvc-image.tar
TEMP_IMAGE_LOCAL_COMPRESSED: $BUILD_PATH/wvc-image.tar.bz2
.semver-tags-regex: &semver-tags-regex
- /^([0-9]+)\.([0-9]+)\.([0-9]+)$/
stages:
- contribution
- build
- test
- release
clacheck:
stage: contribution
image: docker:latest
script:
- .ci/check_cla.sh
tags:
- docker-build
containerbuild:
stage: build
image: docker:latest
services:
- name: $DOCKER_DIND_SERVICE
alias: docker
artifacts:
expire_in: 1 hour
paths:
- $TEMP_IMAGE_LOCAL_COMPRESSED
dependencies:
- clacheck
script:
- mkdir -p $BUILD_PATH
- .ci/build.sh
- .ci/check_container.sh $TEMP_IMAGE
- docker save --output $TEMP_IMAGE_LOCAL $TEMP_IMAGE
- nice -n 19 bzip2 -v -9 $TEMP_IMAGE_LOCAL
- ls -laih $TEMP_IMAGE_LOCAL_COMPRESSED
tags:
- docker-build
containertest:
stage: test
image: docker:latest
services:
- name: $DOCKER_DIND_SERVICE
alias: docker
dependencies:
- containerbuild
script:
- .ci/check_container.sh $TEMP_IMAGE $CI_JOB_TOKEN $CI_REGISTRY
tags:
- docker-build
release:
stage: release
image: docker:latest
services:
- name: $DOCKER_DIND_SERVICE
alias: docker
dependencies:
- containertest
script:
- ls -laih $BUILD_PATH
- nice -n 19 bzip2 -d $TEMP_IMAGE_LOCAL_COMPRESSED
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker load --input $TEMP_IMAGE_LOCAL --quiet
- docker tag $TEMP_IMAGE $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker tag $TEMP_IMAGE $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE
only: *semver-tags-regex
tags:
- docker-build