Repository navigation
fix(ui): use the MD3 window classes in access, console, maintenance and support #3065
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Heavy tests: the jobs that need a container, a built image, a cluster, a browser or minutes of start-up. | |
| # | |
| # They do not run on an ordinary pull request. A maintainer starts them with a label (ci:heavy for every job, or the | |
| # label of one area), and the release pull request needs one full run before it can be merged. The aggregate | |
| # "Heavy tests" reports the outcome and is the only check a branch rule has to name. | |
| # | |
| # The merge queue has no labels. On a merge_group event the gate reads the diff of the merge group through | |
| # ci_scope.sh instead and starts Container images, Helm chart and Dashboard end-to-end when their scope changed. Every | |
| # other heavy job stays off there. Container images and Helm chart are required checks, so they report on every merge | |
| # group: they run, or they are skipped, which counts as success, exactly as on a pull request without a label. | |
| # | |
| # Fork safety: plain pull_request only. GitHub withholds secrets and gives a read-only token to a fork pull request, | |
| # even when a maintainer added the label, and no job here uses a secret. Only users with triage or write access can | |
| # add a label, so the label is the permission check. | |
| # | |
| # No path or branch-ignore filter at workflow level: a workflow skipped by a filter leaves its required checks | |
| # pending. Every skip is a job-level condition. | |
| name: "Heavy" | |
| on: | |
| pull_request: | |
| branches: [ "main", "release/**" ] | |
| types: [ "opened", "reopened", "synchronize", "labeled", "unlabeled" ] | |
| merge_group: | |
| types: [ "checks_requested" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # A label that does not start with "ci:" gets a group of its own, so adding "bug" cancels no heavy run in progress. | |
| # Adding or removing a "ci:" label lands in the shared group and queues a fresh decision behind the running one. | |
| # Only a new commit (synchronize) cancels the running run: that run tested a commit that is no longer the head, so its | |
| # cancelled checks land on the old commit. A run cancelled on the head commit would leave a red "Heavy tests" and | |
| # cancelled required checks beside the green ones of the run that replaced it. Opening a pull request with a label | |
| # fires opened and labeled at the same moment, and cancelling one of the two did exactly that. A queued run that is | |
| # replaced before it starts has no jobs and leaves no check behind, so a burst of label changes still runs once more. | |
| # A merge group falls back to its ref, which is unique per queue entry, and is never cancelled. | |
| concurrency: | |
| group: "heavy-${{ github.event.pull_request.number || github.ref }}-${{ (github.event_name == 'pull_request' && (github.event.action == 'labeled' || github.event.action == 'unlabeled') && !startsWith(github.event.label.name, 'ci:')) && github.run_id || 'run' }}" | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' && github.event.action == 'synchronize' }} | |
| jobs: | |
| gate: | |
| name: "Heavy gate" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| jobs: ${{ steps.decide.outputs.jobs }} | |
| integration: ${{ steps.decide.outputs.integration }} | |
| images: ${{ steps.decide.outputs.images }} | |
| ha: ${{ steps.decide.outputs.ha }} | |
| e2e: ${{ steps.decide.outputs.e2e }} | |
| helm: ${{ steps.decide.outputs.helm }} | |
| search: ${{ steps.decide.outputs.search }} | |
| codeql: ${{ steps.decide.outputs.codeql }} | |
| requested: ${{ steps.decide.outputs.requested }} | |
| full: ${{ steps.decide.outputs.full }} | |
| release: ${{ steps.decide.outputs.release }} | |
| ok: ${{ steps.decide.outputs.ok }} | |
| reason: ${{ steps.decide.outputs.reason }} | |
| steps: | |
| - name: "Check out the scripts" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| sparse-checkout: .github/scripts | |
| persist-credentials: false | |
| # A merge group is scoped by its diff, so both of its ends have to be present. A string, because a number 0 | |
| # would read as false in the expression. | |
| fetch-depth: ${{ github.event_name == 'merge_group' && '0' || '1' }} | |
| # A merge group passes the scope flags of its diff. A missing range or a failing diff leaves the scope file | |
| # absent, and the gate then runs every job a merge group can start. | |
| - name: "Decide which heavy jobs run" | |
| id: decide | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| BASE: ${{ github.event.merge_group.base_sha }} | |
| HEAD: ${{ github.event.merge_group.head_sha }} | |
| ACTION: ${{ github.event.action }} | |
| LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }} | |
| HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | |
| REPO: ${{ github.repository }} | |
| REF: ${{ github.ref }} | |
| run: | | |
| scope="$RUNNER_TEMP/heavy-scope.txt" | |
| if [ "$EVENT_NAME" = "merge_group" ] && [ -n "$BASE" ] && [ -n "$HEAD" ] \ | |
| && git diff --no-renames --name-only "$BASE...$HEAD" > "$RUNNER_TEMP/heavy-changed.txt"; then | |
| bash .github/scripts/ci_scope.sh < "$RUNNER_TEMP/heavy-changed.txt" > "$scope" || rm -f "$scope" | |
| fi | |
| python3 .github/scripts/heavy_gate.py decide \ | |
| --event-name "$EVENT_NAME" --action "$ACTION" --labels "$LABELS" \ | |
| --head-ref "$HEAD_REF" --head-repo "$HEAD_REPO" --repo "$REPO" --ref "$REF" \ | |
| --scope-file "$scope" --output "$GITHUB_OUTPUT" | |
| # Required check. Green on an ordinary pull request that asked for nothing, follows the heavy jobs when a label | |
| # asked for them, and is red on a release pull request until every heavy job ran in full and passed. | |
| heavy-tests: | |
| name: "Heavy tests" | |
| needs: [ gate, integration, images, helm, ha, e2e, search, codeql ] | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: "Check out the scripts" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| sparse-checkout: .github/scripts | |
| persist-credentials: false | |
| - name: "Judge the heavy run" | |
| env: | |
| GATE_RESULT: ${{ needs.gate.result }} | |
| NEEDS: ${{ toJSON(needs) }} | |
| JOBS: ${{ needs.gate.outputs.jobs }} | |
| FULL: ${{ needs.gate.outputs.full }} | |
| RELEASE: ${{ needs.gate.outputs.release }} | |
| OK: ${{ needs.gate.outputs.ok }} | |
| REASON: ${{ needs.gate.outputs.reason }} | |
| run: | | |
| status=0 | |
| message=$(python3 .github/scripts/heavy_gate.py verdict \ | |
| --gate-result "$GATE_RESULT" --results "$NEEDS" --jobs "$JOBS" \ | |
| --full "$FULL" --release "$RELEASE" --ok "$OK" --reason "$REASON") || status=$? | |
| echo "$message" | |
| { | |
| echo "### Heavy tests" | |
| echo | |
| echo "$message" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| if [ "$status" -ne 0 ]; then | |
| echo "::error::$message" | |
| exit 1 | |
| fi | |
| # Both images were only ever built while cutting a release, so a broken Dockerfile would | |
| # surface at the worst possible moment, with a tag already pushed. Building them here | |
| # costs a few minutes and moves that discovery to the pull request that caused it. | |
| # | |
| # Nothing is pushed. This answers "does it build", which is the failure mode that used to | |
| # escape; the release job stays the only thing that publishes. | |
| # Builds the two amd64 images once for this commit and hands them to the jobs that run them. The arm64 images | |
| # are built by their own job, in parallel, so nothing that waits for this archive waits for them. | |
| images-build: | |
| name: "Build the container images" | |
| needs: [ gate ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.images == 'true' || needs.gate.outputs.helm == 'true' || needs.gate.outputs.ha == 'true') }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Set up Buildx" | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| # Built for the host architecture and loaded, because the jobs that use them run them. | |
| - name: "Build the server image" | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: false | |
| load: true | |
| tags: ingot:ci | |
| cache-from: type=gha,scope=ci-server | |
| # Pushes to main keep a minimal export for the next run. Pull requests export nothing: a | |
| # key built from COPY . changes with every commit, so nothing the pull request writes is read back. | |
| cache-to: ${{ github.event_name == 'push' && 'type=gha,mode=min,scope=ci-server' || '' }} | |
| - name: "Build the dashboard image" | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| # The repository root, not the module: the image needs branding assets from | |
| # outside reposilite-frontend. | |
| context: . | |
| file: reposilite-frontend/Dockerfile | |
| platforms: linux/amd64 | |
| push: false | |
| load: true | |
| tags: ingot-dashboard:ci | |
| cache-from: type=gha,scope=ci-dashboard | |
| cache-to: ${{ github.event_name == 'push' && 'type=gha,mode=min,scope=ci-dashboard' || '' }} | |
| # The command line client ships as its own image. Its build stage is pinned to the builder, like the server's. | |
| - name: "Build the CLI image" | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| file: ingot-cli/Dockerfile | |
| platforms: linux/amd64 | |
| push: false | |
| load: true | |
| tags: ingot-cli:ci | |
| cache-from: type=gha,scope=ci-cli | |
| cache-to: ${{ github.event_name == 'push' && 'type=gha,mode=min,scope=ci-cli' || '' }} | |
| # The jobs below load these into their own Docker stores. All tags are kept by the save. | |
| - name: "Save the container images" | |
| run: docker save ingot:ci ingot-dashboard:ci ingot-cli:ci --output "$RUNNER_TEMP/ingot-images.tar" | |
| # The archive holds compressed layers already, so the upload stores it without compressing it again. | |
| - name: "Publish the container images" | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: container-images | |
| path: ${{ runner.temp }}/ingot-images.tar | |
| retention-days: 1 | |
| compression-level: 0 | |
| if-no-files-found: error | |
| # The arm64 legs run beside the amd64 build rather than after it, so they add no time to the jobs that | |
| # wait for the archive. Only the run stages are emulated; the Gradle and npm work is pinned to the native | |
| # platform in the Dockerfiles, so this job runs that stage once more on its own runner, about two minutes. | |
| images-arm64: | |
| name: "Build the container images for arm64" | |
| needs: [ gate ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || (needs.gate.outputs.images == 'true')) }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Set up QEMU" | |
| uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 | |
| - name: "Set up Buildx" | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| # Neither loaded nor pushed: a single Docker image store cannot hold two | |
| # architectures under one tag, and the question here is only whether it builds. | |
| # No cache export: nothing reads it, and the build stage is not shared with the amd64 job. | |
| - name: "Build the server image for arm64" | |
| if: github.event_name != 'push' | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| platforms: linux/arm64 | |
| push: false | |
| - name: "Build the dashboard image for arm64" | |
| if: github.event_name != 'push' | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| file: reposilite-frontend/Dockerfile | |
| platforms: linux/arm64 | |
| push: false | |
| - name: "Build the CLI image for arm64" | |
| if: github.event_name != 'push' | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| file: ingot-cli/Dockerfile | |
| platforms: linux/arm64 | |
| push: false | |
| # Runs the server image and the dashboard image the way a deployment does. It needs an image that | |
| # already exists, which is why it cannot be part of the normal build. | |
| container-tests: | |
| name: "Container tests" | |
| needs: [ gate, images-build ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || (needs.gate.outputs.images == 'true')) }} | |
| # On push to main only the amd64 builds run, to write the layer cache. The tests ran on the pull request. | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Download the container images" | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: container-images | |
| path: ${{ runner.temp }}/container-images | |
| - name: "Load the container images" | |
| run: docker load --input "$RUNNER_TEMP/container-images/ingot-images.tar" | |
| # The CLI image runs as the fixed user and reaches the server code path. A server is not started here, so | |
| # these checks cover the image itself: its user, the exit code of an unreachable server, and the usage exit code. | |
| - name: "Check the CLI image runs as uid 10001 and exits as documented" | |
| run: | | |
| set -euo pipefail | |
| uid="$(docker run --rm --label ingot-agent=ci-cli --entrypoint id ingot-cli:ci -u)" | |
| test "$uid" = 10001 | |
| set +e | |
| docker run --rm --label ingot-agent=ci-cli -e INGOT_URL=http://127.0.0.1:9 -e INGOT_TOKEN=ci:unused ingot-cli:ci exec status | |
| unreachable=$? | |
| docker run --rm --label ingot-agent=ci-cli ingot-cli:ci exec | |
| usage=$? | |
| set -e | |
| echo "Unreachable server: exit $unreachable. Missing command: exit $usage." | |
| test "$unreachable" = 5 | |
| test "$usage" = 2 | |
| # The suite lives in reposilite-backend/src/containerTest and runs both images the way | |
| # a deployment does, including an upgrade rehearsal against the real upstream image, | |
| # two replicas that find each other through a NATS broker on one MariaDB database, and | |
| # the previous release running beside the new image on that database. | |
| - name: "Set up Java" | |
| if: github.event_name != 'push' | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - name: "Set up Gradle" | |
| if: github.event_name != 'push' | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| # The previous release is the highest version tag, so the mixed-version case always pairs the current build with the | |
| # release an operator upgrades from. This checkout is shallow and fetches no tags, so the tags are read from the remote. | |
| - name: "Resolve the latest release" | |
| if: github.event_name != 'push' | |
| id: previous | |
| env: | |
| # The branch under test: the base of a pull request, or the ref of a manual run. On a release branch the | |
| # previous release is the highest tag of that line; on main it is the highest tag overall. | |
| BRANCH: ${{ github.base_ref || github.ref_name }} | |
| run: | | |
| tag=$(git ls-remote --tags --refs origin 'refs/tags/v*' | sed 's#.*refs/tags/##' | python3 .github/scripts/release_tags.py previous "$BRANCH") | |
| test -n "$tag" | |
| echo "Previous release: $tag" | |
| echo "image=ghcr.io/onelitefeathernet/ingot:${tag#v}" >> "$GITHUB_OUTPUT" | |
| - name: "Run the container tests" | |
| if: github.event_name != 'push' | |
| env: | |
| PREVIOUS_IMAGE: ${{ steps.previous.outputs.image }} | |
| run: ./gradlew :reposilite-backend:containerTest -Dingot.previous.image="$PREVIOUS_IMAGE" | |
| - name: "Publish the container test results" | |
| if: always() && github.event_name != 'push' | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: container-test-results | |
| path: reposilite-backend/build/reports/tests/containerTest | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| # The vulnerabilities job next to this one scans the Gradle and npm trees, which says | |
| # nothing about the base image underneath them. That is where an unpatched openssl or | |
| # zlib would sit, and it is the half that is shipped without anyone here declaring it. | |
| # | |
| # Only fixable findings fail the build. An advisory with no released fix cannot be | |
| # acted on by bumping anything, so failing on it would train everyone to ignore this | |
| # step; those are caught by the Renovate base image bumps instead. | |
| - name: "Scan the server image" | |
| if: github.event_name != 'push' | |
| uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 | |
| with: | |
| scan-type: image | |
| image-ref: ingot:ci | |
| scanners: vuln,secret | |
| ignore-unfixed: true | |
| severity: CRITICAL,HIGH | |
| exit-code: "1" | |
| - name: "Scan the dashboard image" | |
| if: github.event_name != 'push' | |
| uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 | |
| with: | |
| scan-type: image | |
| image-ref: ingot-dashboard:ci | |
| scanners: vuln,secret | |
| ignore-unfixed: true | |
| severity: CRITICAL,HIGH | |
| exit-code: "1" | |
| # The required check. It passes only when the amd64 build, the container tests and the arm64 build all succeeded. | |
| images: | |
| name: "Container images" | |
| needs: [ gate, images-build, container-tests, images-arm64 ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || (needs.gate.outputs.images == 'true')) }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Check the image build and the container tests" | |
| env: | |
| BUILD: ${{ needs.images-build.result }} | |
| TESTS: ${{ needs.container-tests.result }} | |
| EVENT: ${{ github.event_name }} | |
| ARM64: ${{ needs.images-arm64.result }} | |
| run: | | |
| echo "Image build: $BUILD. Container tests: $TESTS. arm64 build: $ARM64." | |
| test "$BUILD" = success | |
| test "$TESTS" = success || { test "$EVENT" = push && test "$TESTS" = skipped; } | |
| test "$ARM64" = success || { test "$EVENT" = push && test "$ARM64" = skipped; } | |
| # The chart is linted and rendered without a cluster first, because a broken template is the | |
| # cheapest thing to catch. Then chart-testing installs both deploy modes on a kind cluster | |
| # with the images this commit builds, so the probes and the wiring are exercised for real. | |
| # | |
| # The cmp is the drift check of the dashboard segment list: the chart carries a copy of the | |
| # source that the frontend router and the backend read, and an edit of one without the other | |
| # fails here. | |
| helm: | |
| name: "Helm chart" | |
| needs: [ gate, images-build ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || (needs.gate.outputs.helm == 'true' && needs.images-build.result == 'success')) }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Set up Helm" | |
| uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 | |
| with: | |
| version: v4.3.0 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: "3.12" | |
| - name: "Install the chart test dependencies" | |
| run: python3 -m pip install "pyyaml==6.0.3" | |
| - name: "Install promtool" | |
| # Prometheus 3.5.0 release archive, verified against the sha256 published with the release. | |
| run: | | |
| curl --fail --silent --show-error --location --output "$RUNNER_TEMP/prometheus.tar.gz" \ | |
| https://github.com/prometheus/prometheus/releases/download/v3.5.0/prometheus-3.5.0.linux-amd64.tar.gz | |
| echo "e811827af26d822afb09a4f28314f61b618b12cff5369835a67f674d8b46f39a $RUNNER_TEMP/prometheus.tar.gz" | sha256sum --check --strict - | |
| tar --extract --gzip --file "$RUNNER_TEMP/prometheus.tar.gz" --directory "$RUNNER_TEMP" prometheus-3.5.0.linux-amd64/promtool | |
| echo "PROMTOOL=$RUNNER_TEMP/prometheus-3.5.0.linux-amd64/promtool" >> "$GITHUB_ENV" | |
| - name: "Lint the chart in both deploy modes" | |
| run: | | |
| helm lint charts/ingot --strict -f charts/ingot/ci/allinone-values.yaml | |
| helm lint charts/ingot --strict -f charts/ingot/ci/split-values.yaml | |
| helm lint charts/ingot --strict -f charts/ingot/tests/scalable/values.yaml | |
| - name: "Check the alert rules with promtool" | |
| run: | | |
| helm template ingot charts/ingot --namespace reposilite-staging --set prometheusRule.enabled=true \ | |
| --show-only templates/prometheusrule.yaml > "$RUNNER_TEMP/prometheusrule.yaml" | |
| python3 -c 'import sys, yaml; print(yaml.safe_dump(yaml.safe_load(open(sys.argv[1]))["spec"]))' \ | |
| "$RUNNER_TEMP/prometheusrule.yaml" > "$RUNNER_TEMP/rules.yaml" | |
| "$PROMTOOL" check rules "$RUNNER_TEMP/rules.yaml" | |
| - name: "Run the chart tests" | |
| run: python3 -m unittest discover -s charts/ingot/tests -t charts/ingot/tests -v | |
| - name: "Check the dashboard segment copy against its source" | |
| run: cmp charts/ingot/files/dashboard-segments.json reposilite-frontend/src/router/dashboard-segments.json | |
| - name: "Set up chart-testing" | |
| uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0 | |
| with: | |
| version: "3.14.0" | |
| - name: "Lint the chart with chart-testing" | |
| run: ct lint --config ct.yaml --all | |
| - name: "Set up kind" | |
| uses: helm/kind-action@1544676c07bb3570fcb70166beaa07c4528fd4aa # v1.15.1 | |
| with: | |
| cluster_name: ingot | |
| - name: "Download the container images" | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: container-images | |
| path: ${{ runner.temp }}/container-images | |
| - name: "Load the container images" | |
| run: docker load --input "$RUNNER_TEMP/container-images/ingot-images.tar" | |
| - name: "Load the images into kind" | |
| run: kind load docker-image ingot:ci ingot-dashboard:ci --name ingot | |
| # Installs each ci/*-values.yaml of the chart in turn, with the readiness and liveness probes | |
| # of both workloads, and waits until the pods are ready. | |
| - name: "Install the chart in both deploy modes" | |
| run: ct install --config ct.yaml --all | |
| # The scalable profile is not installed by chart-testing, because the Secrets and the NATS broker it names must sit | |
| # in the release namespace, and chart-testing creates a namespace with a random name per release. The dependencies | |
| # are the throwaway CI manifests of the HA smoke test, applied into ingot-scalable first, and the release waits | |
| # until its Deployments are available. | |
| - name: "Install the scalable profile with its dependencies" | |
| run: | | |
| kubectl create namespace ingot-scalable | |
| sed 's/ingot-ha/ingot-scalable/g' charts/ingot/tests/ha/dependencies.yaml | kubectl apply --namespace ingot-scalable --filename - | |
| kubectl --namespace ingot-scalable wait --for=condition=available deployment/mariadb deployment/floci deployment/nats --timeout=300s | |
| kubectl --namespace ingot-scalable wait --for=condition=complete job/ingot-smoke-bucket --timeout=300s | |
| helm install ingot-scalable charts/ingot --namespace ingot-scalable \ | |
| -f charts/ingot/tests/scalable/values.yaml --wait --timeout 300s | |
| kubectl -n ingot-scalable wait --for=condition=Ready pod -l app.kubernetes.io/instance=ingot-scalable --timeout=300s | |
| # Prints the state of the scalable release and the logs of its pods when the install above fails, because a | |
| # release that never becomes ready says nothing else. | |
| - name: "Print the scalable pods when their install fails" | |
| if: ${{ failure() }} | |
| run: | | |
| kubectl --namespace ingot-scalable get pods,deployments,events --output wide || true | |
| kubectl --namespace ingot-scalable describe pods --selector app.kubernetes.io/instance=ingot-scalable || true | |
| kubectl --namespace ingot-scalable logs --selector app.kubernetes.io/instance=ingot-scalable --all-containers --prefix --tail=300 || true | |
| # The restricted profile is installed into a namespace that enforces the Pod Security | |
| # restricted level, so the API server rejects the pod unless the render meets that level. | |
| # The Deployment is available only when its pod is ready, and the pod wait checks it again. | |
| - name: "Install the restricted profile into a restricted namespace" | |
| run: | | |
| kubectl create namespace ingot-restricted | |
| kubectl label namespace ingot-restricted pod-security.kubernetes.io/enforce=restricted | |
| helm install ingot-restricted charts/ingot --namespace ingot-restricted \ | |
| -f charts/ingot/ci/allinone-values.yaml --set deployment.securityProfile=restricted | |
| kubectl -n ingot-restricted wait --for=condition=available deployment/ingot-restricted --timeout=300s | |
| kubectl -n ingot-restricted wait --for=condition=Ready pod -l app.kubernetes.io/instance=ingot-restricted --timeout=300s | |
| # Runs the server image the way the restricted pod runs it, outside Kubernetes: a read-only | |
| # root filesystem, uid 977, every capability dropped and no privilege escalation. The three | |
| # writable paths are tmpfs mounts, as the emptyDir volumes and the data claim are in the pod. | |
| - name: "Check the server answers health as uid 977 on a read-only root" | |
| run: | | |
| docker run --detach --name ingot-readonly \ | |
| --read-only --user 977:977 --cap-drop ALL --security-opt no-new-privileges \ | |
| --tmpfs /tmp:exec,mode=1777 --tmpfs /var/log/reposilite:uid=977,gid=977 --tmpfs /app/data:uid=977,gid=977 \ | |
| --publish 127.0.0.1:8080:8080 ingot:ci | |
| status=000 | |
| for attempt in $(seq 1 60); do | |
| status=$(curl --silent --output /dev/null --write-out '%{http_code}' http://127.0.0.1:8080/api/status/health || true) | |
| if [ "$status" = "200" ]; then | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| if [ "$status" != "200" ]; then | |
| echo "The health endpoint answered $status, expected 200" | |
| docker logs ingot-readonly | |
| exit 1 | |
| fi | |
| - name: "Remove the read-only container" | |
| if: always() | |
| run: docker rm --force ingot-readonly | |
| # Two server replicas on one MariaDB server, one Floci bucket and one NATS broker, on their own kind cluster. | |
| # The dependencies come from charts/ingot/tests/ha/dependencies.yaml and the replicas from the CI values of the | |
| # same directory. chart-testing never installs those values, so the chart job above is unaffected by them. | |
| # The driver runs five checks: a rolling restart without a failed read, the takeover of a killed cleanup run, | |
| # two deploys at the same moment, a refresh token moved between replicas, and both replicas listing both instances. | |
| ha: | |
| name: "HA smoke test (${{ matrix.database }})" | |
| needs: [ gate, images-build ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || (needs.gate.outputs.ha == 'true' && needs.images-build.result == 'success')) }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| database: [ mariadb, postgresql ] | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Set up Helm" | |
| uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 | |
| with: | |
| version: v4.3.0 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: "3.12" | |
| - name: "Download the container images" | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: container-images | |
| path: ${{ runner.temp }}/container-images | |
| - name: "Load the container images" | |
| run: docker load --input "$RUNNER_TEMP/container-images/ingot-images.tar" | |
| - name: "Set up kind" | |
| uses: helm/kind-action@1544676c07bb3570fcb70166beaa07c4528fd4aa # v1.15.1 | |
| with: | |
| cluster_name: ingot-ha | |
| - name: "Load the images into kind" | |
| run: kind load docker-image ingot:ci ingot-dashboard:ci --name ingot-ha | |
| # Applies the dependencies of the database leg, installs the replicas, and runs the five checks. A failed check | |
| # prints the pod state, the events and the logs of every replica and dependency before the step fails. | |
| - name: "Run the two-replica smoke test" | |
| run: python3 charts/ingot/tests/ha_smoke.py ${{ matrix.database }} | |
| # The browser suite of the dashboard, in its own job so that a failing browser test shows as its own check and does | |
| # not hide the unit tests above. The suite starts the shaded jar itself, so the jar is built on the same runner. | |
| # | |
| # Branch protection names this check once it has been green on main. Protection is a repository setting, so the | |
| # maintainer adds "Dashboard end-to-end" to the required checks after that first green run, not in this file. | |
| # | |
| # Markers: a test that is known to fail carries test.fail(true, '<change or issue>') in reposilite-frontend/e2e. | |
| # Playwright reports a marked test that passes as a failure, so the pull request that fixes a change removes that | |
| # change's markers in the same commit. Markers of still-open changes and issues stay. | |
| e2e: | |
| name: "Dashboard end-to-end" | |
| needs: [ gate ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.e2e == 'true') }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| env: | |
| GRADLE_RETRY: "-Dorg.gradle.internal.repository.max.retries=10 -Dorg.gradle.internal.repository.initial.backoff=2000" | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Validate Gradle wrapper" | |
| uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| - name: "Set up Java" | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: "Set up Gradle" | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| - name: "Set up Node" | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: "reposilite-frontend/package-lock.json" | |
| - name: "Install frontend dependencies" | |
| working-directory: reposilite-frontend | |
| run: npm ci | |
| # Maven Central answers bursts of downloads with 429 Too Many Requests, which failed this job in the merge queue | |
| # before a single browser test ran. Gradle retries a download with a growing pause, as the integration shards do. | |
| - name: "Build the server jar" | |
| run: ./gradlew :reposilite-backend:shadowJar $GRADLE_RETRY | |
| # The suite loads the nexus-import plugin into the server, so its jar is built beside the server jar. The switch | |
| # that turns the plugin on is set by the suite itself, not by this job. | |
| - name: "Build the nexus-import plugin jar" | |
| run: ./gradlew :reposilite-plugins:nexus-import-plugin:shadowJar | |
| # The browser cache is keyed on the Playwright version, so a Playwright bump fetches a new Chromium and nothing else | |
| # does. The install itself still runs on a cache hit: it also installs the system libraries Chromium needs. | |
| - name: "Read the Playwright version" | |
| id: playwright | |
| working-directory: reposilite-frontend | |
| run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT" | |
| - name: "Cache the Playwright browsers" | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: "playwright-chromium-${{ runner.os }}-${{ steps.playwright.outputs.version }}" | |
| - name: "Install the Chromium browser" | |
| working-directory: reposilite-frontend | |
| run: npx playwright install --with-deps chromium | |
| - name: "Run the dashboard end-to-end tests" | |
| working-directory: reposilite-frontend | |
| run: npm run e2e -- --workers=2 | |
| # Only on failure: the traces and screenshots are recorded for failed tests alone, and a green run keeps nothing. | |
| - name: "Publish the end-to-end report" | |
| if: failure() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: dashboard-e2e-report | |
| path: | | |
| reposilite-frontend/playwright-report | |
| reposilite-frontend/test-results | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| # Resolves and compiles everything the integration suite needs, once, before the shards start. Without it each shard | |
| # downloaded the same dependencies from Maven Central, which answers many parallel requests with 429, and compiled the | |
| # same classes. This job runs the Gradle build without a test. Its Gradle caches are saved under a key unique to this | |
| # run attempt, and the shards restore exactly that key. A miss only means the shards download as they did before. | |
| # | |
| # The caches are run-scoped entries, so every heavy run adds one to the repository's 10 GB cache, and GitHub evicts | |
| # the least recently used entries first. The size of one entry depends on the dependency graph, not measured yet. | |
| integration-prepare: | |
| name: "Prepare the integration shards" | |
| needs: [ gate ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.integration == 'true') }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| env: | |
| GRADLE_RETRY: "-Dorg.gradle.internal.repository.max.retries=10 -Dorg.gradle.internal.repository.initial.backoff=2000" | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Set up Java" | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| # Read-only on a pull request: setup-gradle restores the cache of main and never writes one from here. The | |
| # entry this job saves below is the only one the shards read from this run. | |
| - name: "Set up Gradle" | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| - name: "Compile the integration suite and download its plugin jars" | |
| run: ./gradlew --no-daemon --max-workers=2 --build-cache :reposilite-backend:prepareIntegration $GRADLE_RETRY | |
| # Saved only after a successful build. The dependencies and the local build cache are the two directories the | |
| # shards need; the wrapper distribution comes from setup-gradle as before. The key names the run, not the attempt: | |
| # re-running only the failed shards keeps the prepare job's result, and those shards must still find its cache. A | |
| # re-run of the prepare job finds the key taken; the save then only warns, and the first entry stays valid. | |
| - name: "Save the integration caches for the shards" | |
| if: ${{ success() }} | |
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: integration-prepare-${{ github.run_id }} | |
| path: | | |
| ~/.gradle/caches/modules-2 | |
| ~/.gradle/caches/build-cache-1 | |
| # The Testcontainers integration suite, about 108 minutes in full, split into eight shards that run in parallel. Each shard | |
| # takes every eighth top-level class of the suite (build.gradle.kts, integrationShard). A labelled pull request runs the | |
| # integration tests its change can reach (select_backend_tests.py) in every shard, and a release pull request or a manual | |
| # run on main runs the whole suite. A selection that names no integration filter, or a failing script, runs the whole | |
| # suite as well. The aggregate below keeps the check name that branch protection and the judge read. | |
| # | |
| # Free plan: eight shards take eight of the twenty jobs that run at once. Each shard starts its own containers. | |
| # Many shards resolving at once can draw 429 Too Many Requests from Maven Central, so Gradle retries a download up | |
| # to ten times with a growing pause (GRADLE_RETRY below) instead of failing the shard. | |
| integration-shards: | |
| name: "Integration tests shard ${{ matrix.shard }} of 8" | |
| needs: [ gate, integration-prepare ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.integration == 'true') }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [ 0, 1, 2, 3, 4, 5, 6, 7 ] | |
| permissions: | |
| contents: read | |
| env: | |
| # Four forks instead of the two that half of the four runner cores give. Every fork starts its own MariaDB, | |
| # PostgreSQL, S3, NATS and Valkey containers, so memory scales with it. Read by integrationForks() in | |
| # build.gradle.kts. | |
| INGOT_TEST_FORKS: "4" | |
| GRADLE_RETRY: "-Dorg.gradle.internal.repository.max.retries=10 -Dorg.gradle.internal.repository.initial.backoff=2000" | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| # The selection diffs the pull request against its base. | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: "Validate Gradle wrapper" | |
| uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| - name: "Set up Java" | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - name: "Set up Gradle" | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| # The dependencies and the build cache that integration-prepare saved for this run attempt. They are restored over | |
| # the main entry that setup-gradle has just restored: both hold content-addressed files, so the overlay adds what | |
| # this run downloaded or compiled. A miss is not a failure; the shard then downloads and compiles as before. | |
| - name: "Restore the integration caches of the prepare job" | |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| key: integration-prepare-${{ github.run_id }} | |
| path: | | |
| ~/.gradle/caches/modules-2 | |
| ~/.gradle/caches/build-cache-1 | |
| fail-on-cache-miss: false | |
| # Only a labelled pull request on a normal branch gets a partial run. A release pull request, a dispatch, a | |
| # failed gate, a missing diff and a failing script all give mode=full. Every shard computes the same selection | |
| # from the same diff, so the shards agree on it without sharing a file. | |
| - name: "Select the integration tests" | |
| id: select | |
| env: | |
| EVENT: ${{ github.event_name }} | |
| FULL: ${{ needs.gate.outputs.full }} | |
| BASE: ${{ github.event.pull_request.base.sha }} | |
| HEAD: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| selection="$RUNNER_TEMP/integration-selection.txt" | |
| changed="$RUNNER_TEMP/integration-changed.txt" | |
| if [ "$EVENT" != "pull_request" ] || [ "$FULL" = "true" ]; then | |
| printf '%s\n' "mode=full" "reason=a full run was asked for" > "$selection" | |
| elif [ -z "$BASE" ] || [ -z "$HEAD" ] || ! git diff --name-only "$BASE...$HEAD" > "$changed"; then | |
| printf '%s\n' "mode=full" "reason=the pull request diff is not available" > "$selection" | |
| elif ! python3 .github/scripts/select_backend_tests.py < "$changed" > "$selection"; then | |
| printf '%s\n' "mode=full" "reason=the selection script failed" > "$selection" | |
| fi | |
| mode="$(sed -n 's/^mode=//p' "$selection" | head -n 1)" | |
| if [ "$mode" != "partial" ] || ! grep -q '^integration=' "$selection"; then | |
| mode=full | |
| fi | |
| echo "mode=$mode" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "## Integration test selection (shard ${{ matrix.shard }} of 8)" | |
| echo | |
| echo "- Mode: \`$mode\`" | |
| sed -n 's/^reason=/- Reason: /p' "$selection" | |
| sed -n 's/^integration=\(.*\)$/- Filter: `\1`/p' "$selection" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| # A partial selection can leave a shard with no class to run. Gradle then has nothing to execute, which the | |
| # integration task allows for a shard (failOnNoDiscoveredTests is off there) and the other shards still run. | |
| - name: "Run the selected integration tests" | |
| if: ${{ steps.select.outputs.mode == 'partial' }} | |
| run: | | |
| selection="$RUNNER_TEMP/integration-selection.txt" | |
| test_args=() | |
| while IFS= read -r pattern; do test_args+=(--tests "$pattern"); done < <(sed -n 's/^integration=//p' "$selection") | |
| ./gradlew --no-daemon --max-workers=2 --build-cache :reposilite-backend:integration "${test_args[@]}" -PintegrationShard=${{ matrix.shard }} -PintegrationShards=8 $GRADLE_RETRY | |
| - name: "Run the full integration suite" | |
| if: ${{ steps.select.outputs.mode != 'partial' }} | |
| run: ./gradlew --no-daemon --max-workers=2 --build-cache :reposilite-backend:integration -PintegrationShard=${{ matrix.shard }} -PintegrationShards=8 $GRADLE_RETRY | |
| - name: "Publish the integration test report" | |
| if: failure() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: integration-test-report-shard-${{ matrix.shard }} | |
| path: reposilite-backend/build/reports/tests/integration | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| # The aggregate under the check name "Integration tests (backend)". It passes only when the prepare job and every shard | |
| # succeeded. The shards still run when the prepare job fails, so a failed prepare is shown red here, not hidden. It | |
| # has the same condition as the shards, so it is skipped together with them when the gate did not ask for this suite. | |
| integration: | |
| name: "Integration tests (backend)" | |
| needs: [ gate, integration-prepare, integration-shards ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.integration == 'true') }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Check the integration shards" | |
| env: | |
| PREPARE: ${{ needs.integration-prepare.result }} | |
| SHARDS: ${{ needs.integration-shards.result }} | |
| run: | | |
| echo "Integration prepare: $PREPARE. Integration shards: $SHARDS." | |
| test "$PREPARE" = success | |
| test "$SHARDS" = success | |
| # The search backend container tests. The workflow keeps its nightly schedule and is called here for a label. | |
| search: | |
| name: "Search backends" | |
| needs: [ gate ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.search == 'true') }} | |
| permissions: | |
| contents: read | |
| uses: ./.github/workflows/search-backends.yml | |
| # CodeQL. The workflow keeps its push and weekly runs and is called here for a label. Uploading results to code | |
| # scanning is the one write scope of this workflow, and a fork pull request gets a read-only token whatever is asked. | |
| codeql: | |
| name: "CodeQL" | |
| needs: [ gate ] | |
| if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.codeql == 'true') }} | |
| permissions: | |
| contents: read | |
| security-events: write | |
| uses: ./.github/workflows/codeql.yml |