Answer architecture round 4: 0 🔴, 1 🟡; run the repository checks on every file they read, and check each repository installs the release's own version
This commit is contained in:
@@ -120,11 +120,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PACKAGES_GPG_KEY: ${{ secrets.PACKAGES_GPG_KEY }}
|
PACKAGES_GPG_KEY: ${{ secrets.PACKAGES_GPG_KEY }}
|
||||||
PACKAGES_RSA_KEY: ${{ secrets.PACKAGES_RSA_KEY }}
|
PACKAGES_RSA_KEY: ${{ secrets.PACKAGES_RSA_KEY }}
|
||||||
|
TAG: ${{ inputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
build() {
|
build() {
|
||||||
docker buildx build -f release-tooling/package-repos.Dockerfile \
|
docker buildx build -f release-tooling/package-repos.Dockerfile \
|
||||||
--secret id=gpg,env=PACKAGES_GPG_KEY --secret id=rsa,env=PACKAGES_RSA_KEY \
|
--secret id=gpg,env=PACKAGES_GPG_KEY --secret id=rsa,env=PACKAGES_RSA_KEY \
|
||||||
--build-context packages=packages "$@" .
|
--build-context packages=packages --build-arg "EXPECTED_VERSION=$TAG" "$@" .
|
||||||
}
|
}
|
||||||
build --target checks --output type=local,dest=checks
|
build --target checks --output type=local,dest=checks
|
||||||
build --target site --output type=local,dest=site
|
build --target site --output type=local,dest=site
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "code=true" >> "$GITHUB_OUTPUT"
|
echo "code=true" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
if git diff --quiet "$base"...HEAD -- release-tooling Dockerfile .github/workflows/packages.yml; then
|
if git diff --quiet "$base"...HEAD -- release-tooling Dockerfile .dockerignore LICENSE DATA-LICENSES.md .github/workflows/packages.yml .github/workflows/test.yml; then
|
||||||
echo "packaging=false" >> "$GITHUB_OUTPUT"
|
echo "packaging=false" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "packaging=true" >> "$GITHUB_OUTPUT"
|
echo "packaging=true" >> "$GITHUB_OUTPUT"
|
||||||
|
|||||||
@@ -1205,10 +1205,11 @@ docker compose run --rm --user root --entrypoint chown test -R "$(id -u):$(id -g
|
|||||||
Every pull request runs `docker build .` against both the latest and the lowest
|
Every pull request runs `docker build .` against both the latest and the lowest
|
||||||
supported Go, and must pass before it can be merged — unless it changes none of
|
supported Go, and must pass before it can be merged — unless it changes none of
|
||||||
the files the build and its tests read, nor the workflow itself, in which case
|
the files the build and its tests read, nor the workflow itself, in which case
|
||||||
it's skipped. That build is the whole gate except the changelog check, which CI
|
it's skipped. That build runs vet, complexity, the format check, the Go tests and the
|
||||||
runs against the PR base, and the package-repository checks below: vet, complexity, the format check, the Go tests and the
|
release tooling's tests; the rest of the gate is the changelog check, which CI runs
|
||||||
release tooling's tests. Run it locally before pushing. The lowest Go builds the
|
against the PR base, and the package-repository checks below. Run it locally before
|
||||||
`portable` stage, which skips the format check and the release tooling's tests:
|
pushing. The lowest Go builds the `portable` stage, which skips the format check and the
|
||||||
|
release tooling's tests:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker build . # latest
|
docker build . # latest
|
||||||
@@ -1216,9 +1217,9 @@ docker build --build-arg GO_VERSION=1.22.12 --target portable . # lowest support
|
|||||||
GO_VERSION=1.22.12 docker compose run --rm test # the same tests, without the image build
|
GO_VERSION=1.22.12 docker compose run --rm test # the same tests, without the image build
|
||||||
```
|
```
|
||||||
|
|
||||||
A change to `release-tooling/`, the `Dockerfile` or the Packages workflow also builds the
|
A change to `release-tooling/`, the `Dockerfile`, `.dockerignore`, the licence files or
|
||||||
apt, dnf and apk repositories from snapshot packages, signed with throwaway keys, and
|
either workflow also builds the apt, dnf and apk repositories from snapshot packages,
|
||||||
installs fejkdata from each:
|
signs them with throwaway keys, and installs fejkdata from each:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker build -f release-tooling/package-repos.Dockerfile --target throwaway-keys --output /tmp/fejkdata-keys .
|
docker build -f release-tooling/package-repos.Dockerfile --target throwaway-keys --output /tmp/fejkdata-keys .
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
# The apt, dnf and apk repositories GitHub Pages serves, signed, from the .deb, .rpm and
|
# The apt, dnf and apk repositories GitHub Pages serves, signed, from the .deb, .rpm and
|
||||||
# .apk files of the `packages` stage: a snapshot built from the source here, or a release's
|
# .apk files of the `packages` stage: a snapshot built from the source here, or a release's
|
||||||
# when `--build-context packages=<dir>` replaces it. The checks target installs fejkdata
|
# when `--build-context packages=<dir>` replaces it. The checks target installs fejkdata
|
||||||
# from each repository; the README's Development section shows the commands.
|
# from each repository, and where EXPECTED_VERSION is set, checks it prints that tag; the
|
||||||
|
# README's Development section shows the commands.
|
||||||
ARG BASE_URL=https://larvit.github.io/fejkdata
|
ARG BASE_URL=https://larvit.github.io/fejkdata
|
||||||
|
ARG EXPECTED_VERSION
|
||||||
|
|
||||||
FROM goreleaser/goreleaser:v2.18.3 AS snapshot
|
FROM goreleaser/goreleaser:v2.18.3 AS snapshot
|
||||||
WORKDIR /w/src
|
WORKDIR /w/src
|
||||||
@@ -73,24 +75,30 @@ COPY --from=deb-rpm /site /
|
|||||||
COPY --from=apk /site /
|
COPY --from=apk /site /
|
||||||
|
|
||||||
FROM debian:trixie-20260918-slim AS check-deb
|
FROM debian:trixie-20260918-slim AS check-deb
|
||||||
|
ARG EXPECTED_VERSION
|
||||||
COPY --from=site / /site
|
COPY --from=site / /site
|
||||||
RUN echo 'deb [signed-by=/site/fejkdata.asc] file:/site/deb stable main' > /etc/apt/sources.list.d/fejkdata.list \
|
RUN echo 'deb [signed-by=/site/fejkdata.asc] file:/site/deb stable main' > /etc/apt/sources.list.d/fejkdata.list \
|
||||||
&& apt-get update -o Dir::Etc::SourceList=/etc/apt/sources.list.d/fejkdata.list -o Dir::Etc::SourceParts=- \
|
&& apt-get update -o Dir::Etc::SourceList=/etc/apt/sources.list.d/fejkdata.list -o Dir::Etc::SourceParts=- \
|
||||||
&& apt-get install -y fejkdata \
|
&& apt-get install -y fejkdata \
|
||||||
&& fejkdata --version > /checked
|
&& fejkdata --version > /checked \
|
||||||
|
&& { [ -z "$EXPECTED_VERSION" ] || [ "$(cat /checked)" = "fejkdata $EXPECTED_VERSION" ]; }
|
||||||
|
|
||||||
FROM fedora:43@sha256:a651ddf48ea28a06ed4e1e6519f51c9f47e7a5a138722ade87369b8fbb7e5b42 AS check-rpm
|
FROM fedora:43@sha256:a651ddf48ea28a06ed4e1e6519f51c9f47e7a5a138722ade87369b8fbb7e5b42 AS check-rpm
|
||||||
|
ARG EXPECTED_VERSION
|
||||||
COPY --from=site / /site
|
COPY --from=site / /site
|
||||||
RUN sed -e 's#^baseurl=.*#baseurl=file:///site/rpm#' -e 's#^gpgkey=.*#gpgkey=file:///site/fejkdata.asc#' \
|
RUN sed -e 's#^baseurl=.*#baseurl=file:///site/rpm#' -e 's#^gpgkey=.*#gpgkey=file:///site/fejkdata.asc#' \
|
||||||
/site/rpm/fejkdata.repo > /etc/yum.repos.d/fejkdata.repo \
|
/site/rpm/fejkdata.repo > /etc/yum.repos.d/fejkdata.repo \
|
||||||
&& dnf install -y --repo fejkdata fejkdata \
|
&& dnf install -y --repo fejkdata fejkdata \
|
||||||
&& fejkdata --version > /checked
|
&& fejkdata --version > /checked \
|
||||||
|
&& { [ -z "$EXPECTED_VERSION" ] || [ "$(cat /checked)" = "fejkdata $EXPECTED_VERSION" ]; }
|
||||||
|
|
||||||
FROM alpine:3.22.2 AS check-apk
|
FROM alpine:3.22.2 AS check-apk
|
||||||
|
ARG EXPECTED_VERSION
|
||||||
COPY --from=site / /site
|
COPY --from=site / /site
|
||||||
RUN cp /site/apk/fejkdata.rsa.pub /etc/apk/keys/ \
|
RUN cp /site/apk/fejkdata.rsa.pub /etc/apk/keys/ \
|
||||||
&& apk add --no-cache --repositories-file /dev/null -X /site/apk fejkdata \
|
&& apk add --no-cache --repositories-file /dev/null -X /site/apk fejkdata \
|
||||||
&& fejkdata --version > /checked
|
&& fejkdata --version > /checked \
|
||||||
|
&& { [ -z "$EXPECTED_VERSION" ] || [ "$(cat /checked)" = "fejkdata $EXPECTED_VERSION" ]; }
|
||||||
|
|
||||||
FROM scratch AS checks
|
FROM scratch AS checks
|
||||||
COPY --from=check-deb /checked /deb
|
COPY --from=check-deb /checked /deb
|
||||||
|
|||||||
Reference in New Issue
Block a user