perf(ci): run Lint and Build in the baked ci image #8
No files matched your search
+11
-11
@@ -26,18 +26,12 @@ jobs:
|
||||
build:
|
||||
runs-on: kamino-docker
|
||||
timeout-minutes: 30
|
||||
# The ci image (images/ci, built by image.yml): tag for the release, digest enforced.
|
||||
container:
|
||||
image: ubuntu:24.04@sha256:68ee22004a9109b44973313b02ff7b1de250f1de0f5ecb628d73f579aaff33ac
|
||||
image: git.rkdr.net/mortis/ci:0.1.0@sha256:f8925ce9024cb317f052545da6fc90369218962be636e683b6969e0779847d6a
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
||||
steps:
|
||||
- name: Install OS packages
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates git python3 python3-venv python3-pip
|
||||
|
||||
- name: Checkout the commit under test
|
||||
env:
|
||||
GIT_CONFIG_COUNT: "1"
|
||||
@@ -59,10 +53,16 @@ jobs:
|
||||
fi
|
||||
echo "Checked out $(git rev-parse HEAD)"
|
||||
|
||||
- name: Install pinned tooling
|
||||
# The baked tools match the pin files unless this change touches them; then the
|
||||
# pinned tools are installed for this run, as before the ci image existed.
|
||||
- name: Check the baked tooling against the pins
|
||||
run: |
|
||||
python3 -m venv /opt/venv
|
||||
/opt/venv/bin/pip install --quiet -r requirements-dev.txt
|
||||
if sha256sum --quiet -c /opt/ci-pins.sha256; then
|
||||
echo "The pin files match the ci image; using the baked tools."
|
||||
else
|
||||
echo "::warning::requirements-dev.txt or .pre-commit-config.yaml differ from the ci image; installing the pinned tools for this run."
|
||||
/opt/venv/bin/pip install --quiet -r requirements-dev.txt
|
||||
fi
|
||||
|
||||
# ADR 0004, Release process: the tag is annotated and equals v + the galaxy.yml version.
|
||||
- name: Check the release tag
|
||||
|
||||
@@ -209,9 +209,11 @@ jobs:
|
||||
|
||||
# Gitea cannot make a tag immutable, so look the version tag up first: when it
|
||||
# exists the build must not move it (the build step reads this marker).
|
||||
accept='application/vnd.oci.image.index.v1+json'
|
||||
accept="$accept, application/vnd.oci.image.manifest.v1+json"
|
||||
accept="$accept, application/vnd.docker.distribution.manifest.v2+json"
|
||||
code="$(printf 'user = "%s:%s"\n' "$cred_user" "$cred_token" \
|
||||
| curl -sS -o /dev/null -w '%{http_code}' -I -K - \
|
||||
-H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json' \
|
||||
| curl -sS -o /dev/null -w '%{http_code}' -I -K - -H "Accept: $accept" \
|
||||
"https://${registry}/v2/${IMAGE_PATH}/manifests/${IMAGE_VERSION}" || true)"
|
||||
case "$code" in
|
||||
200) touch /kaniko/version-published; echo "Version tag ${IMAGE_VERSION} is already published; it will not be moved." ;;
|
||||
|
||||
+16
-17
@@ -3,9 +3,10 @@ name: Lint
|
||||
# Runs on the Collection's own runner (label kamino-docker, scoped to the mortis org),
|
||||
# never on the production runner. No secrets are used: the only credential is the
|
||||
# job token, which is read-only for a fork pull request. No pull_request_target.
|
||||
# The tools are installed in the job from pinned PyPI versions (requirements-dev.txt)
|
||||
# and pinned hook revisions (.pre-commit-config.yaml), so this does not depend on any
|
||||
# prebuilt CI image.
|
||||
# The tools come from the ci image (images/ci, built by image.yml): the pinned Python
|
||||
# tools of requirements-dev.txt and the hook environments of .pre-commit-config.yaml
|
||||
# are baked in. When a PR changes one of those files the checksum check below fails
|
||||
# and the job installs the pinned tools itself for this run (slower, same result).
|
||||
on: # yamllint disable-line rule:truthy
|
||||
pull_request:
|
||||
branches:
|
||||
@@ -28,22 +29,16 @@ jobs:
|
||||
runs-on: kamino-docker
|
||||
# Ceiling only: the instance may cap job timeouts at app.ini's default.
|
||||
timeout-minutes: 30
|
||||
# Pinned by digest (ubuntu:24.04, 2026-10-24). The runner's default image is
|
||||
# ubuntu:24.04 too, but a mutable tag; naming it here keeps the job reproducible.
|
||||
# The tag says which release, the digest is what is enforced (bump both together
|
||||
# when image.yml publishes a new version).
|
||||
container:
|
||||
image: ubuntu:24.04@sha256:68ee22004a9109b44973313b02ff7b1de250f1de0f5ecb628d73f579aaff33ac
|
||||
image: git.rkdr.net/mortis/ci:0.1.0@sha256:f8925ce9024cb317f052545da6fc90369218962be636e683b6969e0779847d6a
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
||||
PRE_COMMIT_HOME: /opt/pre-commit
|
||||
steps:
|
||||
# The container has no Node, so JavaScript actions such as actions/checkout
|
||||
# cannot run; clone with git and the job token, as the environment repo does.
|
||||
- name: Install OS packages
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates git python3 python3-venv python3-pip shellcheck
|
||||
|
||||
- name: Checkout the commit under test
|
||||
env:
|
||||
GIT_CONFIG_COUNT: "1"
|
||||
@@ -58,10 +53,14 @@ jobs:
|
||||
git checkout "$SHA" || { git fetch origin "$REF" && git checkout "$SHA"; }
|
||||
echo "Checked out $(git rev-parse HEAD)"
|
||||
|
||||
- name: Install pinned tooling
|
||||
- name: Check the baked tooling against the pins
|
||||
run: |
|
||||
python3 -m venv /opt/venv
|
||||
/opt/venv/bin/pip install --quiet -r requirements-dev.txt
|
||||
if sha256sum --quiet -c /opt/ci-pins.sha256; then
|
||||
echo "The pin files match the ci image; using the baked tools."
|
||||
else
|
||||
echo "::warning::requirements-dev.txt or .pre-commit-config.yaml differ from the ci image; installing the pinned tools for this run."
|
||||
/opt/venv/bin/pip install --quiet -r requirements-dev.txt
|
||||
fi
|
||||
|
||||
- name: Run pre-commit on all files
|
||||
run: |
|
||||
@@ -75,7 +74,7 @@ jobs:
|
||||
env:
|
||||
SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
GITLEAKS="$(find ~/.cache/pre-commit -type f -name gitleaks | sort | tail -n1)"
|
||||
GITLEAKS="$(find "$PRE_COMMIT_HOME" -type f -name gitleaks | sort | tail -n1)"
|
||||
if [ ! -x "$GITLEAKS" ]; then
|
||||
echo "gitleaks binary not found in the pre-commit cache" >&2
|
||||
exit 1
|
||||
|
||||
Reference in new issue
Block a user