From 6224ae9c1a0fae400ba0c8bf5a72d01a529ec259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=B6hrs?= Date: Thu, 19 Oct 2023 08:33:46 +0200 Subject: [PATCH] meta-lxatac-software: gitlab-runner: add recipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To configure a runner you have to into the CI/CD setting of your GitLab repository, and add a new project runner. After configuring a few aspects of the runner you are presented with a token to use on the TAC: root@lxatac:~ gitlab-runner register --url https://gitlab.com --token glrt-01234567899876543210 Signed-off-by: Leonard Göhrs --- .../recipes-core/bundles/files/hook.sh | 1 + .../images/lxatac-core-image-base.bb | 1 + .../gitlab-runner/files/gitlab-runner.service | 11 +++++++ .../gitlab-runner/gitlab-runner.inc | 30 +++++++++++++++++++ .../gitlab-runner/gitlab-runner_16.6.1.bb | 4 +++ 5 files changed, 47 insertions(+) create mode 100644 meta-lxatac-software/recipes-devtools/gitlab-runner/files/gitlab-runner.service create mode 100644 meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner.inc create mode 100644 meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner_16.6.1.bb diff --git a/meta-lxatac-software/recipes-core/bundles/files/hook.sh b/meta-lxatac-software/recipes-core/bundles/files/hook.sh index 1f158643..ccd81511 100644 --- a/meta-lxatac-software/recipes-core/bundles/files/hook.sh +++ b/meta-lxatac-software/recipes-core/bundles/files/hook.sh @@ -75,6 +75,7 @@ case "$1" in migrate /etc/labgrid/userconfig.yaml migrate /etc/github-act-runner/sessions.json migrate /etc/github-act-runner/settings.json + migrate /etc/gitlab-runner/config.toml for x in /etc/ssh/ssh_host*; do migrate "${x}" done diff --git a/meta-lxatac-software/recipes-core/images/lxatac-core-image-base.bb b/meta-lxatac-software/recipes-core/images/lxatac-core-image-base.bb index 5a9cfa28..c1dd4000 100644 --- a/meta-lxatac-software/recipes-core/images/lxatac-core-image-base.bb +++ b/meta-lxatac-software/recipes-core/images/lxatac-core-image-base.bb @@ -46,6 +46,7 @@ IMAGE_INSTALL:append = "\ gdbserver \ git \ github-act-runner \ + gitlab-runner \ gstreamer1.0 \ gstreamer1.0-plugins-bad-videoparsersbad \ gstreamer1.0-plugins-base \ diff --git a/meta-lxatac-software/recipes-devtools/gitlab-runner/files/gitlab-runner.service b/meta-lxatac-software/recipes-devtools/gitlab-runner/files/gitlab-runner.service new file mode 100644 index 00000000..f4faf108 --- /dev/null +++ b/meta-lxatac-software/recipes-devtools/gitlab-runner/files/gitlab-runner.service @@ -0,0 +1,11 @@ +[Unit] +Description=Schedule GitLab actions to run on this TAC +ConditionPathExists=/etc/gitlab-runner/config.toml + +[Service] +Type=simple +ExecStart=/usr/bin/gitlab-runner run +WorkingDirectory=/srv + +[Install] +WantedBy=multi-user.target diff --git a/meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner.inc b/meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner.inc new file mode 100644 index 00000000..b5972049 --- /dev/null +++ b/meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner.inc @@ -0,0 +1,30 @@ +SUMMARY = "GitLab Runner" +DESCRIPTION = "The Runner for GitLab Pipelines" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI:append = " file://gitlab-runner.service " + +GO_IMPORT = "gitlab.com/gitlab-org/gitlab-runner" +GO_INSTALL = "${GO_IMPORT}" + +RDEPENDS:gitlab-runner-dev = "bash" + +inherit go-mod +inherit systemd + +SYSTEMD_SERVICE:${PN} = "gitlab-runner.service" + +# This is required because the go build system fetches dependecies in the +# compile stage. +do_compile[network] = "1" + +# This is required to prevent build failures due to +# "duplicated definition of symbol" errors. +GO_LINKSHARED = "" + +do_install:append() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/gitlab-runner.service ${D}${systemd_system_unitdir}/ +} diff --git a/meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner_16.6.1.bb b/meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner_16.6.1.bb new file mode 100644 index 00000000..96749b19 --- /dev/null +++ b/meta-lxatac-software/recipes-devtools/gitlab-runner/gitlab-runner_16.6.1.bb @@ -0,0 +1,4 @@ +require gitlab-runner.inc + +SRC_URI = "git://gitlab.com/gitlab-org/gitlab-runner.git;branch=16-6-stable;protocol=https" +SRCREV = "f5da3c5adf55e55004e0dae2a2e1476f8407c087"