From 7b8057e41707e6f88cabeb128a17f41339c7b724 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 12 Apr 2022 17:33:29 +0000 Subject: [PATCH 1/9] chore(deps): update dependency actions/runner to v2.290.0 --- .github/workflows/runners.yml | 2 +- runner/Dockerfile | 2 +- runner/Dockerfile.dindrunner | 2 +- runner/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/runners.yml b/.github/workflows/runners.yml index cce9b42e19..15d0d0f317 100644 --- a/.github/workflows/runners.yml +++ b/.github/workflows/runners.yml @@ -15,7 +15,7 @@ on: - '!**.md' env: - RUNNER_VERSION: 2.289.2 + RUNNER_VERSION: 2.290.0 DOCKER_VERSION: 20.10.12 DOCKERHUB_USERNAME: summerwind diff --git a/runner/Dockerfile b/runner/Dockerfile index 5b0b353ee7..08d72fb699 100644 --- a/runner/Dockerfile +++ b/runner/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:20.04 ARG TARGETPLATFORM -ARG RUNNER_VERSION=2.287.1 +ARG RUNNER_VERSION=2.290.0 ARG DOCKER_CHANNEL=stable ARG DOCKER_VERSION=20.10.12 ARG DUMB_INIT_VERSION=1.2.5 diff --git a/runner/Dockerfile.dindrunner b/runner/Dockerfile.dindrunner index c1c06e4950..8a65db28e1 100644 --- a/runner/Dockerfile.dindrunner +++ b/runner/Dockerfile.dindrunner @@ -1,7 +1,7 @@ FROM ubuntu:20.04 ARG TARGETPLATFORM -ARG RUNNER_VERSION=2.287.1 +ARG RUNNER_VERSION=2.290.0 ARG DOCKER_CHANNEL=stable ARG DOCKER_VERSION=20.10.12 ARG DUMB_INIT_VERSION=1.2.5 diff --git a/runner/Makefile b/runner/Makefile index 6ae921d6ef..e6a3fcdce5 100644 --- a/runner/Makefile +++ b/runner/Makefile @@ -4,7 +4,7 @@ DIND_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind TAG ?= latest TARGETPLATFORM ?= $(shell arch) -RUNNER_VERSION ?= 2.287.1 +RUNNER_VERSION ?= 2.290.0 DOCKER_VERSION ?= 20.10.12 # default list of platforms for which multiarch image is built From 8db071c4ba9f78ab11ede07948653cdae5b6ec0e Mon Sep 17 00:00:00 2001 From: Richard Fussenegger Date: Tue, 12 Apr 2022 23:02:06 +0200 Subject: [PATCH 2/9] Improved Bash Logger (#1246) * Improved Bash Logger This is a first step towards having robust Bash scripts in the runner images. The changes _could_ be considered breaking, depending on our backwards compatibility definition. * Fixed Log Formatting Issues Co-authored-by: Callum Tait <15716903+toast-gear@users.noreply.github.com> --- runner/Dockerfile | 6 ++- runner/Dockerfile.dindrunner | 10 ++--- runner/entrypoint.sh | 56 +++++++++++---------------- runner/logger.bash | 73 ++++++++++++++++++++++++++++++++++++ runner/logger.sh | 24 ------------ runner/modprobe | 0 runner/startup.sh | 35 +++++++++-------- 7 files changed, 121 insertions(+), 83 deletions(-) create mode 100755 runner/logger.bash delete mode 100644 runner/logger.sh mode change 100644 => 100755 runner/modprobe mode change 100644 => 100755 runner/startup.sh diff --git a/runner/Dockerfile b/runner/Dockerfile index 08d72fb699..935721ac2f 100644 --- a/runner/Dockerfile +++ b/runner/Dockerfile @@ -110,7 +110,9 @@ RUN mkdir /opt/hostedtoolcache \ && chgrp docker /opt/hostedtoolcache \ && chmod g+rwx /opt/hostedtoolcache -COPY entrypoint.sh / +# We place the scripts in `/usr/bin` so that users who extend this image can +# override them with scripts of the same name placed in `/usr/local/bin`. +COPY entrypoint.sh logger.bash /usr/bin/ # Add the Python "User Script Directory" to the PATH ENV PATH="${PATH}:${HOME}/.local/bin" @@ -122,4 +124,4 @@ RUN echo "PATH=${PATH}" > /etc/environment \ USER runner ENTRYPOINT ["/usr/local/bin/dumb-init", "--"] -CMD ["/entrypoint.sh"] +CMD ["entrypoint.sh"] diff --git a/runner/Dockerfile.dindrunner b/runner/Dockerfile.dindrunner index 8a65db28e1..1baa5076cf 100644 --- a/runner/Dockerfile.dindrunner +++ b/runner/Dockerfile.dindrunner @@ -97,13 +97,11 @@ ENV RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUN mkdir /opt/hostedtoolcache \ && chgrp docker /opt/hostedtoolcache \ && chmod g+rwx /opt/hostedtoolcache - -COPY modprobe startup.sh /usr/local/bin/ -COPY supervisor/ /etc/supervisor/conf.d/ -COPY logger.sh /opt/bash-utils/logger.sh -COPY entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/startup.sh /usr/local/bin/entrypoint.sh /usr/local/bin/modprobe +# We place the scripts in `/usr/bin` so that users who extend this image can +# override them with scripts of the same name placed in `/usr/local/bin`. +COPY modprobe entrypoint.sh startup.sh logger.bash /usr/bin/ +COPY supervisor/ /etc/supervisor/conf.d/ # arch command on OS X reports "i386" for Intel CPUs regardless of bitness RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ diff --git a/runner/entrypoint.sh b/runner/entrypoint.sh index 2eedfd3d20..f097703621 100755 --- a/runner/entrypoint.sh +++ b/runner/entrypoint.sh @@ -1,51 +1,35 @@ #!/bin/bash +source logger.bash RUNNER_ASSETS_DIR=${RUNNER_ASSETS_DIR:-/runnertmp} RUNNER_HOME=${RUNNER_HOME:-/runner} -LIGHTGREEN="\e[0;32m" -LIGHTRED="\e[0;31m" -WHITE="\e[0;97m" -RESET="\e[0m" - -log(){ - printf "${WHITE}${@}${RESET}\n" 1>&2 -} - -success(){ - printf "${LIGHTGREEN}${@}${RESET}\n" 1>&2 -} - -error(){ - printf "${LIGHTRED}${@}${RESET}\n" 1>&2 -} - if [ ! -z "${STARTUP_DELAY_IN_SECONDS}" ]; then - log "Delaying startup by ${STARTUP_DELAY_IN_SECONDS} seconds" + log.notice "Delaying startup by ${STARTUP_DELAY_IN_SECONDS} seconds" sleep ${STARTUP_DELAY_IN_SECONDS} fi if [[ "${DISABLE_WAIT_FOR_DOCKER}" != "true" ]] && [[ "${DOCKER_ENABLED}" == "true" ]]; then - log "Docker enabled runner detected and Docker daemon wait is enabled" - log "Waiting until Docker is available or the timeout is reached" + log.debug 'Docker enabled runner detected and Docker daemon wait is enabled' + log.debug 'Waiting until Docker is available or the timeout is reached' timeout 120s bash -c 'until docker ps ;do sleep 1; done' else - log "Docker wait check skipped. Either Docker is disabled or the wait is disabled, continuing with entrypoint" + log.notice 'Docker wait check skipped. Either Docker is disabled or the wait is disabled, continuing with entrypoint' fi if [ -z "${GITHUB_URL}" ]; then - log "Working with public GitHub" + log.debug 'Working with public GitHub' GITHUB_URL="https://github.com/" else length=${#GITHUB_URL} last_char=${GITHUB_URL:length-1:1} [[ $last_char != "/" ]] && GITHUB_URL="$GITHUB_URL/"; : - log "Github endpoint URL ${GITHUB_URL}" + log.debug "Github endpoint URL ${GITHUB_URL}" fi if [ -z "${RUNNER_NAME}" ]; then - error "RUNNER_NAME must be set" + log.error 'RUNNER_NAME must be set' exit 1 fi @@ -58,12 +42,12 @@ elif [ -n "${RUNNER_REPO}" ]; then elif [ -n "${RUNNER_ENTERPRISE}" ]; then ATTACH="enterprises/${RUNNER_ENTERPRISE}" else - error "At least one of RUNNER_ORG or RUNNER_REPO or RUNNER_ENTERPRISE must be set" + log.error 'At least one of RUNNER_ORG, RUNNER_REPO, or RUNNER_ENTERPRISE must be set' exit 1 fi if [ -z "${RUNNER_TOKEN}" ]; then - error "RUNNER_TOKEN must be set" + log.error 'RUNNER_TOKEN must be set' exit 1 fi @@ -73,7 +57,7 @@ fi # Hack due to https://github.com/actions-runner-controller/actions-runner-controller/issues/252#issuecomment-758338483 if [ ! -d "${RUNNER_HOME}" ]; then - error "${RUNNER_HOME} should be an emptyDir mount. Please fix the pod spec." + log.error "$RUNNER_HOME should be an emptyDir mount. Please fix the pod spec." exit 1 fi @@ -94,16 +78,16 @@ cd ${RUNNER_HOME} config_args=() if [ "${RUNNER_FEATURE_FLAG_EPHEMERAL:-}" == "true" -a "${RUNNER_EPHEMERAL}" == "true" ]; then config_args+=(--ephemeral) - echo "Passing --ephemeral to config.sh to enable the ephemeral runner." + log.debug 'Passing --ephemeral to config.sh to enable the ephemeral runner.' fi if [ "${DISABLE_RUNNER_UPDATE:-}" == "true" ]; then config_args+=(--disableupdate) - echo "Passing --disableupdate to config.sh to disable automatic runner updates." + log.debug 'Passing --disableupdate to config.sh to disable automatic runner updates.' fi retries_left=10 while [[ ${retries_left} -gt 0 ]]; do - log "Configuring the runner." + log.debug 'Configuring the runner.' ./config.sh --unattended --replace \ --name "${RUNNER_NAME}" \ --url "${GITHUB_URL}${ATTACH}" \ @@ -113,18 +97,18 @@ while [[ ${retries_left} -gt 0 ]]; do --work "${RUNNER_WORKDIR}" "${config_args[@]}" if [ -f .runner ]; then - success "Runner successfully configured." + log.debug 'Runner successfully configured.' break fi - error "Configuration failed. Retrying" + log.debug 'Configuration failed. Retrying' retries_left=$((retries_left - 1)) sleep 1 done if [ ! -f .runner ]; then # we couldn't configure and register the runner; no point continuing - error "Configuration failed!" + log.error 'Configuration failed!' exit 2 fi @@ -159,8 +143,10 @@ fi args=() if [ "${RUNNER_FEATURE_FLAG_EPHEMERAL:-}" != "true" -a "${RUNNER_EPHEMERAL}" == "true" ]; then args+=(--once) - echo "[WARNING] Passing --once is deprecated and will be removed as an option from the image and ARC at the release of 0.24.0." - echo "[WARNING] Upgrade to GHES => 3.3 to continue using actions-runner-controller. If you are using github.com ignore this warning." + log.warning 'Passing --once is deprecated and will be removed as an option' \ + 'from the image and actions-runner-controller at the release of 0.24.0.' \ + 'Upgrade to GHES => 3.3 to continue using actions-runner-controller. If' \ + 'you are using github.com ignore this warning.' fi # Unset entrypoint environment variables so they don't leak into the runner environment diff --git a/runner/logger.bash b/runner/logger.bash new file mode 100755 index 0000000000..5860306710 --- /dev/null +++ b/runner/logger.bash @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# We are not using `set -Eeuo pipefail` here because this file is sourced by +# other scripts that might not be ready for a strict Bash setup. The functions +# in this file do not require it, because they are not handling signals, have +# no external calls that can fail (printf as well as date failures are ignored), +# are not using any variables that need to be set, and are not using any pipes. + +# This logger implementation can be replaced with another logger implementation +# by placing a script called `logger.bash` in `/usr/local/bin` of the image. The +# only requirement for the script is that it defines the following functions: +# +# - `log.debug` +# - `log.notice` +# - `log.warning` +# - `log.error` +# - `log.success` +# +# Each function **MUST** accept an arbitrary amount of arguments that make up +# the (unstructured) logging message. +# +# Additionally the following environment variables **SHOULD** be supported to +# disable their corresponding log entries, the value of the variables **MUST** +# not matter the mere fact that they are set is all that matters: +# +# - `LOG_DEBUG_DISABLED` +# - `LOG_NOTICE_DISABLED` +# - `LOG_WARNING_DISABLED` +# - `LOG_ERROR_DISABLED` +# - `LOG_SUCCESS_DISABLED` + +# The log format is constructed in a way that it can easily be parsed with +# standard tools and simple string manipulations; pattern and example: +# +# YYYY-MM-DD hh:mm:ss.SSS $level --- $message +# 2022-03-19 10:01:23.172 NOTICE --- example message +# +# This function is an implementation detail and **MUST NOT** be called from +# outside this script (which is possible if the file is sourced). +__log() { + local color instant level + + color=${1:?missing required argument} + shift + + level=${FUNCNAME[1]} # `main` if called from top-level + level=${level#log.} # substring after `log.` + level=${level^^} # UPPERCASE + + if [[ ! -v "LOG_${level}_DISABLED" ]]; then + instant=$(date '+%F %T.%-3N' 2>/dev/null || :) + + # https://no-color.org/ + if [[ -v NO_COLOR ]]; then + printf -- '%s %s --- %s\n' "$instant" "$level" "$*" 1>&2 || : + else + printf -- '\033[0;%dm%s %s --- %s\033[0m\n' "$color" "$instant" "$level" "$*" 1>&2 || : + fi + fi +} + +# To log with a dynamic level use standard Bash capabilities: +# +# level=notice +# command || level=error +# "log.$level" message +# +# @formatter:off +log.debug () { __log 37 "$@"; } # white +log.notice () { __log 34 "$@"; } # blue +log.warning () { __log 33 "$@"; } # yellow +log.error () { __log 31 "$@"; } # red +log.success () { __log 32 "$@"; } # green +# @formatter:on diff --git a/runner/logger.sh b/runner/logger.sh deleted file mode 100644 index 6fc0f7e022..0000000000 --- a/runner/logger.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Logger from this post http://www.cubicrace.com/2016/03/log-tracing-mechnism-for-shell-scripts.html - -function INFO(){ - local function_name="${FUNCNAME[1]}" - local msg="$1" - timeAndDate=`date` - echo "[$timeAndDate] [INFO] [${0}] $msg" -} - - -function DEBUG(){ - local function_name="${FUNCNAME[1]}" - local msg="$1" - timeAndDate=`date` - echo "[$timeAndDate] [DEBUG] [${0}] $msg" -} - -function ERROR(){ - local function_name="${FUNCNAME[1]}" - local msg="$1" - timeAndDate=`date` - echo "[$timeAndDate] [ERROR] $msg" -} diff --git a/runner/modprobe b/runner/modprobe old mode 100644 new mode 100755 diff --git a/runner/startup.sh b/runner/startup.sh old mode 100644 new mode 100755 index 6b79c49d42..6352a0d5f3 --- a/runner/startup.sh +++ b/runner/startup.sh @@ -1,13 +1,13 @@ #!/bin/bash -source /opt/bash-utils/logger.sh +source logger.bash function wait_for_process () { local max_time_wait=30 local process_name="$1" local waited_sec=0 while ! pgrep "$process_name" >/dev/null && ((waited_sec < max_time_wait)); do - INFO "Process $process_name is not running yet. Retrying in 1 seconds" - INFO "Waited $waited_sec seconds of $max_time_wait seconds" + log.debug "Process $process_name is not running yet. Retrying in 1 seconds" + log.debug "Waited $waited_sec seconds of $max_time_wait seconds" sleep 1 ((waited_sec=waited_sec+1)) if ((waited_sec >= max_time_wait)); then @@ -33,29 +33,32 @@ jq ".\"registry-mirrors\"[0] = \"${DOCKER_REGISTRY_MIRROR}\"" /etc/docker/daemon fi SCRIPT -INFO "Using /etc/docker/daemon.json with the following content" - -cat /etc/docker/daemon.json - -INFO "Using /etc/supervisor/conf.d/dockerd.conf with the following content" +dump() { + local path=${1:?missing required argument} + shift + printf -- "%s\n---\n" "${*//\{path\}/"$path"}" 1>&2 + cat "$path" 1>&2 + printf -- '---\n' 1>&2 +} -cat /etc/supervisor/conf.d/dockerd.conf +for config in /etc/docker/daemon.json /etc/supervisor/conf.d/dockerd.conf; do + dump "$config" 'Using {path} with the following content:' +done -INFO "Starting supervisor" +log.debug 'Starting supervisor daemon' sudo /usr/bin/supervisord -n >> /dev/null 2>&1 & -INFO "Waiting for processes to be running" +log.debug 'Waiting for processes to be running...' processes=(dockerd) for process in "${processes[@]}"; do wait_for_process "$process" if [ $? -ne 0 ]; then - ERROR "$process is not running after max time" - ERROR "Dumping /var/log/dockerd.err.log to help investigation" - cat /var/log/dockerd.err.log + log.error "$process is not running after max time" + dump /var/log/dockerd.err.log 'Dumping {path} to aid investigation' exit 1 - else - INFO "$process is running" + else + log.debug "$process is running" fi done From 4a3b7bc8d53404609ff8db79432567863e52656c Mon Sep 17 00:00:00 2001 From: Callum Tait <15716903+toast-gear@users.noreply.github.com> Date: Tue, 12 Apr 2022 22:18:34 +0100 Subject: [PATCH 3/9] refactor: location of some runner cmds (#1337) Co-authored-by: toast-gear --- runner/Dockerfile | 2 +- runner/Dockerfile.dindrunner | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runner/Dockerfile b/runner/Dockerfile index 935721ac2f..441a939926 100644 --- a/runner/Dockerfile +++ b/runner/Dockerfile @@ -66,7 +66,6 @@ RUN set -vx; \ && usermod -aG docker runner \ && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers -ENV RUNNER_ASSETS_DIR=/runnertmp ENV HOME=/home/runner # Uncomment the below COPY to use your own custom build of actions-runner. @@ -92,6 +91,7 @@ ENV HOME=/home/runner # libyaml-dev is required for ruby/setup-ruby action. # It is installed after installdependencies.sh and before removing /var/lib/apt/lists # to avoid rerunning apt-update on its own. +ENV RUNNER_ASSETS_DIR=/runnertmp RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ && if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x64 ; fi \ && mkdir -p "$RUNNER_ASSETS_DIR" \ diff --git a/runner/Dockerfile.dindrunner b/runner/Dockerfile.dindrunner index 1baa5076cf..6e196c1c12 100644 --- a/runner/Dockerfile.dindrunner +++ b/runner/Dockerfile.dindrunner @@ -74,7 +74,6 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ dockerd --version; \ docker --version -ENV RUNNER_ASSETS_DIR=/runnertmp ENV HOME=/home/runner # Runner download supports amd64 as x64 @@ -82,6 +81,7 @@ ENV HOME=/home/runner # libyaml-dev is required for ruby/setup-ruby action. # It is installed after installdependencies.sh and before removing /var/lib/apt/lists # to avoid rerunning apt-update on its own. +ENV RUNNER_ASSETS_DIR=/runnertmp RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ && if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x64 ; fi \ && mkdir -p "$RUNNER_ASSETS_DIR" \ From c4ff1a588fc1884b846a1c15eee7bcf6cca956ed Mon Sep 17 00:00:00 2001 From: Callum Tait <15716903+toast-gear@users.noreply.github.com> Date: Wed, 13 Apr 2022 00:29:49 +0100 Subject: [PATCH 4/9] chore: migrate to actions stale bot (#1334) Co-authored-by: toast-gear --- .github/stale.yml | 67 ------------------------------------ .github/workflows/stale.yaml | 19 ++++++++++ 2 files changed, 19 insertions(+), 67 deletions(-) delete mode 100644 .github/stale.yml create mode 100644 .github/workflows/stale.yaml diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index cf35b458b5..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,67 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Number of days of inactivity before an Issue or Pull Request becomes stale -daysUntilStale: 30 - -# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. -# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 14 - -# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) -onlyLabels: [] - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - pinned - - security - - enhancement - - refactor - - documentation - - chore - - bug - - dependencies - - needs-investigation - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: false - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: false - -# Set to true to ignore issues with an assignee (defaults to false) -exemptAssignees: false - -# Label to use when marking as stale -staleLabel: stale - -# Comment to post when marking as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - -# Comment to post when removing the stale label. -# unmarkComment: > -# Your comment here. - -# Comment to post when closing a stale Issue or Pull Request. -# closeComment: > -# Your comment here. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 - -# Limit to only `issues` or `pulls` -# only: issues - -# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': -# pulls: -# daysUntilStale: 30 -# markComment: > -# This pull request has been automatically marked as stale because it has not had -# recent activity. It will be closed if no further activity occurs. Thank you -# for your contributions. - -# issues: -# exemptLabels: -# - confirmed diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml new file mode 100644 index 0000000000..a533f1a081 --- /dev/null +++ b/.github/workflows/stale.yaml @@ -0,0 +1,19 @@ +name: 'Close stale issues and PRs' +on: + schedule: + # 01:30 every day + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + # turn off stale for both issues and PRs + days-before-stale: -1 + # turn stale back on for issues only + days-before-issue-stale: 30 + days-before-issue-close: 14 + exempt-issue-labels: 'pinned,security,enhancement,refactor,documentation,chore,bug,dependencies,needs-investigation' From a37b4dfbe3fd8ec9008bc5a0ca04b09aedbb4754 Mon Sep 17 00:00:00 2001 From: Siyuan Zhang Date: Wed, 13 Apr 2022 07:53:07 +0800 Subject: [PATCH 5/9] Fix scale down condition to exclude skipped (#1330) * Fix scale down condition to exclude skipped * Use fallthrough and break to let default handle the skipped case Fixes #1326 --- .../horizontal_runner_autoscaler_webhook.go | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/controllers/horizontal_runner_autoscaler_webhook.go b/controllers/horizontal_runner_autoscaler_webhook.go index 7bf1e44db9..1d5d2c145d 100644 --- a/controllers/horizontal_runner_autoscaler_webhook.go +++ b/controllers/horizontal_runner_autoscaler_webhook.go @@ -242,18 +242,23 @@ func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.Respons enterpriseSlug, labels, ) + if target == nil { + break + } - if target != nil { - if e.GetAction() == "queued" { - target.Amount = 1 - } else if e.GetAction() == "completed" { - // A nagative amount is processed in the tryScale func as a scale-down request, - // that erasese the oldest CapacityReservation with the same amount. - // If the first CapacityReservation was with Replicas=1, this negative scale target erases that, - // so that the resulting desired replicas decreases by 1. - target.Amount = -1 - } + if e.GetAction() == "queued" { + target.Amount = 1 + break + } else if e.GetAction() == "completed" && e.GetWorkflowJob().GetConclusion() != "skipped" { + // A nagative amount is processed in the tryScale func as a scale-down request, + // that erasese the oldest CapacityReservation with the same amount. + // If the first CapacityReservation was with Replicas=1, this negative scale target erases that, + // so that the resulting desired replicas decreases by 1. + target.Amount = -1 + break } + // If the conclusion is "skipped", we will ignore it and fallthrough to the default case. + fallthrough default: ok = true From 6288036ed49cb7d9e9c62b53b66f0d93a66de6fe Mon Sep 17 00:00:00 2001 From: Richard Fussenegger Date: Wed, 13 Apr 2022 10:39:55 +0200 Subject: [PATCH 6/9] Removed `modprobe` Script (#1247) [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removed `modprobe` Script I was able to find out that this script originates from https://github.com/docker-library/docker/blob/master/modprobe.sh but our image does not have `lsmod` nor `modprobe` installed. Hence, if it were in use, it would fail every time. 🤔 * fix: correct command order Co-authored-by: toast-gear --- runner/Dockerfile.dindrunner | 3 ++- runner/modprobe | 21 --------------------- 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100755 runner/modprobe diff --git a/runner/Dockerfile.dindrunner b/runner/Dockerfile.dindrunner index 6e196c1c12..8b3e071cba 100644 --- a/runner/Dockerfile.dindrunner +++ b/runner/Dockerfile.dindrunner @@ -100,8 +100,9 @@ RUN mkdir /opt/hostedtoolcache \ # We place the scripts in `/usr/bin` so that users who extend this image can # override them with scripts of the same name placed in `/usr/local/bin`. -COPY modprobe entrypoint.sh startup.sh logger.bash /usr/bin/ +COPY entrypoint.sh logger.bash startup.sh /usr/bin/ COPY supervisor/ /etc/supervisor/conf.d/ +RUN chmod +x /usr/bin/startup.sh /usr/bin/entrypoint.sh # arch command on OS X reports "i386" for Intel CPUs regardless of bitness RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ diff --git a/runner/modprobe b/runner/modprobe deleted file mode 100755 index 4d58c9d773..0000000000 --- a/runner/modprobe +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -eu - -# "modprobe" without modprobe -# https://twitter.com/lucabruno/status/902934379835662336 - -# this isn't 100% fool-proof, but it'll have a much higher success rate than simply using the "real" modprobe - -# Docker often uses "modprobe -va foo bar baz" -# so we ignore modules that start with "-" -for module; do - if [ "${module#-}" = "$module" ]; then - ip link show "$module" || true - lsmod | grep "$module" || true - fi -done - -# remove /usr/local/... from PATH so we can exec the real modprobe as a last resort -export PATH='/usr/sbin:/usr/bin:/sbin:/bin' -exec modprobe "$@" From 352e2061480329f223e1557665635fe7b622e09b Mon Sep 17 00:00:00 2001 From: Callum Tait <15716903+toast-gear@users.noreply.github.com> Date: Wed, 13 Apr 2022 09:40:15 +0100 Subject: [PATCH 7/9] refactor: use apt-get instead of apt (#1342) Co-authored-by: toast-gear --- runner/Dockerfile | 6 +++--- runner/Dockerfile.dindrunner | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runner/Dockerfile b/runner/Dockerfile index 441a939926..e839960fd0 100644 --- a/runner/Dockerfile +++ b/runner/Dockerfile @@ -10,10 +10,10 @@ RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false) ENV DEBIAN_FRONTEND=noninteractive RUN apt update -y \ - && apt install -y software-properties-common \ + && apt-get install -y software-properties-common \ && add-apt-repository -y ppa:git-core/ppa \ - && apt update -y \ - && apt install -y --no-install-recommends \ + && apt-get update -y \ + && apt-get install -y --no-install-recommends \ build-essential \ curl \ ca-certificates \ diff --git a/runner/Dockerfile.dindrunner b/runner/Dockerfile.dindrunner index 8b3e071cba..94382cc5e2 100644 --- a/runner/Dockerfile.dindrunner +++ b/runner/Dockerfile.dindrunner @@ -10,10 +10,10 @@ RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false) ENV DEBIAN_FRONTEND=noninteractive RUN apt update -y \ - && apt install -y software-properties-common \ + && apt-get install -y software-properties-common \ && add-apt-repository -y ppa:git-core/ppa \ - && apt update -y \ - && apt install -y --no-install-recommends \ + && apt-get update -y \ + && apt-get install -y --no-install-recommends \ build-essential \ curl \ ca-certificates \ From 3b48db0d26b3f5955bab85856a309c574e5b77bc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Apr 2022 09:42:27 +0100 Subject: [PATCH 8/9] chore(deps): update actions/stale action to v5 (#1338) Co-authored-by: Renovate Bot --- .github/workflows/stale.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index a533f1a081..927cf6724c 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v4 + - uses: actions/stale@v5 with: stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' # turn off stale for both issues and PRs From 81951780b10577d645b3ab9f5cb27c6f80134676 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 14 Apr 2022 15:18:22 +0000 Subject: [PATCH 9/9] chore(deps): update dependency actions/runner to v2.290.1 --- .github/workflows/runners.yml | 2 +- runner/Dockerfile | 2 +- runner/Dockerfile.dindrunner | 2 +- runner/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/runners.yml b/.github/workflows/runners.yml index 15d0d0f317..73637bd137 100644 --- a/.github/workflows/runners.yml +++ b/.github/workflows/runners.yml @@ -15,7 +15,7 @@ on: - '!**.md' env: - RUNNER_VERSION: 2.290.0 + RUNNER_VERSION: 2.290.1 DOCKER_VERSION: 20.10.12 DOCKERHUB_USERNAME: summerwind diff --git a/runner/Dockerfile b/runner/Dockerfile index e839960fd0..361d0a1014 100644 --- a/runner/Dockerfile +++ b/runner/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:20.04 ARG TARGETPLATFORM -ARG RUNNER_VERSION=2.290.0 +ARG RUNNER_VERSION=2.290.1 ARG DOCKER_CHANNEL=stable ARG DOCKER_VERSION=20.10.12 ARG DUMB_INIT_VERSION=1.2.5 diff --git a/runner/Dockerfile.dindrunner b/runner/Dockerfile.dindrunner index 94382cc5e2..f37f44f81a 100644 --- a/runner/Dockerfile.dindrunner +++ b/runner/Dockerfile.dindrunner @@ -1,7 +1,7 @@ FROM ubuntu:20.04 ARG TARGETPLATFORM -ARG RUNNER_VERSION=2.290.0 +ARG RUNNER_VERSION=2.290.1 ARG DOCKER_CHANNEL=stable ARG DOCKER_VERSION=20.10.12 ARG DUMB_INIT_VERSION=1.2.5 diff --git a/runner/Makefile b/runner/Makefile index e6a3fcdce5..1d9c039fc4 100644 --- a/runner/Makefile +++ b/runner/Makefile @@ -4,7 +4,7 @@ DIND_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind TAG ?= latest TARGETPLATFORM ?= $(shell arch) -RUNNER_VERSION ?= 2.290.0 +RUNNER_VERSION ?= 2.290.1 DOCKER_VERSION ?= 20.10.12 # default list of platforms for which multiarch image is built