-
Notifications
You must be signed in to change notification settings - Fork 353
/
.gitlab-ci.yml
95 lines (75 loc) · 2.13 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
84
85
86
87
88
89
90
91
92
93
94
95
image: vrnetlab/ci-builder
variables:
PNS: ci-${CI_PIPELINE_ID}
stages:
- build
.build: &build-template
stage: build
tags:
- vrnetlab
script:
# make sure we pulled LFS files
- git lfs fetch -I ${CI_JOB_NAME}
- git lfs checkout ${CI_JOB_NAME}
- ls -l ${CI_JOB_NAME}
# We allow the user to control which Docker registry is used through the
# env var DOCKER_REGISTRY. If it is not set then we assume we should use
# the GitLab built-in Docker registry so we check if it is enabled.
# CI_REGISTRY is only set when the GitLab Docker registry is enabled
- if [ -z "${DOCKER_REGISTRY}" ]; then if [ -n "${CI_REGISTRY}" ]; then export DOCKER_USER=gitlab-ci-token; export DOCKER_PASSWORD=${CI_JOB_TOKEN}; export DOCKER_REGISTRY=${CI_REGISTRY_IMAGE}; fi; fi
- 'echo "DOCKER_REGISTRY: ${DOCKER_REGISTRY}"'
# if DOCKER_REGISTRY set, either explicitly by user or implicitly by GitLab
# (see above) we login to repo, build images and push them
- if [ -n "${DOCKER_REGISTRY}" ]; then docker login -u ${DOCKER_USER} -p=${DOCKER_PASSWORD} ${DOCKER_REGISTRY}; fi
- if [ -n "${DOCKER_REGISTRY}" ]; then
- make ${CI_JOB_NAME}
- make ${CI_JOB_NAME}-test
- if [ "${CI_COMMIT_REF_NAME}" = "${CI_DEFAULT_BRANCH}" ]; then
- echo "Pushing images"
- make ${CI_JOB_NAME}-push
- fi
- fi
interruptible: true
after_script:
# save logs for artifacts
- make -C ${CI_JOB_NAME} docker-test-save-logs
# clean up leftover (failed) test containers
- make -C ${CI_JOB_NAME} docker-test-clean
artifacts:
when: always
paths:
- ${CI_JOB_NAME}/*.log
vr-xcon:
<<: *build-template
vr-bgp:
<<: *build-template
topology-machine:
extends: .build
csr:
<<: *build-template
c8000v:
<<: *build-template
nxos:
<<: *build-template
nxos9kv:
<<: *build-template
routeros:
<<: *build-template
sros:
<<: *build-template
ucpe-oneos:
<<: *build-template
veos:
<<: *build-template
vmx:
<<: *build-template
vsr1000:
<<: *build-template
vqfx:
<<: *build-template
vrp:
<<: *build-template
xrv:
<<: *build-template
xrv9k:
<<: *build-template