From 7df63f21aaa4ef16a6d8c93ef0c8011ea4757fa5 Mon Sep 17 00:00:00 2001 From: Madison Grubb Date: Fri, 13 Mar 2026 11:17:38 -0400 Subject: [PATCH] fixes to imagen --- .gitattributes | 9 -------- .gitea/workflows/build.yml | 42 ++++++++++++++------------------------ Dockerfile | 2 -- README.md | 13 ++---------- build.sh | 25 ++++++----------------- scripts/act.sh | 22 +++----------------- scripts/yq.sh | 28 +++++++++++-------------- 7 files changed, 38 insertions(+), 103 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 9db8d11..0000000 --- a/.gitattributes +++ /dev/null @@ -1,9 +0,0 @@ -* text=auto eol=lf - -# scripts -*.sh text eol=lf -*.bat text eol=crlf - -## DOCKER -*.dockerignore text -Dockerfile text diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 582c3c3..de673ca 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -42,45 +42,33 @@ jobs: uses: https://git.keligrubb.com/actions/docker-login-action@v4 with: registry: ${{ env.REGISTRY }} - username: jasper-agent - password: ${{ secrets.JASPER_REPO_TOKEN }} + username: actions-runner + password: ${{ secrets.ACTIONS_REPO_TOKEN }} - name: Set up Docker Buildx uses: https://git.keligrubb.com/actions/docker-setup-buildx-action@v4 - name: Compute tags and metadata run: | - if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then - PART_TAG=$(date +%Y%m%d) - else - PART_TAG=dev - fi - echo "PART_TAG=$PART_TAG" >> "$GITHUB_ENV" - - if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then - RELEASE_TAG=$(lsb_release -rs) - else - RELEASE_TAG="${{ matrix.TAG }}" - fi - echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV" - - BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%SZ") - echo "BUILD_DATE=$BUILD_DATE" >> "$GITHUB_ENV" - + PART_TAG=$(date +%Y%m%d) TAG_NAME="act-${{ matrix.TAG }}" + RELEASE_TAG="${{ matrix.TAG }}" + BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%SZ") + + { + echo "PART_TAG=$PART_TAG" + echo "RELEASE_TAG=$RELEASE_TAG" + echo "BUILD_DATE=$BUILD_DATE" + echo "ACT_TEST_IMAGE=${{ env.REGISTRY }}/${{ env.SLUG }}:${TAG_NAME}-${PART_TAG}" + } >>"$GITHUB_ENV" + { echo "${TAG_NAME}-${PART_TAG}" - if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then - echo "act-latest-${PART_TAG}" - fi + [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ] && echo "act-latest-${PART_TAG}" echo "${TAG_NAME}" - if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then - echo "act-latest" - fi + [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ] && echo "act-latest" } > .tags - echo "ACT_TEST_IMAGE=${{ env.REGISTRY }}/${{ env.SLUG }}:${TAG_NAME}-${PART_TAG}" >> "$GITHUB_ENV" - - name: Build Docker image uses: https://git.keligrubb.com/actions/docker-build-push-action@v7 with: diff --git a/Dockerfile b/Dockerfile index ec809d8..de03ad7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,14 +9,12 @@ ARG TARGETARCH ARG FROM_IMAGE ARG FROM_TAG -# > Our custom ARGs # latest Node.js LTS versions ARG NODE_VERSION="20 24" ARG DISTRO=ubuntu ARG TYPE=act ARG RUNNER -# > Force apt to not be interactive/not ask ENV DEBIAN_FRONTEND=noninteractive SHELL [ "/bin/bash", "--login", "-e", "-o", "pipefail", "-c" ] diff --git a/README.md b/README.md index 71e9f02..ec633e2 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,7 @@ Built from [`scripts/act.sh`](./scripts/act.sh). Published to this repo’s Gite - **Registry:** `git.keligrubb.com` - **Image:** `git.keligrubb.com/actions/ubuntu` - **Tags:** `act-22.04`, `act-24.04`, `act-latest` (and dated tags e.g. `act-24.04-YYYYMMDD`) - -## When images are updated - -- Dependencies required for actions change -- Changes to GitHub Actions, Act, or the container registry -- Size or performance improvements +- **Base image:** `buildpack-deps` ([overview](https://hub.docker.com/_/buildpack-deps), [tags](https://hub.docker.com/_/buildpack-deps/tags), [source](https://github.com/docker-library/buildpack-deps)) ## Build locally @@ -76,11 +71,7 @@ act -P ubuntu-latest=git.keligrubb.com/actions/ubuntu:act-24.04 Or put the image in `.actrc` or your workflow’s `runs-on` image. -## Customising - -Edit [`scripts/act.sh`](./scripts/act.sh) to add or remove packages. Keep `DISTRO=ubuntu`, `TYPE=act`, and a valid `RUNNER` user, then re-run the build steps above. - -## Licence +## License Parts of this repository are from [actions/virtual-environments][actions/virtual-environments], used under the [MIT License](https://github.com/actions/virtual-environments/blob/main/LICENSE). diff --git a/build.sh b/build.sh index 9ac252d..2539f98 100755 --- a/build.sh +++ b/build.sh @@ -146,25 +146,12 @@ if [ -z "$from_image" ] || [ -z "$from_tag" ]; then exit 1 fi -if [ "$push" = true ]; then - # Combine tags and tag (if provided) - all_tags=$tags - if [ -n "$tag" ]; then - if [ -z "$all_tags" ]; then - all_tags=$tag - else - all_tags="$all_tags $tag" - fi - fi -else - # Even when not pushing, honor --tag so the local image is named. - all_tags=$tags - if [ -n "$tag" ]; then - if [ -z "$all_tags" ]; then - all_tags=$tag - else - all_tags="$all_tags $tag" - fi +all_tags=$tags +if [ -n "$tag" ]; then + if [ -z "$all_tags" ]; then + all_tags=$tag + else + all_tags="$all_tags $tag" fi fi diff --git a/scripts/act.sh b/scripts/act.sh index 0a89cd7..4b93319 100644 --- a/scripts/act.sh +++ b/scripts/act.sh @@ -145,28 +145,12 @@ for ver in "${NODE[@]}"; do done case "$(uname -m)" in - 'aarch64') - scripts=( - yq - ) - ;; - 'x86_64') - scripts=( - yq - ) - ;; - 'armv7l') - scripts=( - yq - ) - ;; + aarch64|x86_64|armv7l) ;; *) exit 1 ;; esac -for SCRIPT in "${scripts[@]}"; do - printf "\n\t🧨 Executing %s.sh 🧨\t\n" "${SCRIPT}" - bash "/imagegeneration/installers/${SCRIPT}.sh" -done +printf "\n\t🧨 Executing yq.sh 🧨\t\n" +bash "/imagegeneration/installers/yq.sh" printf "\n\t🐋 Cleaning image 🐋\t\n" apt-get clean diff --git a/scripts/yq.sh b/scripts/yq.sh index 5066782..2d9e7eb 100644 --- a/scripts/yq.sh +++ b/scripts/yq.sh @@ -27,20 +27,16 @@ download_with_retries() { get_hash_from_remote_file() { local url=$1 - local keywords=("$2" "$3") - local delimiter=${4:-' '} - local word_number=${5:-1} - local matching_line - matching_line=$(curl -fsSL "$url" | sed 's/ */ /g' | tr -d '`') - for keyword in "${keywords[@]}"; do - matching_line=$(echo "$matching_line" | grep "$keyword" || true) - done - matching_line=$(echo "$matching_line" | head -n1) - if [ -z "$matching_line" ]; then - echo "Keywords (${keywords[*]}) not found in the file with hashes." >&2 + local keyword=$2 + local delimiter=${3:-' '} + local word_number=${4:-1} + local line + line=$(curl -fsSL "$url" | sed 's/ */ /g' | tr -d '`' | grep "$keyword" | head -n1 || true) + if [ -z "$line" ]; then + echo "Keyword ($keyword) not found in the file with hashes." >&2 exit 1 fi - echo "$matching_line" | cut -d "$delimiter" -f "$word_number" | tr -d -c '[:alnum:]' + echo "$line" | cut -d "$delimiter" -f "$word_number" | tr -d -c '[:alnum:]' } use_checksum_comparison() { @@ -63,9 +59,9 @@ use_checksum_comparison() { yq_arch() { case "$(uname -m)" in - 'aarch64') echo 'arm64' ;; - 'x86_64') echo 'amd64' ;; - 'armv7l') echo 'arm' ;; + aarch64) echo arm64 ;; + x86_64) echo amd64 ;; + armv7l) echo arm ;; *) exit 1 ;; esac } @@ -73,6 +69,6 @@ yq_arch() { base_url="https://github.com/mikefarah/yq/releases/latest/download" filename="yq_linux_$(yq_arch)" download_with_retries "${base_url}/${filename}" "/tmp" "yq" -external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "${filename} " "" " " "19") +external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "${filename} " " " "19") use_checksum_comparison "/tmp/yq" "${external_hash}" sudo install /tmp/yq /usr/bin/yq