forked from ropod-project/ropod_common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
74 lines (64 loc) · 2.07 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
image: docker:stable
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
services:
- name: docker:dind
command: ["--insecure-registry=git.ropod.org:4567"] # self-signed cetificate
stages:
- build
- test
- release
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN git.ropod.org:4567
build:
stage: build
script:
- docker build --pull -t $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
test:
stage: test
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker run $CONTAINER_TEST_IMAGE bash -c "cd /opt/ropod/ropod_common/ropodcpp/zyre_communicator/ && mkdir build && cd build && cmake .. && make"
release-stable-image:
variables:
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:stable
DOCKERHUB_RELEASE_IMAGE: ropod/ropod_common
stage: release
script:
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $DOCKERHUB_RELEASE_IMAGE
- docker push $DOCKERHUB_RELEASE_IMAGE
only:
- master
- tags
release-latest-image:
stage: release
variables:
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
DOCKERHUB_RELEASE_IMAGE: ropod/ropod_common
script:
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $DOCKERHUB_RELEASE_IMAGE
- docker push $DOCKERHUB_RELEASE_IMAGE
only:
- develop
trigger_build:
before_script:
- apk --no-cache add curl
stage: release
script:
- "curl --insecure -X POST -F token='$DOCKER_PIPELINE' -F ref=master https://git.ropod.org/api/v4/projects/120/trigger/pipeline"
only:
- develop