-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
167 lines (150 loc) · 3.97 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
stages:
- sysroot
- bundle
- deploy
.docker-ci-job-definition: &docker-ci-job-template
image: docker:stable
tags:
- docker
before_script:
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
after_script:
- docker logout
.sysroot-definition: &sysroot-template
<<: *docker-ci-job-template
stage: sysroot
script:
- export IMAGE_PATH="${CI_REGISTRY}/${CI_PROJECT_PATH}/sysroot-${RASPBIAN_VERSION}"
- docker build
--tag "${IMAGE_PATH}:${CI_COMMIT_SHA}"
--tag "${IMAGE_PATH}:latest"
--cache-from "${IMAGE_PATH}:latest"
--build-arg RASPBIAN_VERSION="${RASPBIAN_VERSION}"
--file "./rpi-cross/sysroot.Dockerfile"
"./rpi-cross"
- docker push "${IMAGE_PATH}:${CI_COMMIT_SHA}"
- docker push "${IMAGE_PATH}:latest"
.bundle-definition: &bundle-template
<<: *docker-ci-job-template
stage: bundle
script:
- export IMAGE_PATH="${CI_REGISTRY}/${CI_PROJECT_PATH}/${RASPBIAN_VERSION}-on-${HOST_SYSTEM}"
- export SYSROOT_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/sysroot-${RASPBIAN_VERSION}"
- docker build
--tag "${IMAGE_PATH}:${CI_COMMIT_SHA}"
--tag "${IMAGE_PATH}:latest"
--cache-from "${IMAGE_PATH}:latest"
--build-arg SYSROOT_IMAGE="${SYSROOT_IMAGE}:${CI_COMMIT_SHA}"
--file "./rpi-cross/${HOST_SYSTEM}.Dockerfile"
"./rpi-cross"
- docker push "${IMAGE_PATH}:${CI_COMMIT_SHA}"
- docker push "${IMAGE_PATH}:latest"
.deploy-definition: &deploy-template
<<: *docker-ci-job-template
environment:
name: Docker Hub
url: https://hub.docker.com/r/5p4k/rpi-cross
stage: deploy
only:
- master
when: manual
script:
- export FROM_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/${RASPBIAN_VERSION}-on-${HOST_SYSTEM}:${CI_COMMIT_SHA}"
- export TO_IMAGE="${HUB_USER}/rpi-cross:${HUB_TAG}"
- docker pull "${FROM_IMAGE}"
- docker logout
- docker login -u "${HUB_USER}" -p "${HUB_ACCESS_TOKEN}"
- docker tag "${FROM_IMAGE}" "${TO_IMAGE}"
- docker push "${TO_IMAGE}"
sysroot-stretch:
<<: *sysroot-template
variables:
RASPBIAN_VERSION: stretch
sysroot-buster:
<<: *sysroot-template
variables:
RASPBIAN_VERSION: buster
bundle-stretch-on-alpine:
<<: *bundle-template
needs:
- sysroot-stretch
variables:
HOST_SYSTEM: alpine
RASPBIAN_VERSION: stretch
bundle-buster-on-alpine:
<<: *bundle-template
needs:
- sysroot-buster
variables:
HOST_SYSTEM: alpine
RASPBIAN_VERSION: buster
bundle-stretch-on-debian:
<<: *bundle-template
needs:
- sysroot-stretch
variables:
HOST_SYSTEM: debian
RASPBIAN_VERSION: stretch
bundle-buster-on-debian:
<<: *bundle-template
needs:
- sysroot-buster
variables:
HOST_SYSTEM: debian
RASPBIAN_VERSION: buster
deploy-stretch-on-debian:
<<: *deploy-template
needs:
- bundle-stretch-on-debian
variables:
RASPBIAN_VERSION: stretch
HOST_SYSTEM: debian
HUB_TAG: stretch-on-debian
deploy-buster-on-debian:
<<: *deploy-template
needs:
- bundle-buster-on-debian
variables:
RASPBIAN_VERSION: buster
HOST_SYSTEM: debian
HUB_TAG: buster-on-debian
deploy-stretch-on-alpine:
<<: *deploy-template
needs:
- bundle-stretch-on-alpine
variables:
RASPBIAN_VERSION: stretch
HOST_SYSTEM: alpine
HUB_TAG: stretch-on-alpine
deploy-buster-on-alpine:
<<: *deploy-template
needs:
- bundle-buster-on-alpine
variables:
RASPBIAN_VERSION: buster
HOST_SYSTEM: alpine
HUB_TAG: buster-on-alpine
deploy-buster:
<<: *deploy-template
needs:
- bundle-buster-on-alpine
variables:
RASPBIAN_VERSION: buster
HOST_SYSTEM: alpine
HUB_TAG: buster
deploy-stretch:
<<: *deploy-template
needs:
- bundle-stretch-on-alpine
variables:
RASPBIAN_VERSION: stretch
HOST_SYSTEM: alpine
HUB_TAG: stretch
deploy-latest:
<<: *deploy-template
needs:
- bundle-buster-on-alpine
variables:
RASPBIAN_VERSION: buster
HOST_SYSTEM: alpine
HUB_TAG: latest