From 235a43225b94c4740ea33deba36c9cd94f8444c6 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 30 Nov 2026 19:18:51 +0000 Subject: [PATCH] chore(github): add the repository bot baseline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quality req 014 (Main 2.0 SECURITE by operator order; Allstar dropped): CODEOWNERS with the owner for every path; dependabot.yml with pip security updates only (open-pull-requests-limit 0, one security group), github-actions and docker weekly grouped version updates, only the existing dependencies label; security-scorecard.yml standalone with pinned actions. Virgin tests without code in code (operator denial d8b0c6c8): the inline bash -lc scripts leave the workflow for scripts/test/virgin/run.sh, root.sh, user.sh and dev.sh, each called with bash -l; test-virgin.yml is one matrix job (mode x distro) whose run step only calls run.sh, matrix values reach the shell through env. test-virgin-user.yml and test-virgin-root.yml are removed, the workflow folder stays at 15 files. | 🌿 Branch | 📊 Diff stat | 🎯 Fix | 💥 Break | 💸 Tokens | ⏱️ Velocity | 🛡️ Security | 🏆 Score | Gate | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | chore/repository-bot-baseline | 11 files +168/-138 | 90 % | 4 % | – | – | 100 % | 86 | ✅ 90/5, tokens and velocity <= 100, security 100 % | Evidence: shellcheck -x clean on the four scripts, actionlint clean on test-virgin.yml, ci.yml and security-scorecard.yml, yamllint clean on dependabot.yml, MEDUSA 100 % critical 0. Break 4 %: virgin rework unproven until PR CI; check names become test-virgin / test-virgin (mode, distro). Operator review 7bed4c46 (re-card of fa241c7b). Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- .github/CODEOWNERS | 1 + .github/dependabot.yml | 27 +++++++--- .github/workflows/ci.yml | 9 +--- .github/workflows/security-scorecard.yml | 41 ++++++++++++++ .github/workflows/test-virgin-root.yml | 56 ------------------- .github/workflows/test-virgin-user.yml | 68 ------------------------ .github/workflows/test-virgin.yml | 34 ++++++++++++ scripts/test/virgin/dev.sh | 13 +++++ scripts/test/virgin/root.sh | 15 ++++++ scripts/test/virgin/run.sh | 22 ++++++++ scripts/test/virgin/user.sh | 20 +++++++ 11 files changed, 168 insertions(+), 138 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/security-scorecard.yml delete mode 100644 .github/workflows/test-virgin-root.yml delete mode 100644 .github/workflows/test-virgin-user.yml create mode 100644 .github/workflows/test-virgin.yml create mode 100755 scripts/test/virgin/dev.sh create mode 100755 scripts/test/virgin/root.sh create mode 100755 scripts/test/virgin/run.sh create mode 100755 scripts/test/virgin/user.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..85fb3b3 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @kevinveenbirkenbach diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c09ab22..480ecf5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,19 +5,32 @@ updates: directory: "/" schedule: interval: "weekly" - day: "monday" - time: "00:00" - rebase-strategy: "auto" + open-pull-requests-limit: 0 + groups: + pip-security: + applies-to: security-updates + patterns: ["*"] labels: - "dependencies" - - "python" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" - day: "monday" - time: "00:00" + groups: + github-actions: + applies-to: version-updates + patterns: ["*"] + labels: + - "dependencies" + + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" + groups: + docker: + applies-to: version-updates + patterns: ["*"] labels: - "dependencies" - - "ci" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 765c850..7edfe54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,15 +46,10 @@ jobs: contents: read uses: ./.github/workflows/test-e2e.yml - test-virgin-user: + test-virgin: permissions: contents: read - uses: ./.github/workflows/test-virgin-user.yml - - test-virgin-root: - permissions: - contents: read - uses: ./.github/workflows/test-virgin-root.yml + uses: ./.github/workflows/test-virgin.yml lint-shell: permissions: diff --git a/.github/workflows/security-scorecard.yml b/.github/workflows/security-scorecard.yml new file mode 100644 index 0000000..d201abd --- /dev/null +++ b/.github/workflows/security-scorecard.yml @@ -0,0 +1,41 @@ +name: Scorecard supply-chain security + +on: + branch_protection_rule: + schedule: + - cron: '00 00 * * *' + push: + branches: [ "main" ] + +concurrency: + group: scorecard-${{ github.repository }}-${{ github.ref_name }} + cancel-in-progress: true + +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + if: github.event.repository.default_branch == github.ref_name + permissions: + security-events: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4.2.2 + with: + persist-credentials: false + + - name: Run analysis + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - name: Upload to code-scanning + uses: github/codeql-action/upload-sarif@v4 + with: + sarif_file: results.sarif diff --git a/.github/workflows/test-virgin-root.yml b/.github/workflows/test-virgin-root.yml deleted file mode 100644 index 38c2ad2..0000000 --- a/.github/workflows/test-virgin-root.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Test Virgin Root - -on: - workflow_call: - -permissions: - contents: read - -jobs: - test-virgin-root: - runs-on: ubuntu-latest - timeout-minutes: 45 - strategy: - fail-fast: false - matrix: - distro: [arch, debian, ubuntu, fedora, centos] - env: - NIX_CONFIG: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - steps: - - name: Checkout repository - uses: actions/checkout@v7 - - - name: Show Docker version - run: docker version - - - name: Pull base image (${{ matrix.distro }}) - run: docker pull "ghcr.io/kevinveenbirkenbach/base-${{ matrix.distro }}:latest" - - - name: Virgin ${{ matrix.distro }} pkgmgr test (root) - run: | - set -euo pipefail - - docker run --rm \ - -v "$PWD":/opt/src/pkgmgr \ - -v pkgmgr_repos:/root/Repositories \ - -v pkgmgr_pip_cache:/root/.cache/pip \ - -e NIX_CONFIG="${NIX_CONFIG}" \ - -w /opt/src/pkgmgr \ - "ghcr.io/kevinveenbirkenbach/base-${{ matrix.distro }}:latest" \ - bash -lc ' - set -euo pipefail - - git config --global --add safe.directory /opt/src/pkgmgr - - make install - make setup - - . "$HOME/.venvs/pkgmgr/bin/activate" - - pkgmgr update pkgmgr --clone-mode shallow --no-verification - pkgmgr version pkgmgr - - echo ">>> Running Nix-based: nix run .#pkgmgr -- version pkgmgr" - nix run /opt/src/pkgmgr#pkgmgr -- version pkgmgr - ' diff --git a/.github/workflows/test-virgin-user.yml b/.github/workflows/test-virgin-user.yml deleted file mode 100644 index 2345b47..0000000 --- a/.github/workflows/test-virgin-user.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Test Virgin User - -on: - workflow_call: - -permissions: - contents: read - -jobs: - test-virgin-user: - runs-on: ubuntu-latest - timeout-minutes: 45 - strategy: - fail-fast: false - matrix: - distro: [arch, debian, ubuntu, fedora, centos] - env: - NIX_CONFIG: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - steps: - - name: Checkout repository - uses: actions/checkout@v7 - - - name: Show Docker version - run: docker version - - - name: Pull base image (${{ matrix.distro }}) - run: docker pull "ghcr.io/kevinveenbirkenbach/base-${{ matrix.distro }}:latest" - - - name: Virgin ${{ matrix.distro }} pkgmgr test (user) - run: | - set -euo pipefail - - docker run --rm \ - -v "$PWD":/opt/src/pkgmgr \ - -e NIX_CONFIG="${NIX_CONFIG}" \ - -w /opt/src/pkgmgr \ - "ghcr.io/kevinveenbirkenbach/base-${{ matrix.distro }}:latest" \ - bash -lc ' - set -euo pipefail - - make install - - useradd -m dev - echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/dev - chmod 0440 /etc/sudoers.d/dev - chown -R dev:dev /opt/src/pkgmgr - - mkdir -p /nix/store /nix/var/nix /nix/var/log/nix /nix/var/nix/profiles - chown -R dev:dev /nix - chmod 0755 /nix - chmod 1777 /nix/store - sudo -H -u dev env \ - HOME=/home/dev \ - NIX_CONFIG="$NIX_CONFIG" \ - PKGMGR_DISABLE_NIX_FLAKE_INSTALLER=1 \ - bash -lc " - set -euo pipefail - cd /opt/src/pkgmgr - make setup-venv - . \"\$HOME/.venvs/pkgmgr/bin/activate\" - - pkgmgr version pkgmgr - - export NIX_REMOTE=local - nix run /opt/src/pkgmgr#pkgmgr -- version pkgmgr - " - ' diff --git a/.github/workflows/test-virgin.yml b/.github/workflows/test-virgin.yml new file mode 100644 index 0000000..b238765 --- /dev/null +++ b/.github/workflows/test-virgin.yml @@ -0,0 +1,34 @@ +name: Test Virgin + +on: + workflow_call: + +permissions: + contents: read + +jobs: + test-virgin: + runs-on: ubuntu-latest + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + mode: [user, root] + distro: [arch, debian, ubuntu, fedora, centos] + env: + NIX_CONFIG: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + MODE: ${{ matrix.mode }} + DISTRO: ${{ matrix.distro }} + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Show Docker version + run: docker version + + - name: Pull base image (${{ matrix.distro }}) + run: docker pull "ghcr.io/kevinveenbirkenbach/base-${DISTRO}:latest" + + - name: Virgin ${{ matrix.distro }} pkgmgr test (${{ matrix.mode }}) + run: bash scripts/test/virgin/run.sh "$MODE" "$DISTRO" diff --git a/scripts/test/virgin/dev.sh b/scripts/test/virgin/dev.sh new file mode 100755 index 0000000..e72d09c --- /dev/null +++ b/scripts/test/virgin/dev.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd /opt/src/pkgmgr +make setup-venv + +# shellcheck source=/dev/null +. "$HOME/.venvs/pkgmgr/bin/activate" + +pkgmgr version pkgmgr + +export NIX_REMOTE=local +nix run /opt/src/pkgmgr#pkgmgr -- version pkgmgr diff --git a/scripts/test/virgin/root.sh b/scripts/test/virgin/root.sh new file mode 100755 index 0000000..a731539 --- /dev/null +++ b/scripts/test/virgin/root.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +git config --global --add safe.directory /opt/src/pkgmgr + +make install +make setup + +# shellcheck source=/dev/null +. "$HOME/.venvs/pkgmgr/bin/activate" + +pkgmgr update pkgmgr --clone-mode shallow --no-verification +pkgmgr version pkgmgr + +nix run /opt/src/pkgmgr#pkgmgr -- version pkgmgr diff --git a/scripts/test/virgin/run.sh b/scripts/test/virgin/run.sh new file mode 100755 index 0000000..5858b4c --- /dev/null +++ b/scripts/test/virgin/run.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail + +mode="$1" +distro="$2" + +case "$mode" in + root) volumes=(-v pkgmgr_repos:/root/Repositories -v pkgmgr_pip_cache:/root/.cache/pip) ;; + user) volumes=() ;; + *) + echo "usage: $0 root|user " >&2 + exit 2 + ;; +esac + +docker run --rm \ + -v "$PWD":/opt/src/pkgmgr \ + "${volumes[@]}" \ + -e NIX_CONFIG="${NIX_CONFIG}" \ + -w /opt/src/pkgmgr \ + "ghcr.io/kevinveenbirkenbach/base-${distro}:latest" \ + bash -l "scripts/test/virgin/${mode}.sh" diff --git a/scripts/test/virgin/user.sh b/scripts/test/virgin/user.sh new file mode 100755 index 0000000..71025d2 --- /dev/null +++ b/scripts/test/virgin/user.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +make install + +useradd -m dev +echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/dev +chmod 0440 /etc/sudoers.d/dev +chown -R dev:dev /opt/src/pkgmgr + +mkdir -p /nix/store /nix/var/nix /nix/var/log/nix /nix/var/nix/profiles +chown -R dev:dev /nix +chmod 0755 /nix +chmod 1777 /nix/store + +sudo -H -u dev env \ + HOME=/home/dev \ + NIX_CONFIG="$NIX_CONFIG" \ + PKGMGR_DISABLE_NIX_FLAKE_INSTALLER=1 \ + bash -l /opt/src/pkgmgr/scripts/test/virgin/dev.sh