Rotate operator secrets into agenix and deepen caches
This commit is contained in:
parent
7039bf5aad
commit
03415e579b
28 changed files with 526 additions and 126 deletions
|
|
@ -602,6 +602,18 @@ if ! mkdir -p "/Users/runner/.cache/act" 2>/dev/null; then
|
|||
fi
|
||||
|
||||
export PATH="/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin:${PATH}"
|
||||
cache_root="${NSC_CACHE_PATH:-$HOME/.cache/burrow}"
|
||||
mkdir -p \
|
||||
"${cache_root}/bin" \
|
||||
"${cache_root}/downloads" \
|
||||
"${cache_root}/go/path" \
|
||||
"${cache_root}/go/mod" \
|
||||
"${cache_root}/go/build" \
|
||||
"${cache_root}/homebrew"
|
||||
export HOMEBREW_CACHE="${cache_root}/homebrew"
|
||||
export GOPATH="${cache_root}/go/path"
|
||||
export GOMODCACHE="${cache_root}/go/mod"
|
||||
export GOCACHE="${cache_root}/go/build"
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
echo "curl is required" >&2
|
||||
|
|
@ -622,14 +634,18 @@ export PATH="${PWD}/bin:${PATH}"
|
|||
|
||||
runner_version="v12.6.4"
|
||||
runner_src_tgz="forgejo-runner-${runner_version}.tar.gz"
|
||||
runner_src_tgz_path="${cache_root}/downloads/${runner_src_tgz}"
|
||||
runner_src_url="https://code.forgejo.org/forgejo/runner/archive/${runner_version}.tar.gz"
|
||||
runner_src_dir="forgejo-runner-src"
|
||||
runner_bin_cache="${cache_root}/bin/forgejo-runner-${runner_version}"
|
||||
|
||||
if ! command -v forgejo-runner >/dev/null 2>&1; then
|
||||
if [[ ! -x "${runner_bin_cache}" ]]; then
|
||||
rm -rf "${runner_src_dir}"
|
||||
mkdir -p "${runner_src_dir}"
|
||||
curl -fsSL "${runner_src_url}" -o "${runner_src_tgz}"
|
||||
tar -xzf "${runner_src_tgz}" -C "${runner_src_dir}" --strip-components=1
|
||||
if [[ ! -f "${runner_src_tgz_path}" ]]; then
|
||||
curl -fsSL "${runner_src_url}" -o "${runner_src_tgz_path}"
|
||||
fi
|
||||
tar -xzf "${runner_src_tgz_path}" -C "${runner_src_dir}" --strip-components=1
|
||||
|
||||
toolchain="$(grep -E '^toolchain ' "${runner_src_dir}/go.mod" | awk '{print $2}' | head -n 1 || true)"
|
||||
if [ -z "${toolchain}" ]; then
|
||||
|
|
@ -639,21 +655,23 @@ if ! command -v forgejo-runner >/dev/null 2>&1; then
|
|||
if ! command -v go >/dev/null 2>&1; then
|
||||
go_tgz="${toolchain}.darwin-arm64.tar.gz"
|
||||
go_url="https://go.dev/dl/${go_tgz}"
|
||||
curl -fsSL "${go_url}" -o "${go_tgz}"
|
||||
tar -xzf "${go_tgz}"
|
||||
go_tgz_path="${cache_root}/downloads/${go_tgz}"
|
||||
if [[ ! -f "${go_tgz_path}" ]]; then
|
||||
curl -fsSL "${go_url}" -o "${go_tgz_path}"
|
||||
fi
|
||||
tar -xzf "${go_tgz_path}"
|
||||
export GOROOT="${PWD}/go"
|
||||
export PATH="${GOROOT}/bin:${PATH}"
|
||||
fi
|
||||
|
||||
export GOPATH="${PWD}/.gopath"
|
||||
export GOMODCACHE="${PWD}/.gomodcache"
|
||||
export GOCACHE="${PWD}/.gocache"
|
||||
mkdir -p "${GOPATH}" "${GOMODCACHE}" "${GOCACHE}"
|
||||
|
||||
(cd "${runner_src_dir}" && go build -o "${workdir}/bin/forgejo-runner" .)
|
||||
chmod +x "${workdir}/bin/forgejo-runner"
|
||||
(cd "${runner_src_dir}" && go build -o "${runner_bin_cache}" .)
|
||||
chmod +x "${runner_bin_cache}"
|
||||
fi
|
||||
|
||||
ln -sf "${runner_bin_cache}" "${workdir}/bin/forgejo-runner"
|
||||
|
||||
cat > runner.yaml <<'EOF'
|
||||
log:
|
||||
level: info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue