#!/usr/bin/env bash # Make sure the runner has what the pipeline shells out to: curl and jq always, # the AWS CLI only when bundles go to R2 through the S3 API (no # CUSTOM_APPS_WORKER_URL). Installs are apt-based, matching the runner image. set -euo pipefail . "$(dirname "$0")/lib.sh" # jq may not be here yet, so this step records itself at the end, back-dated. started="$(iso_now)"; t0="$(now_ms)" installed=() need_apt=() command -v curl >/dev/null || need_apt+=(curl) command -v jq >/dev/null || need_apt+=(jq) if [ "${#need_apt[@]}" -gt 0 ]; then log "Installing ${need_apt[*]}" apt-get update -qq && apt-get install -y -qq --no-install-recommends "${need_apt[@]}" >/dev/null installed+=("${need_apt[@]}") fi if [ -z "${CUSTOM_APPS_WORKER_URL:-}" ] && ! command -v aws >/dev/null; then log "Installing the AWS CLI (bundle upload goes to R2 over S3)" command -v unzip >/dev/null || { apt-get update -qq && apt-get install -y -qq --no-install-recommends unzip >/dev/null; } curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip unzip -q -o /tmp/awscliv2.zip -d /tmp /tmp/aws/install >/dev/null installed+=("the AWS CLI") fi echo "tools ready: curl $(curl --version | head -n1 | cut -d' ' -f2), jq $(jq --version)$( command -v aws >/dev/null && echo ", aws $(aws --version 2>&1 | cut -d' ' -f1)")" step_start tooling "$started" "$t0" if [ "${#installed[@]}" -gt 0 ]; then step_done tooling passed "installed $(printf '%s, ' "${installed[@]}" | sed 's/, $//')" else step_done tooling passed fi