Skip to content

Commit

Permalink
Automatic x86 32-bit runner images
Browse files Browse the repository at this point in the history
Signed-off-by: Gergely Imreh <gergely@balena.io>
  • Loading branch information
Gergely Imreh committed May 22, 2019
1 parent a38c1a9 commit 1931679
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ with. These help setting up your first runner automatically:
project. Left empty defaults to `yes` (locked to a project), any other value
makes it default unlocked. You can also change this on your runner
configuration page.
* `GITLAB_RUNNER_HELPER_IMAGE`: *optional*, to set a different helper image to
use with the runner. For more information, check the [relevant GitLab logs][runner-helper].
This is a registration-time setting, so changing the value won't change an already registered
runner For x86 32-bit runners, GitLab doesn't provide runner helper images, but we have
some custom builds available at `imrehg/gitlab-runner-helper:i386-${CI_RUNNER_VERSION}`
and that value is automatically applied for 32-bit runners (such as Intel Edison).
It's custom work based on a patched version of the upstream GitLab runners (see the
[i386 branch of our fork][gitlab-runner-fork]), thus your milage may vary.

See more information at the [Configuring GitLab Runners docs][config]. The
configuration file is also available to edit.
Expand All @@ -79,5 +87,7 @@ balenaCloud) or `balena local ssh $UUID` (on openbalena), and check out
[docker-gc]: https://github.com/spotify/docker-gc/ "docker-gc on GitHub"
[forums]: https://forums.balena.io/t/gitlab-runner-on-balena-devices-for-continuous-integration-testing/5090
[getting started]: https://www.balena.io/docs/learn/getting-started/raspberrypi3/go/ "Raspberry Pi 3 - golang getting started"
[gitlab-runner-fork]: https://gitlab.com/imrehg/gitlab-runner/tree/i386 "GitLab Runners repo fork with i386 modifications"
[openbalena]: https://www.balena.io/open/ "openbalena home page"
[runners]: https://docs.gitlab.com/runner/ "GitLab Runner"
[runner-helper]: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#helper-image "Advanced configuration: Helper image"
19 changes: 19 additions & 0 deletions runner/start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# Set default i386 runner helper image, but available to be overriden
GITLAB_DEFAULT_I386_RUNNER_HELPER_IMAGE="imrehg/gitlab-runner-helper:i386-\${CI_RUNNER_VERSION}"
GITLAB_I386_RUNNER_HELPER_IMAGE="${GITLAB_I386_RUNNER_HELPER_IMAGE:-${GITLAB_DEFAULT_I386_RUNNER_HELPER_IMAGE}}"

function gitlab-runner-register-and-run() {
local REGISTER_ARGS=()

Expand All @@ -22,6 +26,21 @@ function gitlab-runner-register-and-run() {
REGISTER_ARGS+=(--docker-image "balenalib/${BALENA_DEVICE_TYPE}-debian")
fi

if [ -n "$GITLAB_RUNNER_HELPER_IMAGE" ]; then
REGISTER_ARGS+=(--docker-helper-image "${GITLAB_RUNNER_HELPER_IMAGE}")
else
# If no image supplied, check if we are on x86 (32-bit), as it needs custom image,
# as GitLab doesn't provide their own for this architecture at the moment
local arch
arch=$(uname -m)
case "${arch}" in
i?86)
REGISTER_ARGS+=(--docker-helper-image "${GITLAB_I386_RUNNER_HELPER_IMAGE}")
;;
esac
fi


# Collecting all the tags, tagging `docker` first, as that's the executor
local tags='docker,'
if [ "${TAG_ARCHITECTURE:-yes}" = "yes" ]; then
Expand Down

0 comments on commit 1931679

Please sign in to comment.