Prepare for GitHub migration #190

Merged
benvin merged 1 commits from benvin/github-migration into master 2026-11-28 18:41:49 +11:00
6 changed files with 126 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
* @IUCLabs/maintainers
+2
View File
@@ -0,0 +1,2 @@
self-hosted-runner:
labels: [iuclabs-k8s, iuclabs-build]
+28
View File
@@ -0,0 +1,28 @@
name: ci
on:
pull_request:
push:
branches: [main]
permissions: {}
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
ci:
uses: IUCLabs/workflows/.github/workflows/pre-commit.yml@v0.1.1
permissions:
contents: read
with:
runs_on: iuclabs-k8s
python_version: "3.11"
actions:
uses: IUCLabs/workflows/.github/workflows/actions.yml@v0.1.1
permissions:
contents: read
with:
runs_on: ubuntu-latest
+87
View File
@@ -0,0 +1,87 @@
# Build every rpms/* package missing from its artifactapi rpm-vendor-* repo, per distro; push to main uploads them.
name: publish
on:
pull_request:
push:
branches: [main]
permissions: {}
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
VAULT_ADDR: https://vault.service.consul:8200
ARTIFACTAPI: https://artifactapi.k8s.syd1.au.unkin.net
IMAGE: artifactapi.k8s.syd1.au.unkin.net/docker-internal/rpmbuilder:0.1.0-alma9
jobs:
build:
if: ${{ github.event_name != 'push' }}
runs-on: iuclabs-build
permissions:
contents: read
strategy:
fail-fast: false
matrix: &distros
include:
- { distro: almalinux/el9, repo: rpm-vendor-el9 }
- { distro: fedora/42, repo: rpm-vendor-f42 }
- { distro: fedora/43, repo: rpm-vendor-f43 }
- { distro: fedora/44, repo: rpm-vendor-f44 }
steps:
- &checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- &build
name: build rpms
env:
DISTRO: ${{ matrix.distro }}
run: |
docker run --rm --privileged -v "${GITHUB_WORKSPACE}:/src" -w /src "${IMAGE}" \
./tools/build build-all --distro "${DISTRO}" --buildah
find . -type f -name '*.rpm'
publish:
if: ${{ github.event_name == 'push' }}
runs-on: iuclabs-build
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix: *distros
steps:
- *checkout
- *build
# login after the build: vault tokens live 15m
- uses: hashicorp/vault-action@892a26828f195e65540a40b4768ae4571f51ebfc # v4.0.0
with:
url: ${{ env.VAULT_ADDR }}
method: jwt
path: jwt/github/iuclabs
role: rpmbuilder_publish
jwtGithubAudience: ${{ env.VAULT_ADDR }}
secrets: |
identity/oidc/token/artifactapi-writer token | ARTIFACTAPI_TOKEN
- name: upload rpms
env:
REPO: ${{ matrix.repo }}
run: |
set -euo pipefail
auth="${RUNNER_TEMP}/auth"
printf 'Authorization: Bearer %s\n' "${ARTIFACTAPI_TOKEN}" > "${auth}"
find . -type f -name '*.rpm' -print0 | while IFS= read -r -d '' rpm; do
file=$(basename "${rpm}")
# artifactapi has no HEAD route (405); probe the served Packages path.
code=$(curl -s --cacert /etc/vault-ca/ca.crt -o /dev/null -w '%{http_code}' "${ARTIFACTAPI}/api/v2/remotes/${REPO}/files/Packages/${file}" || true)
if [ "${code}" = 200 ]; then
echo "${file} already exists in ${REPO}; skipping"
continue
fi
curl -fsS --cacert /etc/vault-ca/ca.crt -X PUT "${ARTIFACTAPI}/api/v2/remotes/${REPO}/files/${file}" \
-H "Content-Type: application/x-rpm" -H @"${auth}" --data-binary @"${rpm}"
done
+7
View File
@@ -0,0 +1,7 @@
rules:
unpinned-uses:
config:
policies:
# shared workflows are pinned to their release tags
"IUCLabs/*": ref-pin
"*": hash-pin
+1 -1
View File
@@ -35,7 +35,7 @@ repos:
hooks:
- id: pytest
name: Run unit tests
entry: make test
entry: uv run --group dev pytest tests/ -q
language: system
types: [python]
pass_filenames: false