|
| 1 | +name: Candidate dress rehearsal |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: [CI] |
| 6 | + types: [completed] |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: 1helm-private-dress-rehearsal |
| 14 | + cancel-in-progress: false |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: Build exact trusted-main Linux candidate |
| 19 | + if: >- |
| 20 | + github.event.workflow_run.conclusion == 'success' && |
| 21 | + github.event.workflow_run.event == 'push' && |
| 22 | + github.event.workflow_run.head_branch == 'main' && |
| 23 | + github.event.workflow_run.head_repository.full_name == github.repository && |
| 24 | + github.event.repository.full_name == github.repository && |
| 25 | + github.sha == github.event.workflow_run.head_sha && |
| 26 | + github.ref == 'refs/heads/main' |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 60 |
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + id-token: write |
| 32 | + attestations: write |
| 33 | + outputs: |
| 34 | + artifact-name: ${{ steps.identity.outputs.artifact_name }} |
| 35 | + commit: ${{ steps.identity.outputs.commit }} |
| 36 | + steps: |
| 37 | + - name: Check out the exact successful CI commit |
| 38 | + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 |
| 39 | + with: |
| 40 | + ref: ${{ github.event.workflow_run.head_sha }} |
| 41 | + fetch-depth: 1 |
| 42 | + persist-credentials: false |
| 43 | + |
| 44 | + - name: Re-verify trusted repository, ref, event, and SHA |
| 45 | + env: |
| 46 | + CI_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} |
| 47 | + CI_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} |
| 48 | + CI_HEAD_REPOSITORY: ${{ github.event.workflow_run.head_repository.full_name }} |
| 49 | + CI_EVENT: ${{ github.event.workflow_run.event }} |
| 50 | + CI_CONCLUSION: ${{ github.event.workflow_run.conclusion }} |
| 51 | + CI_WORKFLOW: ${{ github.event.workflow_run.name }} |
| 52 | + run: | |
| 53 | + set -euo pipefail |
| 54 | + test "$GITHUB_REPOSITORY" = "gitcommit90/1Helm" |
| 55 | + test "$CI_HEAD_REPOSITORY" = "$GITHUB_REPOSITORY" |
| 56 | + test "$CI_HEAD_BRANCH" = "main" |
| 57 | + test "$CI_EVENT" = "push" |
| 58 | + test "$CI_CONCLUSION" = "success" |
| 59 | + test "$CI_WORKFLOW" = "CI" |
| 60 | + test "$GITHUB_REF" = "refs/heads/main" |
| 61 | + test "$GITHUB_SHA" = "$CI_HEAD_SHA" |
| 62 | + test "$(git rev-parse HEAD)" = "$CI_HEAD_SHA" |
| 63 | + test -z "$(git status --porcelain)" |
| 64 | +
|
| 65 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 66 | + with: |
| 67 | + node-version: "22" |
| 68 | + cache: npm |
| 69 | + |
| 70 | + - name: Install exact dependencies and builder runtime |
| 71 | + run: | |
| 72 | + set -euo pipefail |
| 73 | + PUPPETEER_SKIP_DOWNLOAD=1 npm ci |
| 74 | + sudo apt-get update |
| 75 | + sudo apt-get install -y podman |
| 76 | +
|
| 77 | + - name: Build sealed OCI image and ready-to-run Linux archive |
| 78 | + env: |
| 79 | + HELM_CANDIDATE_REPOSITORY: gitcommit90/1Helm |
| 80 | + HELM_CANDIDATE_REF: refs/heads/main |
| 81 | + HELM_CANDIDATE_COMMIT: ${{ github.event.workflow_run.head_sha }} |
| 82 | + HELM_CANDIDATE_SOURCE_STATE: trusted-main |
| 83 | + HELM_CANDIDATE_BUILD_ID: candidate-${{ github.event.workflow_run.id }}-${{ github.run_id }}.${{ github.run_attempt }} |
| 84 | + HELM_CANDIDATE_CREATED_AT: ${{ github.event.workflow_run.updated_at }} |
| 85 | + HELM_CANDIDATE_CI_WORKFLOW: CI |
| 86 | + HELM_CANDIDATE_CI_RUN_ID: ${{ github.event.workflow_run.id }} |
| 87 | + HELM_CANDIDATE_CI_CONCLUSION: success |
| 88 | + run: | |
| 89 | + set -euo pipefail |
| 90 | + npm run package:channel-image |
| 91 | + npm run package:linux |
| 92 | +
|
| 93 | + - name: Generate candidate manifest and evidence |
| 94 | + id: identity |
| 95 | + env: |
| 96 | + CI_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} |
| 97 | + run: | |
| 98 | + set -euo pipefail |
| 99 | + version="$(node -p 'require("./package.json").version')" |
| 100 | + archive="dist/1Helm-${version}-linux-node.tgz" |
| 101 | + evidence="dist/candidate-evidence" |
| 102 | + mkdir -p "$evidence" |
| 103 | + HELM_CANDIDATE_ARCHIVE="$archive" \ |
| 104 | + HELM_CANDIDATE_MANIFEST="$evidence/candidate.json" \ |
| 105 | + node scripts/candidate-manifest.mjs |
| 106 | + cp "$archive.sha256" "$evidence/archive.sha256" |
| 107 | + sha256sum "$evidence/candidate.json" > "$evidence/manifest.sha256" |
| 108 | + printf 'artifact_name=1helm-candidate-%s\n' "$CI_HEAD_SHA" >> "$GITHUB_OUTPUT" |
| 109 | + printf 'commit=%s\n' "$CI_HEAD_SHA" >> "$GITHUB_OUTPUT" |
| 110 | +
|
| 111 | + - name: Attest archive provenance on the hosted builder |
| 112 | + id: attest |
| 113 | + uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3 |
| 114 | + with: |
| 115 | + subject-path: dist/1Helm-*-linux-node.tgz |
| 116 | + |
| 117 | + - name: Retain signed provenance bundle |
| 118 | + env: |
| 119 | + BUNDLE_PATH: ${{ steps.attest.outputs.bundle-path }} |
| 120 | + run: | |
| 121 | + set -euo pipefail |
| 122 | + test -s "$BUNDLE_PATH" |
| 123 | + install -m 0644 "$BUNDLE_PATH" dist/candidate-evidence/provenance.bundle.json |
| 124 | +
|
| 125 | + - name: Upload exact candidate and evidence |
| 126 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 127 | + with: |
| 128 | + name: ${{ steps.identity.outputs.artifact_name }} |
| 129 | + path: | |
| 130 | + dist/1Helm-*-linux-node.tgz |
| 131 | + dist/candidate-evidence/candidate.json |
| 132 | + dist/candidate-evidence/archive.sha256 |
| 133 | + dist/candidate-evidence/manifest.sha256 |
| 134 | + dist/candidate-evidence/provenance.bundle.json |
| 135 | + if-no-files-found: error |
| 136 | + retention-days: 30 |
| 137 | + |
| 138 | + deploy: |
| 139 | + name: Install only on private Phase 2 dress rehearsal |
| 140 | + needs: build |
| 141 | + runs-on: [1helm-dress-rehearsal-phase2] |
| 142 | + timeout-minutes: 20 |
| 143 | + permissions: |
| 144 | + contents: read |
| 145 | + actions: read |
| 146 | + steps: |
| 147 | + - name: Download this workflow's exact candidate |
| 148 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 |
| 149 | + with: |
| 150 | + name: ${{ needs.build.outputs.artifact-name }} |
| 151 | + path: candidate-download |
| 152 | + |
| 153 | + - name: Submit fixed candidate inputs to the root-owned boundary |
| 154 | + env: |
| 155 | + EXPECTED_COMMIT: ${{ needs.build.outputs.commit }} |
| 156 | + run: | |
| 157 | + set -euo pipefail |
| 158 | + test "$GITHUB_REPOSITORY" = "gitcommit90/1Helm" |
| 159 | + test "$EXPECTED_COMMIT" = "${{ github.event.workflow_run.head_sha }}" |
| 160 | + test "${{ github.event.workflow_run.head_branch }}" = "main" |
| 161 | + test "${{ github.event.workflow_run.head_repository.full_name }}" = "$GITHUB_REPOSITORY" |
| 162 | + test "${{ github.event.workflow_run.conclusion }}" = "success" |
| 163 | + archive="$(find candidate-download -maxdepth 1 -type f -name '1Helm-*-linux-node.tgz' -print -quit)" |
| 164 | + test -n "$archive" |
| 165 | + install -m 0600 "$archive" /var/lib/1helm-candidate/inbox/candidate.tgz |
| 166 | + install -m 0600 candidate-download/candidate-evidence/candidate.json /var/lib/1helm-candidate/inbox/candidate.json |
| 167 | + install -m 0600 candidate-download/candidate-evidence/provenance.bundle.json /var/lib/1helm-candidate/inbox/provenance.bundle.json |
| 168 | + sudo -n /usr/local/sbin/1helm-candidate-install |
| 169 | +
|
| 170 | + - name: Publish private installation evidence in the job log |
| 171 | + if: always() |
| 172 | + run: | |
| 173 | + test -r /var/lib/1helm-candidate/evidence/status.json |
| 174 | + python3 /usr/local/lib/1helm-candidate/candidate-boundary.py summary \ |
| 175 | + /var/lib/1helm-candidate/evidence/status.json |
0 commit comments