-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
105 lines (88 loc) · 2.67 KB
/
.gitlab-ci.yml
File metadata and controls
105 lines (88 loc) · 2.67 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
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
96
97
98
99
100
101
102
103
104
105
stages:
- build
- test
- release
variables:
DOCKER_HUB_REPO: ccoley/iperf
.build:
stage: build
tags: [docker]
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: ['']
script:
- >-
/kaniko/executor
--cache=false
--skip-unused-stages
--target ${BUILD_TARGET}
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-${BUILD_TARGET}"
--label org.opencontainers.image.authors="$LABEL_AUTHORS"
--label org.opencontainers.image.created="$(date -u -Iseconds)"
--label org.opencontainers.image.revision="$CI_COMMIT_SHA"
--label org.opencontainers.image.source="$CI_PROJECT_URL"
build:iperf2:
extends: .build
variables:
BUILD_TARGET: iperf2
build:iperf3:
extends: .build
variables:
BUILD_TARGET: iperf3
.test:
stage: test
tags: [docker]
image:
name: alpine:3
entrypoint: ['']
services:
- name: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-${BUILD_TARGET}
alias: iperf-container
before_script:
- apk add --no-cache iperf iperf3
test:iperf2:
extends: .test
needs: ['build:iperf2']
variables:
BUILD_TARGET: iperf2
script:
- iperf -c iperf-container -p 5001 -b 10M -i 1
# iperf always has a truthy exit code, so we have to grep for output instead
- iperf -c iperf-container -p 5001 -b 10M | grep ' Mbits/sec'
test:iperf3:
extends: .test
needs: ['build:iperf3']
variables:
BUILD_TARGET: iperf3
script:
- iperf3 -c iperf-container -p 5201 --connect-timeout 10000 -b 10M
.release:
stage: release
tags: [docker]
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: ['']
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
- crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- crane auth login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_TOKEN" index.docker.io
release:iperf2:
extends: .release
needs: ['test:iperf2']
script:
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2.2
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2
- crane copy ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 ${DOCKER_HUB_REPO}:2.2
- crane tag ${DOCKER_HUB_REPO}:2.2 2
release:iperf3:
extends: .release
needs: ['test:iperf3']
script:
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3.19
- crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3
- crane copy ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 ${DOCKER_HUB_REPO}:3.19
- crane tag ${DOCKER_HUB_REPO}:3.19 3
# vi: set ts=2 sw=2 et ft=yaml: