diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index 2f792d6..7b18a4a 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -22,7 +22,7 @@ env: IMAGE_LABEL_REPO: ${{ github.repository }} SLUG: ${{ github.repository_owner }}/ubuntu DISTRO: ubuntu - NODE: '16 18' + NODE: '16 18 20' BUILD_REF: ${{ github.sha }} SKIP_TEST: false PUSH_GHCR: ${{ github.repository == (github.event.pull_request.head.repo.full_name || github.repository) && '1' || '' }} @@ -48,6 +48,7 @@ jobs: PLATFORMS: - linux/amd64,linux/arm64,linux/arm/v7 TAG: + - 24.04 - 22.04 - 20.04 steps: @@ -235,6 +236,7 @@ jobs: max-parallel: 8 matrix: TAG: + - 24.04 - 22.04 - 20.04 TYPE: diff --git a/linux/ubuntu/scripts/runner.sh b/linux/ubuntu/scripts/runner.sh index 7aefb5f..1f2cd93 100755 --- a/linux/ubuntu/scripts/runner.sh +++ b/linux/ubuntu/scripts/runner.sh @@ -3,28 +3,38 @@ set -Eeuxo pipefail +. /etc/os-release + printf "\n\tšŸ‹ Creating runner users šŸ‹\t\n" + +# Default admin user/group +RUNNERADMIN="${RUNNER}admin" + groupadd -g 1001 "${RUNNER}" -groupadd -g 1000 "${RUNNER}admin" +groupadd -g 1000 "${RUNNERADMIN}" || RUNNERADMIN="$(id -gn 1000)" # 24.04 has default user 'ubuntu' with id=1000 + useradd -u 1001 -g "${RUNNER}" -G sudo -m -s /bin/bash "${RUNNER}" -useradd -u 1000 -g "${RUNNER}admin" -G sudo -m -s /bin/bash "${RUNNER}admin" -usermod -aG docker "runner" -usermod -aG docker "runneradmin" +useradd -u 1000 -g "${RUNNERADMIN}" -G sudo -m -s /bin/bash "${RUNNERADMIN}" || true + +usermod -aG docker "${RUNNER}" +usermod -aG docker "${RUNNERADMIN}" + { echo "${RUNNER} ALL=(ALL) NOPASSWD: ALL" - echo "${RUNNER}admin ALL=(ALL) NOPASSWD: ALL" + echo "${RUNNERADMIN} ALL=(ALL) NOPASSWD: ALL" } | tee -a /etc/sudoers + printf "\n\tšŸ‹ Runner user šŸ‹\t\n" su - "${RUNNER}" -c id printf "\n\tšŸ‹ Runner admin šŸ‹\t\n" -su - "${RUNNER}admin" -c id +su - "${RUNNERADMIN}" -c id printf "\n\tšŸ‹ Created non-root user šŸ‹\t\n" grep "${RUNNER}" /etc/passwd printf "\n\tšŸ‹ Created non-root admin šŸ‹\t\n" -grep "${RUNNER}admin" /etc/passwd +grep "${RUNNERADMIN}" /etc/passwd sed -i /etc/environment -e "s/USER=root/USER=${RUNNER}/g" @@ -33,6 +43,7 @@ mkdir -p "/home/${RUNNER}/work/_temp" chown -R "${RUNNER}":"${RUNNER}" "/home/${RUNNER}/work" mkdir -m 0700 -p "/home/${RUNNER}/.ssh" + { ssh-keyscan -t rsa github.com ssh-keyscan -t rsa ssh.dev.azure.com @@ -45,6 +56,6 @@ chown -R "${RUNNER}":"${RUNNER}" "/home/${RUNNER}/.ssh" # Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?shellcheck(SC2140) # shellcheck disable=SC2140 -chown -R "${RUNNER}":"${RUNNER}admin" "$AGENT_TOOLSDIRECTORY" +chown -R "${RUNNER}":"${RUNNERADMIN}" "$AGENT_TOOLSDIRECTORY" printf "\n\tšŸ‹ Finished building šŸ‹\t\n"