11 Commits
Author SHA1 Message Date
alessandrovitali 50f34a7de1 backup: add action.yml skeleton 2026-10-12 17:00:31 +02:00
alessandrovitali 5f0c3b1306 actions: move backup into feature branch 2026-10-12 16:58:51 +02:00
alessandrovitali 598259ae9b ci: fix gitea registry token user
build / build (push) Failing after 0s
2026-10-12 16:34:05 +02:00
alessandrovitali c8d0506315 build custom runner image (#5)
build / build (push) Failing after 0s
Reviewed-on: #5
2026-10-12 15:55:11 +02:00
alessandrovitali 43ad6c4033 ci: request docker socket for image builds 2026-10-12 15:41:15 +02:00
alessandrovitali ba56591416 images: pin digest and set image rebuild schedule 2026-10-12 15:31:39 +02:00
alessandrovitali c0399df117 actions: style 2026-10-12 03:59:11 +02:00
alessandrovitali d03a144566 image: install rsync 2026-10-12 03:55:35 +02:00
alessandrovitali 18b1fdb6b4 sops: guard SOPS re-download / overwrite 2026-10-12 03:49:40 +02:00
alessandrovitali c8186c43c3 images: add custom image which packages SOPS. update renovate and add publishing workflow 2026-10-12 03:41:40 +02:00
alessandrovitali 44a841af2e copy: fix miss
ing rsync not packaged in gitea/ubuntu-latest
2026-10-10 07:57:26 +02:00
8 changed files with 85 additions and 38 deletions

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
name: build
on:
push:
branches: [main]
paths:
- 'images/**'
- '.gitea/workflows/build.yml'
schedule:
- cron: '0 4 * * 0' ## weekly sunday 04:00 UTC rebuild
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- uses: actions/checkout@v7
- uses: docker/login-action@v3
with:
registry: git.studiovita.li
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: images/act
push: true
tags: git.studiovita.li/studio/actions:ubuntu-latest
+22
View File
@@ -0,0 +1,22 @@
## renovate: datasource=docker depName=docker.gitea.com/runner-images
FROM docker.gitea.com/runner-images:ubuntu-latest@sha256:0e62e56b382ebf485bff1e51a05cbe27c708545a2e91425467fd31eb3e249521
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends rsync; \
rm -rf /var/lib/apt/lists/*; \
rsync --version
## renovate: datasource=github-releases depName=getsops/sops
ARG SOPS_VERSION=v3.13.3
RUN set -eux; \
arch=$(dpkg --print-architecture); \
asset="sops-${SOPS_VERSION}.linux.${arch}"; \
url="https://github.com/getsops/sops/releases/download/${SOPS_VERSION}"; \
curl -fsSL -o "/tmp/$asset" "$url/$asset"; \
curl -fsSL -o /tmp/checksums.txt "$url/sops-${SOPS_VERSION}.checksums.txt"; \
(cd /tmp && grep " ${asset}$" checksums.txt | sha256sum -c -); \
install -m 0755 "/tmp/$asset" /usr/local/bin/sops; \
rm -f "/tmp/$asset" /tmp/checksums.txt; \
sops --version
+5
View File
@@ -0,0 +1,5 @@
# act runner image
Gitea / Forgejo Actions runner image based on `runner-images:ubuntu-latest` with the pinned, checksum-verified SOPS build installed, plus `rsync` from apt.
Built and pushed to `git.studiovita.li/studio/actions:ubuntu-latest` by the `build` workflow on push to `main`, weekly on a schedule (Sunday 04:00 cron), and on manual dispatch. The base image is pinned by digest so Renovate opens a PR whenever `runner-images:ubuntu-latest` changes; update `SOPS_VERSION` in `Dockerfile` to bump SOPS (both tracked in renovate.json).
+8
View File
@@ -13,6 +13,14 @@
"#+\\s*renovate:\\s*datasource=(?<datasource>[^\\s]+)\\s+depName=(?<depName>[^\\s]+)\\s+[A-Z0-9_]+\\s*:\\s*[\"']?(?<currentValue>[^\\s\"'#]+)[\"']?"
],
"description": "match any pinned dependency using SCREAMING_SNAKE_CASE naming as ENV"
},
{
"customType": "regex",
"managerFilePatterns": ["**/Dockerfile"],
"matchStrings": [
"#+\\s*renovate:\\s*datasource=(?<datasource>[^\\s]+)\\s+depName=(?<depName>[^\\s]+)[ \\t]*\\n[ \\t]*ARG\\s+[A-Z0-9_]+=(?<currentValue>[^\\s\"'#]+)"
],
"description": "match pinned ARG deps in Dockerfiles"
}
]
}
+1 -1
View File
@@ -2,4 +2,4 @@
generate new age keys with `age-keygen -o ~/.config/sops/age/key-name.txt`. encrypt local secrets with `sops -e service-name/.env > service-name/.sops.env`.
the action installs the pinned, checksum-verified SOPS build for the runner's OS/arch, caching it under `$RUNNER_TEMP/sops` keyed on the version and runner platform so later runs skip the download. it then decrypts every `*.sops.*` file except `.sops.yaml`, writing `service-name/.sops.env` back to `service-name/.env` via a temp file and atomic move.
the action installs the pinned, checksum-verified SOPS build for the runner's OS/arch (skipping the download when `sops` is already on `PATH`, e.g. on the custom `studio/actions:ubuntu-latest` runner image) and decrypts every `*.sops.*` file except `.sops.yaml`, writing `service-name/.sops.env` back to `service-name/.env` via a temp file and atomic move.
+6 -37
View File
@@ -1,5 +1,5 @@
name: decrypt SOPS secrets
description: installs SOPS and decrypts all *.sops.* files using an age key
description: installs SOPS if missing and decrypts all *.sops.* files using an age key
inputs:
sops-age-key:
@@ -9,7 +9,7 @@ inputs:
runs:
using: "composite"
steps:
- name: resolve SOPS target
- name: install SOPS
shell: bash
env:
## renovate: datasource=github-releases depName=getsops/sops
@@ -17,29 +17,11 @@ runs:
run: |
set -euo pipefail
command -v sops >/dev/null && exit 0
os=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
{
echo "SOPS_VERSION=$SOPS_VERSION"
echo "SOPS_OS=$os"
echo "SOPS_ARCH=$arch"
} >> "$GITHUB_ENV"
- name: restore cached SOPS
id: sops-cache
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/sops
key: sops-${{ runner.os }}-${{ runner.arch }}-${{ env.SOPS_VERSION }}
- name: install SOPS
if: steps.sops-cache.outputs.cache-hit != 'true'
shell: bash
run: |
set -euo pipefail
asset="sops-${SOPS_VERSION}.${SOPS_OS}.${SOPS_ARCH}"
asset="sops-${SOPS_VERSION}.${os}.${arch}"
url="https://github.com/getsops/sops/releases/download/${SOPS_VERSION}"
tmp=$(mktemp -d)
@@ -49,17 +31,8 @@ runs:
-o "$tmp/checksums.txt" "$url/sops-${SOPS_VERSION}.checksums.txt"
(cd "$tmp" && grep " ${asset}$" checksums.txt | shasum -a 256 -c -)
mkdir -p "$RUNNER_TEMP/sops"
chmod +x "$tmp/$asset"
mv "$tmp/$asset" "$RUNNER_TEMP/sops/sops"
- name: add SOPS to PATH
shell: bash
run: |
set -euo pipefail
chmod +x "$RUNNER_TEMP/sops/sops"
echo "$RUNNER_TEMP/sops" >> "$GITHUB_PATH"
sudo mv "$tmp/$asset" /usr/local/bin/sops
- name: decrypt .sops files
shell: bash
@@ -67,7 +40,6 @@ runs:
SOPS_AGE_KEY: ${{ inputs.sops-age-key }}
run: |
set -euo pipefail
echo "searching for SOPS files to decrypt..."
while IFS= read -r -d '' file; do
@@ -75,9 +47,7 @@ runs:
output_file="$dir/${base/.sops/}"
echo "decrypting '$file' to '$output_file'"
tmp=$(mktemp "$dir/.sops-decrypt.XXXXXX")
if ! sops --decrypt "$file" > "$tmp" || [ ! -s "$tmp" ]; then
echo "decryption of '$file' failed or produced empty output" >&2
rm -f "$tmp"
@@ -87,5 +57,4 @@ runs:
chmod 600 "$tmp"
mv "$tmp" "$output_file"
done < <(find . -type f -name "*.sops.*" -not -name ".sops.yaml" -print0)
echo "SOPS decryption complete."
+11
View File
@@ -24,6 +24,15 @@ inputs:
runs:
using: "composite"
steps:
- name: install rsync
shell: bash
run: |
set -euo pipefail
command -v rsync >/dev/null && exit 0
sudo apt-get -qq update
sudo apt-get -yqq install rsync
- name: setup ssh
shell: bash
env:
@@ -33,8 +42,10 @@ runs:
run: |
set -euo pipefail
mkdir -p ~/.ssh
printf '%s\n' "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p "$PORT" -H "$HOST" >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
+2
View File
@@ -30,8 +30,10 @@ runs:
run: |
set -euo pipefail
mkdir -p ~/.ssh
printf '%s\n' "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p "$PORT" -H "$HOST" >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts