-
Notifications
You must be signed in to change notification settings - Fork 15
/
action.yml
282 lines (237 loc) · 11.3 KB
/
action.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
name: "docker-ros"
description: "docker-ros automatically builds development and deployment Docker images for your ROS-based repositories."
inputs:
target:
description: "Target stage of Dockerfile (comma-separated list) [dev|run]"
default: run
platform:
description: "Target platform architecture (comma-separated list) [amd64|arm64|...]"
base-image:
description: "Base image name:tag"
required: true
command:
description: "Launch command of run image (required if target=run)"
image-name:
description: "Image name of run image"
default: ghcr.io/${{ github.repository }}
image-tag:
description: "Image tag of run image"
default: latest
dev-image-name:
description: "Image name of dev image"
dev-image-tag:
description: "Image tag of dev image"
build-context:
description: "Build context of Docker build process"
default: ${{ github.workspace }}
registry:
description: "Docker registry to push images to"
default: ghcr.io
registry-user:
description: "Docker registry username"
default: ${{ github.actor }}
registry-password:
description: "Docker registry password"
default: ${{ github.token }}
ros-distro:
description: "ROS Distro (required if ROS is not installed in `base-image`)"
git-https-server:
description: "Server URL (without protocol) for cloning private Git repositories via HTTPS"
default: "github.com"
git-https-user:
description: "Username for cloning private Git repositories via HTTPS"
default: ${{ github.actor }}
git-https-password:
description: "Password for cloning private Git repositories via HTTPS"
default: ${{ github.token }}
git-ssh-private-key:
description: "SSH private key for cloning private Git repositories via SSH"
git-ssh-known-host-keys:
description: "Known SSH host keys for cloning private Git repositories via SSH (may be obtained using `ssh-keyscan`)"
additional-debs-file:
description: "Relative filepath to file containing additional apt deb packages to install"
default: docker/additional-debs.txt
enable-recursive-additional-debs:
description: "Enable recursive discovery of files named `additional-debs-file`"
default: false
additional-files-dir:
description: "Relative path to directory containing additional files to copy into image"
default: docker/additional-files
additional-pip-file:
description: "Relative filepath to file containing additional pip packages to install"
default: docker/additional-pip-requirements.txt
enable-recursive-additional-pip:
description: "Enable recursive discovery of files named `additional-pip-file`"
default: false
blacklisted-packages-file:
description: "Relative filepath to file containing blacklisted packages to remove from workspace"
default: docker/blacklisted-packages.txt
enable-recursive-blacklisted-packages:
description: "Enable recursive discovery of files named `blacklisted-packages-file`"
default: false
custom-script-file:
description: "Relative filepath to script containing custom installation commands"
default: docker/custom.sh
enable-recursive-custom-script:
description: "Enable recursive discovery of files named `custom-script-file`"
default: false
enable-industrial-ci:
description: "Enable industrial_ci"
default: false
enable-singlearch-push:
description: "Enable push of single arch images with [-amd64|-arm64] postfix"
default: false
enable-push-as-latest:
description: "Push images with tag `latest`/`latest-dev` in addition to the configured image names"
default: false
runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Set up docker-ros
shell: bash
working-directory: ${{ inputs.build-context }}
run: |
if ! [[ -d "docker/docker-ros" ]]; then
mkdir -p docker
cp -r ${GITHUB_ACTION_PATH} docker/docker-ros
fi
- name: Prepare setup of QEMU
id: prepare-setup-of-qemu
shell: bash
run: echo "RUNNER_ARCH=$(dpkg --print-architecture)" >> $GITHUB_OUTPUT
- name: Set up QEMU
if: ${{ steps.prepare-setup-of-qemu.outputs.RUNNER_ARCH != inputs.platform }}
uses: docker/setup-qemu-action@v2
- name: Login to Docker registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.registry-user }}
password: ${{ inputs.registry-password }}
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2
- name: Build images
id: build-images
shell: bash
working-directory: ${{ inputs.build-context }}
run: docker/docker-ros/scripts/ci.sh
env:
PLATFORM: ${{ inputs.platform }}
TARGET: ${{ inputs.target }}
BASE_IMAGE: ${{ inputs.base-image }}
COMMAND: ${{ inputs.command }}
IMAGE_NAME: ${{ inputs.image-name }}
IMAGE_TAG: ${{ inputs.image-tag }}
DEV_IMAGE_NAME: ${{ inputs.dev-image-name }}
DEV_IMAGE_TAG: ${{ inputs.dev-image-tag }}
ROS_DISTRO: ${{ inputs.ros-distro }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }}
GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }}
GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }}
ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }}
ENABLE_RECURSIVE_ADDITIONAL_DEBS: ${{ inputs.enable-recursive-additional-debs }}
ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }}
ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }}
ENABLE_RECURSIVE_ADDITIONAL_PIP: ${{ inputs.enable-recursive-additional-pip }}
BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }}
ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: ${{ inputs.enable-recursive-blacklisted-packages }}
CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }}
ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }}
VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }}
ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }}
- name: Set up industrial_ci
if: ${{ inputs.enable-industrial-ci == 'true' }}
shell: bash
run: test -f ${{ inputs.build-context }}/.repos || echo "repositories:" > ${{ inputs.build-context }}/.repos
- name: Run industrial_ci
if: ${{ inputs.enable-industrial-ci == 'true' }}
uses: ros-industrial/industrial_ci@master
env:
UPSTREAM_WORKSPACE: ${{ inputs.build-context }}/.repos
TARGET_WORKSPACE: ${{ inputs.build-context }}
ADDITIONAL_DEBS: git
AFTER_INIT_EMBED: '[[ -n ${{ inputs.git-https-server }} ]] && git config --global url.https://${{ inputs.git-https-user }}:${{ inputs.git-https-password }}@${{ inputs.git-https-server }}.insteadOf https://${{ inputs.git-https-server }}'
SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }}
SSH_SERVER_HOSTKEYS: ${{ inputs.git-ssh-known-host-keys }}
DOCKER_RUN_OPTS: -u root:root
DOCKER_IMAGE: ${{ steps.build-images.outputs.INDUSTRIAL_CI_IMAGE }}
DOCKER_PULL: false
- name: Slugify ref name
id: slugify-ref-name
uses: gacts/github-slug@v1
with:
to-slug: ${{ github.ref_name }}
- name: Push images
shell: bash
working-directory: ${{ inputs.build-context }}
run: docker/docker-ros/scripts/ci.sh
env:
PLATFORM: ${{ inputs.platform }}
TARGET: ${{ inputs.target }}
BASE_IMAGE: ${{ inputs.base-image }}
COMMAND: ${{ inputs.command }}
IMAGE_NAME: ${{ inputs.image-name }}
IMAGE_TAG: ${{ inputs.image-tag }}
DEV_IMAGE_NAME: ${{ inputs.dev-image-name }}
DEV_IMAGE_TAG: ${{ inputs.dev-image-tag }}
ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }}
ROS_DISTRO: ${{ inputs.ros-distro }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }}
GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }}
GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }}
ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }}
ENABLE_RECURSIVE_ADDITIONAL_DEBS: ${{ inputs.enable-recursive-additional-debs }}
ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }}
ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }}
ENABLE_RECURSIVE_ADDITIONAL_PIP: ${{ inputs.enable-recursive-additional-pip }}
BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }}
ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: ${{ inputs.enable-recursive-blacklisted-packages }}
CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }}
ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }}
VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }}
ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }}
_ENABLE_IMAGE_PUSH: true
_IMAGE_POSTFIX: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && format('_{0}_ci', steps.slugify-ref-name.outputs.slug) || '' }}
- name: Push images (as latest)
if: ${{ inputs.enable-push-as-latest == 'true' }}
shell: bash
working-directory: ${{ inputs.build-context }}
run: docker/docker-ros/scripts/ci.sh
env:
PLATFORM: ${{ inputs.platform }}
TARGET: ${{ inputs.target }}
BASE_IMAGE: ${{ inputs.base-image }}
COMMAND: ${{ inputs.command }}
IMAGE_NAME: ${{ inputs.image-name }}
IMAGE_TAG: latest
DEV_IMAGE_NAME: ${{ inputs.dev-image-name }}
DEV_IMAGE_TAG: latest-dev
ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }}
ROS_DISTRO: ${{ inputs.ros-distro }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }}
GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }}
GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }}
ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }}
ENABLE_RECURSIVE_ADDITIONAL_DEBS: ${{ inputs.enable-recursive-additional-debs }}
ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }}
ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }}
ENABLE_RECURSIVE_ADDITIONAL_PIP: ${{ inputs.enable-recursive-additional-pip }}
BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }}
ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: ${{ inputs.enable-recursive-blacklisted-packages }}
CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }}
ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }}
VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }}
ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }}
_ENABLE_IMAGE_PUSH: true
_IMAGE_POSTFIX: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && format('_{0}_ci', steps.slugify-ref-name.outputs.slug) || '' }}