diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 5497cf3e..b72ada23 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -6,13 +6,15 @@ workflows: '.github/workflows/breakglass.yml': [] '.github/workflows/chromium-headful-image.yaml': - 'actions/checkout@v4.4.0' + - 'actions/upload-artifact@v4.6.2' - 'docker/build-push-action@v6.19.2' - - 'docker/login-action@v3.7.0' + - 'docker/login-action@v4.7.0' - 'docker/setup-buildx-action@v3.12.0' '.github/workflows/chromium-headless-image.yaml': - 'actions/checkout@v4.4.0' + - 'actions/upload-artifact@v4.6.2' - 'docker/build-push-action@v6.19.2' - - 'docker/login-action@v3.7.0' + - 'docker/login-action@v4.7.0' - 'docker/setup-buildx-action@v3.12.0' '.github/workflows/chromium-launcher-test.yaml': - 'actions/checkout@v4.4.0' @@ -24,11 +26,12 @@ workflows: '.github/workflows/semgrep.yml': [] '.github/workflows/server-test.yaml': - 'actions/checkout@v4.4.0' + - 'actions/download-artifact@v4.3.0' - 'actions/setup-go@v5.6.0' - 'actions/setup-node@v4.4.0' - 'actions/upload-artifact@v4.6.2' - 'browser-actions/setup-chrome@v2.2.0' - - 'docker/login-action@v3.7.0' + - 'docker/login-action@v4.7.0' - 'pnpm/action-setup@v4.3.0' '.github/workflows/vuln-remediation.yml': [] dependencies: @@ -37,6 +40,11 @@ dependencies: commit: 'sha1-11d5960a326750d5838078e36cf38b85af677262' owner_id: 44036562 repo_id: 197814629 + 'actions/download-artifact@v4.3.0': + ref: 'v4.3.0' + commit: 'sha1-d3f86a106a0bac45b974a628896c90dbdf5c8093' + owner_id: 44036562 + repo_id: 192626254 'actions/setup-go@v5.6.0': ref: 'v5.6.0' commit: 'sha1-40f1582b2485089dde7abd97c1529aa768e1baff' @@ -62,9 +70,9 @@ dependencies: commit: 'sha1-10e90e3645eae34f1e60eeb005ba3a3d33f178e8' owner_id: 5429470 repo_id: 241092383 - 'docker/login-action@v3.7.0': - ref: 'v3.7.0' - commit: 'sha1-c94ce9fb468520275223c153574b00df6fe4bcc9' + 'docker/login-action@v4.7.0': + ref: 'v4.7.0' + commit: 'sha1-81c6f93d4bc991e510b342a00b419b3bb4efc5c6' owner_id: 5429470 repo_id: 287743349 'docker/setup-buildx-action@v3.12.0': diff --git a/.github/workflows/chromium-headful-image.yaml b/.github/workflows/chromium-headful-image.yaml index 5a6022c7..3df72f11 100644 --- a/.github/workflows/chromium-headful-image.yaml +++ b/.github/workflows/chromium-headful-image.yaml @@ -5,13 +5,12 @@ on: jobs: docker: - # Fork PRs get no secrets and now must not reach the self-hosted pool - # either: skipping here (rather than failing at registry login, as - # before) also skips the dependent e2e job via its needs chain. - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + # Do not run builds from forks on self-hosted runners. + if: github.repository == 'kernel/kernel-images' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) runs-on: [self-hosted, linux] permissions: contents: read + id-token: write steps: - name: Checkout uses: actions/checkout@v4.4.0 @@ -43,11 +42,13 @@ jobs: # that root-run CI from other repos clobbers to root-owned. echo "BUILDX_CONFIG=${HOME}/.docker/buildx-ci" >> "$GITHUB_ENV" - - name: Login to Docker Hub - uses: docker/login-action@v3.7.0 + - name: Login to Docker Hub with OIDC + uses: docker/login-action@v4.7.0 with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: onkernel + env: + DOCKERHUB_OIDC_CONNECTIONID: ${{ github.ref == 'refs/heads/main' && 'cd45e363-f834-4656-aec5-958933af9848' || 'e87832ce-a4e3-4386-8b17-44a6085109f2' }} + DOCKERHUB_OIDC_EXPIREIN: '3600' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.12.0 @@ -56,11 +57,27 @@ jobs: cleanup: false buildkitd-config: .github/buildkitd.toml - - name: Build and push + - name: Build image uses: docker/build-push-action@v6.19.2 with: builder: deft-shared context: . file: images/chromium-headful/Dockerfile - push: true + push: ${{ github.ref == 'refs/heads/main' }} + outputs: ${{ github.ref != 'refs/heads/main' && format('type=docker,dest={0}/chromium-headful.tar', runner.temp) || '' }} tags: onkernel/chromium-headful:${{ steps.vars.outputs.short_sha }} + + - name: Upload test image + if: github.ref != 'refs/heads/main' + uses: actions/upload-artifact@v4.6.2 + with: + name: chromium-headful-image + path: ${{ runner.temp }}/chromium-headful.tar + if-no-files-found: error + compression-level: 1 + retention-days: 3 + overwrite: true + + - name: Remove test image archive + if: ${{ always() && github.ref != 'refs/heads/main' }} + run: rm -f "$RUNNER_TEMP/chromium-headful.tar" diff --git a/.github/workflows/chromium-headless-image.yaml b/.github/workflows/chromium-headless-image.yaml index aa48398d..4dec6733 100644 --- a/.github/workflows/chromium-headless-image.yaml +++ b/.github/workflows/chromium-headless-image.yaml @@ -5,13 +5,12 @@ on: jobs: docker: - # Fork PRs get no secrets and now must not reach the self-hosted pool - # either: skipping here (rather than failing at registry login, as - # before) also skips the dependent e2e job via its needs chain. - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + # Do not run builds from forks on self-hosted runners. + if: github.repository == 'kernel/kernel-images' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) runs-on: [self-hosted, linux] permissions: contents: read + id-token: write steps: - name: Checkout uses: actions/checkout@v4.4.0 @@ -43,11 +42,13 @@ jobs: # that root-run CI from other repos clobbers to root-owned. echo "BUILDX_CONFIG=${HOME}/.docker/buildx-ci" >> "$GITHUB_ENV" - - name: Login to Docker Hub - uses: docker/login-action@v3.7.0 + - name: Login to Docker Hub with OIDC + uses: docker/login-action@v4.7.0 with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: onkernel + env: + DOCKERHUB_OIDC_CONNECTIONID: ${{ github.ref == 'refs/heads/main' && 'cd45e363-f834-4656-aec5-958933af9848' || 'e87832ce-a4e3-4386-8b17-44a6085109f2' }} + DOCKERHUB_OIDC_EXPIREIN: '3600' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.12.0 @@ -56,11 +57,27 @@ jobs: cleanup: false buildkitd-config: .github/buildkitd.toml - - name: Build and push + - name: Build image uses: docker/build-push-action@v6.19.2 with: builder: deft-shared context: . file: images/chromium-headless/image/Dockerfile - push: true + push: ${{ github.ref == 'refs/heads/main' }} + outputs: ${{ github.ref != 'refs/heads/main' && format('type=docker,dest={0}/chromium-headless.tar', runner.temp) || '' }} tags: onkernel/chromium-headless:${{ steps.vars.outputs.short_sha }} + + - name: Upload test image + if: github.ref != 'refs/heads/main' + uses: actions/upload-artifact@v4.6.2 + with: + name: chromium-headless-image + path: ${{ runner.temp }}/chromium-headless.tar + if-no-files-found: error + compression-level: 1 + retention-days: 3 + overwrite: true + + - name: Remove test image archive + if: ${{ always() && github.ref != 'refs/heads/main' }} + run: rm -f "$RUNNER_TEMP/chromium-headless.tar" diff --git a/.github/workflows/server-test.yaml b/.github/workflows/server-test.yaml index 4aba2083..8de67dc8 100644 --- a/.github/workflows/server-test.yaml +++ b/.github/workflows/server-test.yaml @@ -13,10 +13,16 @@ concurrency: jobs: build-headful: + permissions: + contents: read + id-token: write uses: ./.github/workflows/chromium-headful-image.yaml secrets: inherit build-headless: + permissions: + contents: read + id-token: write uses: ./.github/workflows/chromium-headless-image.yaml secrets: inherit @@ -67,6 +73,7 @@ jobs: needs: [build-headful, build-headless] permissions: contents: read + id-token: write steps: - name: Checkout code @@ -119,13 +126,16 @@ jobs: shell: bash run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" - - name: Login to Docker Hub - uses: docker/login-action@v3.7.0 + - name: Login to Docker Hub with OIDC + uses: docker/login-action@v4.7.0 with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: onkernel + env: + DOCKERHUB_OIDC_CONNECTIONID: e87832ce-a4e3-4386-8b17-44a6085109f2 + DOCKERHUB_OIDC_EXPIREIN: '3600' - - name: Pull e2e images + - name: Pull published images + if: github.ref == 'refs/heads/main' shell: bash run: | set -euo pipefail @@ -142,6 +152,23 @@ jobs: E2E_CHROMIUM_HEADFUL_IMAGE: onkernel/chromium-headful:${{ steps.vars.outputs.short_sha }} E2E_CHROMIUM_HEADLESS_IMAGE: onkernel/chromium-headless:${{ steps.vars.outputs.short_sha }} + - name: Download test images + if: github.ref != 'refs/heads/main' + uses: actions/download-artifact@v4.3.0 + with: + pattern: chromium-*-image + path: ${{ runner.temp }}/chromium-images + merge-multiple: true + + - name: Load test images + if: github.ref != 'refs/heads/main' + run: | + for image in chromium-headful chromium-headless; do + archive="$RUNNER_TEMP/chromium-images/$image.tar" + docker load -i "$archive" + rm "$archive" + done + - name: Run server e2e tests run: make test-e2e working-directory: server