Move CI to Gitea Actions
Check recipes / Bump guard (push) Skipped
Check recipes / Bump guard (pull_request) Skipped
Check recipes / Version format (push) Failing after 4s
Check recipes / Parameters (push) Successful in 8s
Check recipes / Listing images (push) Successful in 5s
Check recipes / Docker Compose test (push) Successful in 4s
Check recipes / Cottage checks (push) Failing after 28s
Check recipes / Version format (pull_request) Failing after 4s
Check recipes / Listing images (pull_request) Successful in 7s
Check recipes / Parameters (pull_request) Successful in 10s
Check recipes / Docker Compose test (pull_request) Successful in 5s
Check recipes / Cottage checks (pull_request) Failing after 30s
Check recipes / Bump guard (push) Skipped
Check recipes / Bump guard (pull_request) Skipped
Check recipes / Version format (push) Failing after 4s
Check recipes / Parameters (push) Successful in 8s
Check recipes / Listing images (push) Successful in 5s
Check recipes / Docker Compose test (push) Successful in 4s
Check recipes / Cottage checks (push) Failing after 28s
Check recipes / Version format (pull_request) Failing after 4s
Check recipes / Listing images (pull_request) Successful in 7s
Check recipes / Parameters (pull_request) Successful in 10s
Check recipes / Docker Compose test (pull_request) Successful in 5s
Check recipes / Cottage checks (pull_request) Failing after 30s
Workflows live in .gitea/workflows. The bump bot opens its pull requests through the Gitea API with a bot access token, and the platform check clones Harbor from git.cottage.host over SSH.
This commit is contained in:
1 parent
9c1093e736
commit
2f8d76ac00
5 files changed
+80
-38
No files matched your search
@@ -1,27 +0,0 @@
|
||||
name: Bump recipes
|
||||
# Opens one pull request per recipe whose upstream has a newer stable release (scripts/bump.py).
|
||||
# Pull requests opened with the default GITHUB_TOKEN don't start other workflows, so the run
|
||||
# signs in as the "Cottage catalog bot" GitHub App (installed on this repository only, contents
|
||||
# and pull-requests write): the BUMP_APP_ID variable and the BUMP_APP_KEY secret (its private key).
|
||||
on:
|
||||
schedule: [{ cron: "17 6 * * *" }]
|
||||
workflow_dispatch:
|
||||
permissions: { contents: write, pull-requests: write }
|
||||
jobs:
|
||||
bump:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: app
|
||||
with:
|
||||
app-id: ${{ vars.BUMP_APP_ID }}
|
||||
private-key: ${{ secrets.BUMP_APP_KEY }}
|
||||
- uses: actions/checkout@v4
|
||||
with: { fetch-depth: 0, token: "${{ steps.app.outputs.token }}" }
|
||||
- run: pip install --quiet pyyaml
|
||||
- name: Open bump pull requests
|
||||
env: { GH_TOKEN: "${{ steps.app.outputs.token }}" }
|
||||
run: |
|
||||
git config user.name "cottage-catalog-bot[bot]"
|
||||
git config user.email "5885297+cottage-catalog-bot[bot]@users.noreply.github.com"
|
||||
python3 scripts/bump.py run
|
||||
@@ -1,134 +0,0 @@
|
||||
name: Check recipes
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch: # tests every recipe
|
||||
permissions: { contents: read }
|
||||
jobs:
|
||||
# The same test contributors run locally: each recipe with Docker Compose, until its health
|
||||
# path answers 200. Pull requests and pushes test the recipes they change; a manual run tests
|
||||
# all of them. Runs on every pull request, forks included.
|
||||
# Versions must be numbers separated by dots, then -c<revision> (e.g. 1.34.3-c1): the
|
||||
# platform rejects anything else and compares them to decide automatic updates.
|
||||
versions:
|
||||
name: Version format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check every recipe's version
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import glob, re, sys, yaml
|
||||
bad = []
|
||||
for p in sorted(glob.glob("apps/*/template.yml")):
|
||||
v = str((yaml.safe_load(open(p)).get("x-harbor") or {}).get("version", ""))
|
||||
if not re.fullmatch(r"[0-9]+(\.[0-9]+)*-c[1-9][0-9]*", v):
|
||||
bad.append(f"{p}: version {v!r} must look like 1.34.3-c1 (numbers and dots, then -c<revision>)")
|
||||
print("\n".join(bad) or "all versions OK")
|
||||
sys.exit(1 if bad else 0)
|
||||
PY
|
||||
|
||||
# Automatic bump branches may only change versions, image tags and digests, and never an image's
|
||||
# repository, so they can't widen what the platform's image allowlist accepts.
|
||||
bump-guard:
|
||||
name: Bump guard
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'bump/')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: { fetch-depth: 0 }
|
||||
- run: pip install --quiet pyyaml
|
||||
- run: python3 scripts/bump.py guard "origin/${{ github.base_ref }}"
|
||||
|
||||
# Parameters follow schema/cottage.schema.json ($defs/parameter), and recipes that send mail
|
||||
# use the shared SMTP_* fields in group "email".
|
||||
parameters:
|
||||
name: Parameters
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: pip install --quiet jsonschema pyyaml
|
||||
- run: python3 .github/check-parameters.py
|
||||
- run: python3 .github/check-listings.py
|
||||
- run: python3 .github/check-readmes.py
|
||||
|
||||
# Cottage skips a recipe at sync time if its template runs an image the listing has no
|
||||
# digest for, so catch that here.
|
||||
listing-images:
|
||||
name: Listing images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: pip install --quiet pyyaml
|
||||
- run: python3 .github/check-listing-images.py
|
||||
|
||||
compose:
|
||||
name: Docker Compose test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: { fetch-depth: 0 }
|
||||
- name: Test changed recipes
|
||||
env:
|
||||
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
|
||||
run: |
|
||||
# A new branch's first push has no "before" commit (all zeros): compare it with main
|
||||
# instead, so it tests only the recipes it changes.
|
||||
if [ -z "$BASE" ] || ! git cat-file -e "$BASE^{commit}" 2>/dev/null; then
|
||||
BASE=$(git merge-base origin/main HEAD)
|
||||
fi
|
||||
if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
|
||||
apps=$(ls -d apps/*/)
|
||||
else
|
||||
apps=$(git diff --name-only "$BASE" HEAD -- apps/ | cut -d/ -f1-2 | sort -u)
|
||||
fi
|
||||
for app in $apps; do
|
||||
[ -d "$app" ] || continue # removed by this change
|
||||
scripts/local-test.sh "$app"
|
||||
docker system prune -af --volumes >/dev/null # keep the runner's disk free
|
||||
done
|
||||
|
||||
# Cottage's own checks: the recipe is accepted by the platform and runs its full lifecycle.
|
||||
# The platform isn't public, so this needs the PLATFORM_KEY secret (a read-only deploy key)
|
||||
# and is skipped for pull requests from forks; a maintainer runs it before merging.
|
||||
platform:
|
||||
name: Cottage checks
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with: { go-version: "1.26" }
|
||||
- name: Build the platform at the pinned commit
|
||||
env: { PLATFORM_KEY: "${{ secrets.HARBOR_DEPLOY_KEY }}" }
|
||||
run: |
|
||||
if [ -z "$PLATFORM_KEY" ]; then
|
||||
echo "::error::The HARBOR_DEPLOY_KEY secret is missing."
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p ~/.ssh && printf '%s\n' "$PLATFORM_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null
|
||||
git clone -q [email protected]:cottage-host/harbor.git /tmp/platform
|
||||
git -C /tmp/platform checkout -q "$(cat .github/platform.ref)"
|
||||
(cd /tmp/platform && go build -o /tmp/harbord ./cmd/harbord)
|
||||
rm -f ~/.ssh/id_ed25519
|
||||
# Runs as root, as on a server: it hands volume directories to the containers'
|
||||
# non-root users, which needs root or CAP_CHOWN. Capacity is fixed so the runner's
|
||||
# disk size can't refuse a recipe.
|
||||
- name: Check every recipe
|
||||
run: |
|
||||
export HARBOR_DATA_DIR=$RUNNER_TEMP/h HARBOR_RUNTIME=fake HARBOR_BASE_DOMAIN=pods.test
|
||||
export HARBOR_CAPACITY_CPU_MILLIS=8000 HARBOR_CAPACITY_MEMORY_MB=8192 HARBOR_CAPACITY_STORAGE_MB=65536
|
||||
# public TCP ports for recipes with tcp_ports, as on the servers
|
||||
export HARBOR_PUBLIC_PORTS=20000-20099 HARBOR_TCP_DOMAIN=tcp.pods.test
|
||||
# the runner's sudo ignores -E, so pass the settings explicitly
|
||||
H="HARBOR_DATA_DIR=$HARBOR_DATA_DIR HARBOR_RUNTIME=$HARBOR_RUNTIME HARBOR_BASE_DOMAIN=$HARBOR_BASE_DOMAIN HARBOR_CAPACITY_CPU_MILLIS=$HARBOR_CAPACITY_CPU_MILLIS HARBOR_CAPACITY_MEMORY_MB=$HARBOR_CAPACITY_MEMORY_MB HARBOR_CAPACITY_STORAGE_MB=$HARBOR_CAPACITY_STORAGE_MB HARBOR_PUBLIC_PORTS=$HARBOR_PUBLIC_PORTS HARBOR_TCP_DOMAIN=$HARBOR_TCP_DOMAIN"
|
||||
export HARBOR_TOKEN=$(sudo env $H /tmp/harbord token create ci | grep -o 'hbr_[A-Za-z0-9_-]*')
|
||||
# As on the servers, the node only runs images on its allowlist, and the control plane
|
||||
# sets that list from the catalog. A name the node won't take fails here, not in production.
|
||||
sudo env $H HARBOR_IMAGE_ALLOWLIST_MANAGED=true /tmp/harbord serve & sleep 2
|
||||
export HARBOR_URL=http://127.0.0.1:7700
|
||||
python3 .github/platform-allowlist.py > "$RUNNER_TEMP/allowlist.json"
|
||||
curl -sS --fail-with-body -X PUT -H "Authorization: Bearer $HARBOR_TOKEN" -H 'Content-Type: application/json' \
|
||||
--data-binary @"$RUNNER_TEMP/allowlist.json" "$HARBOR_URL/v1/image-allowlist"
|
||||
for app in apps/*/; do sh .github/platform-check.sh "$app"; done
|
||||
Reference in new issue
Block a user