Skip to content

Commit

Permalink
fix: resolve issues with the hook scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Klick <[email protected]>
  • Loading branch information
nathanklick committed Aug 9, 2024
1 parent 8c0297d commit 0282e1e
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ RUN apt-get update -y \
make \
wget \
gnupg2 \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ RUN apt-get update -y \
make \
wget \
gnupg2 \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
1 change: 1 addition & 0 deletions legacy/runner/actions-runner-dind.ubuntu-20.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ RUN apt-get update -y \
make \
wget \
gnupg2 \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
1 change: 1 addition & 0 deletions legacy/runner/actions-runner-dind.ubuntu-22.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ RUN apt-get update -y \
make \
wget \
gnupg2 \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
1 change: 1 addition & 0 deletions legacy/runner/actions-runner.ubuntu-20.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ RUN apt-get update -y \
make \
wget \
gnupg2 \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
1 change: 1 addition & 0 deletions legacy/runner/actions-runner.ubuntu-22.04.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ RUN apt-get update -y \
make \
wget \
gnupg2 \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion legacy/runner/hooks/job-completed.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -Eeuo pipefail

# shellcheck source=runner/logger.sh
# shellcheck source=../logger.sh
source logger.sh

log.debug "Running ARC Job Completed Hooks"
Expand Down
3 changes: 3 additions & 0 deletions legacy/runner/hooks/job-started.d/authorize-jfrog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
set +e
set -o pipefail

# shellcheck source=../../logger.sh
source logger.sh

if [[ -z "${RUNNER_JF_SERVER_URL}" ]]; then
log.info "Skipping JFrog authorization as RUNNER_JF_URL is not set."
exit 0
Expand Down
38 changes: 38 additions & 0 deletions legacy/runner/hooks/job-started.d/configure-buildkit-mirror
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set +e
set -o pipefail

# shellcheck source=../../logger.sh
source logger.sh

readonly BUILDKIT_MIRROR_CONFIG_FILE="/etc/docker/buildkitd.toml"

if [[ -z "${DOCKER_REGISTRY_MIRROR}" ]]; then
log.info "Skipping BuildKit mirror configuration as DOCKER_REGISTRY_MIRROR is not set."
exit 0
fi

function render_config() {
local mirror="${1}"

[[ -z "${mirror}" ]] && return 1

cat <<EOF
debug = true
[registry."docker.io"]
mirrors = ["${mirror}"]
EOF

return 0
}

log.debug "Writing BuildKit configuration file: ${BUILDKIT_MIRROR_CONFIG_FILE}"
render_config "${DOCKER_REGISTRY_MIRROR}" | sudo tee "${BUILDKIT_MIRROR_CONFIG_FILE}" > /dev/null
EC="${?}"

if [[ "${EC}" -ne 0 ]]; then
log.error "Failed to write BuildKit configuration file: ${BUILDKIT_MIRROR_CONFIG_FILE}"
exit "${EC}"
fi

log.info "Successfully configured BuildKit with docker registry mirror: ${DOCKER_REGISTRY_HOSTNAME}"
2 changes: 1 addition & 1 deletion legacy/runner/hooks/job-started.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -Eeuo pipefail

# shellcheck source=runner/logger.sh
# shellcheck source=../logger.sh
source logger.sh

log.debug "Running ARC Job Started Hooks"
Expand Down

0 comments on commit 0282e1e

Please sign in to comment.