Skip to content

Commit

Permalink
The CI container now uses the GitHub runner
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-manu committed Sep 22, 2024
1 parent 08aabc7 commit 239381d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
17 changes: 9 additions & 8 deletions ci/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ RUN \
apt-get update && \
: "Install tools and additional packages" && \
$APT_INSTALL virtualbox vagrant vagrant-libvirt libvirt-daemon-system dnsmasq packer qemu-system-x86 qemu-utils tini && \
: "Install CircleCI machine runner agent" && \
curl -s 'https://packagecloud.io/install/repositories/circleci/runner/script.deb.sh?any=true' | bash && \
${APT_INSTALL} circleci-runner && \
: "Install pkgproxy" && \
curl -L 'https://github.com/binary-manu/pkgproxy/releases/download/v2.0.1/pkgproxy' > "$PKGPROXY" && \
chmod a+x "$PKGPROXY" && \
: "Cleanup" && \
apt-get clean && apt-get autoremove --purge && \
rm -rf /var/lib/apt/lists/* && \
: "Fixup the home directory (if it already exists) so that we can keep our host UID and write to it" && \
chmod 1777 "$HOME" && \
: "Ensure qemu's bridge helper can be run with appropriate privileges" && \
mkdir -p /etc/qemu/ && echo "allow virbr0" > /etc/qemu/bridge.conf && \
chmod u+s /usr/lib/qemu/qemu-bridge-helper
chmod u+s /usr/lib/qemu/qemu-bridge-helper && \
: "Install GitHub runner agent" && \
curl -o ghrunner.tar.gz -L https://github.com/actions/runner/releases/download/v2.319.1/actions-runner-linux-x64-2.319.1.tar.gz && \
mkdir -p /opt/gh && tar -xzf ghrunner.tar.gz -C /opt/gh && rm ghrunner.tar.gz && \
chmod 0777 /opt/gh && /opt/gh/bin/installdependencies.sh && \
: "Cleanup" && \
apt-get clean && apt-get autoremove --purge && \
rm -rf /var/lib/apt/lists/*

COPY ./entry.sh /entry.sh
ENTRYPOINT ["/usr/bin/tini", "--", "/entry.sh"]
CMD ["/usr/bin/circleci-runner", "machine", "-c", "/etc/circleci-runner/circleci-runner-config.yaml"]
CMD ["/opt/gh/run.sh"]
1 change: 1 addition & 0 deletions ci/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ fi

cd
start-stop-daemon -b -m -p /tmp/pkgproxy.pid -O "$HOME/pkgproxy.log" -x "$PKGPROXY" -S -- -keep-cache
cp -v /config/.[a-z]* /opt/gh/
exec "$@"
6 changes: 2 additions & 4 deletions ci/start.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/sh

HERE="$(realpath "$(dirname "$0")")"
BASEDIR="$(realpath "$HERE/..")"
HOMEDIR="$(realpath "$HERE/storage")"
IMAGE="ghcr.io/binary-manu/arch-ansible-ci:circleci"
IMAGE="ghcr.io/binary-manu/arch-ansible-ci:github"
ADD_CAPS="NET_ADMIN,NET_RAW"
HOSTNAME="linux-runner"
KEEP_SUP_GROUPS="--annotation=run.oci.keep_original_groups=1"
Expand All @@ -29,8 +28,7 @@ podman run $FOREGROUND \
--user root \
--cap-add="$ADD_CAPS" \
--security-opt=unmask=/proc/sys \
-v "$BASEDIR:/src" \
-v "$HERE/config:/config" \
-v "$HOMEDIR:/home" \
-v "$HERE/config.yaml:/etc/circleci-runner/circleci-runner-config.yaml" \
$KEEP_SUP_GROUPS \
"$IMAGE" "$@"

0 comments on commit 239381d

Please sign in to comment.