Repository navigation
ci: daily check that nss-rs still builds against NSS head #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9c80d77
dfecc4a
7364885
b801415
7e78b0b
de172d4
faf0bc4
f5c58b7
46fd037
d62e2e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||
| # Build the NSS checkout at $NSS_DIR, then build and test nss-rs against it. | ||||||||||||||
| # Expects the environment mozilla/actions/nss sets up with 'deps-only'. Also the | ||||||||||||||
| # `git bisect run` predicate, so it runs from an arbitrary cwd and must not let | ||||||||||||||
| # one revision's artifacts decide the next revision's verdict. | ||||||||||||||
| set -o pipefail | ||||||||||||||
|
|
||||||||||||||
| : "${NSS_DIR:?set by mozilla/actions/nss}" | ||||||||||||||
| : "${NSS_BUILD_FLAGS:?set by mozilla/actions/nss}" | ||||||||||||||
| : "${NSS_RS_DIR:?must point at the nss-rs checkout}" | ||||||||||||||
|
|
||||||||||||||
| # Or build.rs builds NSS again, with its own flags. | ||||||||||||||
| export NSS_PREBUILT=1 | ||||||||||||||
|
|
||||||||||||||
| # build.rs reads $NSS_DIR/../dist, so a stale tree would mask a failed build. | ||||||||||||||
| rm -rf "${NSS_DIR}/../dist" || exit 125 | ||||||||||||||
|
|
||||||||||||||
| [ "${SCCACHE_CC:-}" ] && [ "${SCCACHE_CXX:-}" ] && export CC="$SCCACHE_CC" CXX="$SCCACHE_CXX" | ||||||||||||||
| # Conditional, because an empty CFLAGS on Windows would override MSVC defaults. | ||||||||||||||
| [ -n "${NSS_BUILD_CFLAGS:-}" ] && export CFLAGS="$NSS_BUILD_CFLAGS" | ||||||||||||||
| # 125 is `git bisect` for "untestable": don't blame a revision NSS can't build. | ||||||||||||||
| # shellcheck disable=SC2086 | ||||||||||||||
| "$NSS_DIR/build.sh" $NSS_BUILD_FLAGS || exit 125 | ||||||||||||||
|
|
||||||||||||||
| cd "$NSS_RS_DIR" || exit 125 | ||||||||||||||
| # Nothing tells cargo that dist changed, so force the bindings to regenerate. | ||||||||||||||
| cargo clean -p nss-rs || exit 125 | ||||||||||||||
|
Comment on lines
+24
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warning The script's own failures reuse 125, which the workflow reads as "NSS head does not build".
An exit code
Suggested change
Line 16 wants the same treatment; |
||||||||||||||
| cargo test --locked || exit $? | ||||||||||||||
| cargo test --locked --features blapi | ||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,325 @@ | ||||||||||||||||||||||||
| name: NSS head | ||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||
| schedule: | ||||||||||||||||||||||||
| - cron: "17 5 * * *" | ||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||
| last-good: | ||||||||||||||||||||||||
| description: "NSS commit to bisect from, overriding the cached one." | ||||||||||||||||||||||||
| default: "" | ||||||||||||||||||||||||
| dry-run: | ||||||||||||||||||||||||
| description: "Log the Bugzilla changes instead of making them." | ||||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||||
| default: false | ||||||||||||||||||||||||
| test-bugzilla: | ||||||||||||||||||||||||
| description: "Report to the Bugzilla dev instance, using BUGZILLA_TEST_API_KEY." | ||||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||||
| default: false | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| concurrency: | ||||||||||||||||||||||||
| group: ${{ github.workflow }} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| defaults: | ||||||||||||||||||||||||
| run: | ||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| CARGO_TERM_COLOR: never | ||||||||||||||||||||||||
| RUST_BACKTRACE: 1 | ||||||||||||||||||||||||
| NSS_REPO: https://github.com/mozilla/nss.git | ||||||||||||||||||||||||
| NSPR_REPO: https://github.com/mozilla/nspr.git | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||
| # Pinned once, so that every platform reports on the same revision. | ||||||||||||||||||||||||
| setup: | ||||||||||||||||||||||||
| name: Resolve NSS head | ||||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||||
| outputs: | ||||||||||||||||||||||||
| head: ${{ steps.head.outputs.sha }} | ||||||||||||||||||||||||
| nspr: ${{ steps.head.outputs.nspr }} | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - id: head | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| nss=$(git ls-remote "$NSS_REPO" HEAD | cut -f1) | ||||||||||||||||||||||||
| nspr=$(git ls-remote "$NSPR_REPO" HEAD | cut -f1) | ||||||||||||||||||||||||
| if [ -z "$nss" ] || [ -z "$nspr" ]; then | ||||||||||||||||||||||||
| echo "::error::Could not resolve NSS or NSPR HEAD"; exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| echo "Testing NSS $nss with NSPR $nspr" | ||||||||||||||||||||||||
| { echo "sha=$nss"; echo "nspr=$nspr"; } >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| head: | ||||||||||||||||||||||||
| name: NSS head on ${{ matrix.os }} | ||||||||||||||||||||||||
| needs: setup | ||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||
| fail-fast: false # Every platform's verdict goes into one report. | ||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||
| os: | ||||||||||||||||||||||||
| - ubuntu-24.04 | ||||||||||||||||||||||||
| - ubuntu-24.04-arm | ||||||||||||||||||||||||
| - macos-15 | ||||||||||||||||||||||||
| - windows-2025 | ||||||||||||||||||||||||
| - ubuntu-22.04 | ||||||||||||||||||||||||
| - macos-14 | ||||||||||||||||||||||||
| - windows-2022 | ||||||||||||||||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||||||||||||||||
| # A bisect over a release's worth of NSS commits is ~7 from-scratch builds. | ||||||||||||||||||||||||
| timeout-minutes: 330 | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| # NSS_DIR, NSS_PREBUILT and NSS_BUILD_FLAGS come from mozilla/actions/nss. | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note Stale after the last round:
Suggested change
|
||||||||||||||||||||||||
| NSS_RS_DIR: ${{ github.workspace }} | ||||||||||||||||||||||||
| HEAD_SHA: ${{ needs.setup.outputs.head }} | ||||||||||||||||||||||||
| CACHE_KEY: nss-last-good-${{ matrix.os }} | ||||||||||||||||||||||||
| # Absolute, because `git bisect run` invokes it from the NSS checkout. | ||||||||||||||||||||||||
| CHECK: ${{ github.workspace }}/.github/scripts/nss-check.sh | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| persist-credentials: false | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - uses: mozilla/actions/rust@f8e0d5c4cff5006ee24b6356272d47c9911450d1 # v2.0.6 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| version: stable | ||||||||||||||||||||||||
| token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||
| rust-cache: false | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - id: meta | ||||||||||||||||||||||||
| uses: $/.github/actions/nss-metadata | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - uses: mozilla/actions/nss@264c6b750df669adb58286a26c5d0e04e839e06b # v2.0.8 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| deps-only: true | ||||||||||||||||||||||||
|
Comment on lines
+89
to
+94
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note This is
Suggested change
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Full history for the bisect range and tags; build.sh wants NSPR beside NSS. | ||||||||||||||||||||||||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| repository: mozilla/nss | ||||||||||||||||||||||||
| ref: ${{ needs.setup.outputs.head }} | ||||||||||||||||||||||||
| path: nss | ||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||
| persist-credentials: false | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| repository: mozilla/nspr | ||||||||||||||||||||||||
| ref: ${{ needs.setup.outputs.nspr }} | ||||||||||||||||||||||||
| path: nspr | ||||||||||||||||||||||||
| persist-credentials: false | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Restore last known-good NSS commit | ||||||||||||||||||||||||
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: .nss-last-good | ||||||||||||||||||||||||
| key: ${{ env.CACHE_KEY }}--${{ github.run_id }} | ||||||||||||||||||||||||
| restore-keys: ${{ env.CACHE_KEY }}-- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Test NSS head | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| status=0 | ||||||||||||||||||||||||
| "$CHECK" 2>&1 | tee nss-head.log || status=$? | ||||||||||||||||||||||||
| if [ "$status" -eq 0 ]; then | ||||||||||||||||||||||||
| echo "BROKEN=false" >> "$GITHUB_ENV" | ||||||||||||||||||||||||
| echo "$HEAD_SHA" > .nss-last-good | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| # 125 is the predicate's "NSS did not build": nothing to bisect for. | ||||||||||||||||||||||||
| [ "$status" -ne 125 ] || echo "NO_BUILD=true" >> "$GITHUB_ENV" | ||||||||||||||||||||||||
| echo "::warning::nss-rs fails against NSS head $HEAD_SHA (exit $status)" | ||||||||||||||||||||||||
| echo "BROKEN=true" >> "$GITHUB_ENV" | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Bisect NSS | ||||||||||||||||||||||||
| if: env.BROKEN == 'true' && env.NO_BUILD != 'true' | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| MIN_VERSION: ${{ steps.meta.outputs.min-version }} | ||||||||||||||||||||||||
| OVERRIDE: ${{ inputs.last-good }} | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| last_good="${OVERRIDE:-$(cat .nss-last-good 2>/dev/null || true)}" | ||||||||||||||||||||||||
| # Fall back to the release the crate declares as its floor, which also | ||||||||||||||||||||||||
| # covers a cache miss or a last-good commit head no longer descends from. | ||||||||||||||||||||||||
| if [ -z "$last_good" ] || ! git -C "$NSS_DIR" merge-base --is-ancestor "$last_good" "$HEAD_SHA"; then | ||||||||||||||||||||||||
| # The tag sits on a release branch, so take the branch point. | ||||||||||||||||||||||||
| last_good=$(git -C "$NSS_DIR" merge-base "NSS_${MIN_VERSION//./_}_RTM^{commit}" "$HEAD_SHA") | ||||||||||||||||||||||||
| echo "Bisecting from the $MIN_VERSION branch point at $last_good" | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| # Bisect never tests its endpoints, so an environment that fails at | ||||||||||||||||||||||||
| # every revision would otherwise pin the blame on the oldest one. | ||||||||||||||||||||||||
| first_bad="" | ||||||||||||||||||||||||
| git -C "$NSS_DIR" checkout --quiet "$last_good" | ||||||||||||||||||||||||
| if ! "$CHECK" > last-good.log 2>&1; then | ||||||||||||||||||||||||
| echo "::warning::nss-rs fails at the last known-good $last_good too, so the range is wrong or the build is broken" | ||||||||||||||||||||||||
| echo "SELF_BROKEN=true" >> "$GITHUB_ENV" | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| git -C "$NSS_DIR" bisect start "$HEAD_SHA" "$last_good" | ||||||||||||||||||||||||
| # Only a converged run leaves refs/bisect/bad on the first bad commit; | ||||||||||||||||||||||||
| # after an abort it still points at the last revision tested. | ||||||||||||||||||||||||
| if git -C "$NSS_DIR" bisect run "$CHECK" 2>&1 | tee bisect.log; then | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Caution On the Windows runners this blames an innocent commit.
Passing the path as an argument keeps it out of the shell's word splitting:
Suggested change
Alternatively, drop the job-level - run: echo "CHECK=$(pwd)/.github/scripts/nss-check.sh" >> "$GITHUB_ENV" |
||||||||||||||||||||||||
| first_bad=$(git -C "$NSS_DIR" rev-parse refs/bisect/bad) | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip A converged bisect proves a new known-good commit; keeping it avoids re-bisecting the same range every day.
Suggested change
The cache save step then needs to run for that case too: if: env.BROKEN == 'false' || env.FIRST_BAD != '' |
||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| echo "::warning::Bisect between $last_good and $HEAD_SHA did not converge" | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| git -C "$NSS_DIR" bisect reset | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| git -C "$NSS_DIR" checkout --quiet "$HEAD_SHA" | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| echo "FIRST_BAD=$first_bad" | ||||||||||||||||||||||||
| echo "SUBJECT=$(git -C "$NSS_DIR" log -1 --format=%s "$first_bad" 2>/dev/null || true)" | ||||||||||||||||||||||||
| } >> "$GITHUB_ENV" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # One file per platform, which the report job merges into a single verdict. | ||||||||||||||||||||||||
| - name: Record the verdict | ||||||||||||||||||||||||
| if: ${{ !cancelled() && env.BROKEN != '' }} | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| OS: ${{ matrix.os }} | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| jq -n --arg os "$OS" --arg broken "$BROKEN" \ | ||||||||||||||||||||||||
| --arg no_build "${NO_BUILD:-false}" --arg self_broken "${SELF_BROKEN:-false}" \ | ||||||||||||||||||||||||
| --arg first_bad "${FIRST_BAD:-}" --arg subject "${SUBJECT:-}" \ | ||||||||||||||||||||||||
| --rawfile log nss-head.log \ | ||||||||||||||||||||||||
| '{os: $os, broken: ($broken == "true"), no_build: ($no_build == "true"), | ||||||||||||||||||||||||
| self_broken: ($self_broken == "true"), | ||||||||||||||||||||||||
| first_bad: $first_bad, subject: $subject, log: $log[-4000:]}' > verdict.json | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||||||||||||||||||||||||
| if: ${{ !cancelled() }} | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| name: nss-head-${{ matrix.os }} | ||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||
| verdict.json | ||||||||||||||||||||||||
| nss-head.log | ||||||||||||||||||||||||
| last-good.log | ||||||||||||||||||||||||
| bisect.log | ||||||||||||||||||||||||
| if-no-files-found: ignore | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||||||||||||||||||||||||
| if: env.BROKEN == 'false' | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: .nss-last-good | ||||||||||||||||||||||||
| key: ${{ env.CACHE_KEY }}--${{ github.run_id }} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Last, so that the verdict is recorded and uploaded either way. | ||||||||||||||||||||||||
| - name: Fail this platform | ||||||||||||||||||||||||
| if: env.BROKEN == 'true' | ||||||||||||||||||||||||
| run: exit 1 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| report: | ||||||||||||||||||||||||
| name: Report to Bugzilla | ||||||||||||||||||||||||
| needs: [setup, head] | ||||||||||||||||||||||||
| if: ${{ !cancelled() }} | ||||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| # The dev instance mirrors the NSS product, so reporting can be exercised | ||||||||||||||||||||||||
| # end to end without touching real bugs. | ||||||||||||||||||||||||
| BUGZILLA: ${{ inputs.test-bugzilla && 'https://bugzilla-dev.allizom.org/rest' || 'https://bugzilla.mozilla.org/rest' }} | ||||||||||||||||||||||||
| # Identifies the bug this workflow owns, so it can update and close it. | ||||||||||||||||||||||||
| MARKER: "[nss-rs-head]" | ||||||||||||||||||||||||
| # A missing test key must not fall through to the production one. | ||||||||||||||||||||||||
| BUGZILLA_API_KEY: ${{ inputs.test-bugzilla && secrets.BUGZILLA_TEST_API_KEY || (!inputs.test-bugzilla && secrets.BUGZILLA_API_KEY) || '' }} # zizmor: ignore[secrets-outside-env] | ||||||||||||||||||||||||
| HEAD_SHA: ${{ needs.setup.outputs.head }} | ||||||||||||||||||||||||
| HEAD_RESULT: ${{ needs.head.result }} | ||||||||||||||||||||||||
| RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| pattern: nss-head-* | ||||||||||||||||||||||||
| path: verdicts | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Summarise the verdicts | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| shopt -s nullglob | ||||||||||||||||||||||||
| verdicts=(verdicts/*/verdict.json) | ||||||||||||||||||||||||
| [ ${#verdicts[@]} -gt 0 ] || { echo "::error::No platform reported a verdict"; exit 1; } | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
| jq -s 'sort_by(.os)' "${verdicts[@]}" > all.json | ||||||||||||||||||||||||
| jq -r '.[] | "\(if .broken then "FAIL" else "ok" end)\t\(.os)\t\(.first_bad)"' all.json | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| echo "BROKEN=$(jq -r 'any(.broken) | tostring' all.json)" | ||||||||||||||||||||||||
| echo "NO_BUILD=$(jq -r '[.[] | select(.broken)] | (length > 0 and all(.no_build)) | tostring' all.json)" | ||||||||||||||||||||||||
| # Changes whenever the set of failing platforms or their commits does. | ||||||||||||||||||||||||
| echo "FINGERPRINT=$(jq -cS 'map(select(.broken) | {os, first_bad})' all.json \ | ||||||||||||||||||||||||
| | sha256sum | cut -c1-12)" | ||||||||||||||||||||||||
|
Comment on lines
+240
to
+241
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note The fingerprint ignores the failure mode, so a platform that changes why it fails posts no update.
Suggested change
|
||||||||||||||||||||||||
| } >> "$GITHUB_ENV" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Report to Bugzilla | ||||||||||||||||||||||||
| if: env.BUGZILLA_API_KEY != '' | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| DRY_RUN: ${{ inputs.dry-run }} | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| bz() { | ||||||||||||||||||||||||
| local method=$1 path=$2 | ||||||||||||||||||||||||
| shift 2 | ||||||||||||||||||||||||
| # Retry only reads: a retried POST can file the same bug twice. | ||||||||||||||||||||||||
| local retry=() | ||||||||||||||||||||||||
| [ "$method" != GET ] || retry=(--retry 3 --retry-all-errors) | ||||||||||||||||||||||||
| # No -L: curl keeps custom headers across a cross-host redirect. | ||||||||||||||||||||||||
| curl -fsS --max-time 60 "${retry[@]}" -X "$method" "$BUGZILLA/$path" \ | ||||||||||||||||||||||||
| -H "X-BUGZILLA-API-KEY: $BUGZILLA_API_KEY" \ | ||||||||||||||||||||||||
| -H "Content-Type: application/json" "$@" | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
| # A dry run still searches and builds the payloads, but posts nothing. | ||||||||||||||||||||||||
| mutate() { # method path payload | ||||||||||||||||||||||||
| [ "$DRY_RUN" == "true" ] || { bz "$1" "$2" -d "$3"; return; } | ||||||||||||||||||||||||
| { echo "dry-run: $1 $BUGZILLA/$2"; jq . <<< "$3"; } >&2 | ||||||||||||||||||||||||
| echo '{"id": "(dry-run)"}' | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| show="${BUGZILLA%/rest}/show_bug.cgi?id=" | ||||||||||||||||||||||||
| id=$(bz GET bug -G \ | ||||||||||||||||||||||||
| --data-urlencode "whiteboard=$MARKER" \ | ||||||||||||||||||||||||
| --data-urlencode "resolution=---" \ | ||||||||||||||||||||||||
| --data-urlencode "order=bug_id" \ | ||||||||||||||||||||||||
| --data-urlencode "include_fields=id" | jq -r '.bugs[0].id // ""') | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if [ "$BROKEN" == "false" ]; then | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
| # A timed-out platform uploads no verdict, so the rest look green. | ||||||||||||||||||||||||
| [ "$HEAD_RESULT" == "success" ] || | ||||||||||||||||||||||||
| { echo "::warning::Not every platform reported; leaving bug $id alone"; exit 0; } | ||||||||||||||||||||||||
| [ -n "$id" ] || { echo "NSS head is fine and no bug is open."; exit 0; } | ||||||||||||||||||||||||
| body="nss-rs builds and tests cleanly against NSS head $HEAD_SHA on every platform, so this is fixed. Closed automatically by $RUN." | ||||||||||||||||||||||||
| mutate PUT "bug/$id" "$(jq -n --arg c "$body" \ | ||||||||||||||||||||||||
| '{status: "RESOLVED", resolution: "WORKSFORME", comment: {body: $c}}')" > /dev/null | ||||||||||||||||||||||||
| echo "::notice::Closed $show$id" | ||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| failed=$(jq -r '[.[] | select(.broken) | .os] | join(", ")' all.json) | ||||||||||||||||||||||||
| detail=$(jq -r '.[] | select(.broken) | | ||||||||||||||||||||||||
| "## \(.os)\n\n\(if .no_build then "NSS head does not build." | ||||||||||||||||||||||||
| elif .self_broken then "nss-rs also fails at the last known-good revision, so this may not be an NSS regression." | ||||||||||||||||||||||||
| elif .first_bad == "" then "First bad commit: bisect inconclusive" | ||||||||||||||||||||||||
| else "First bad commit: \(.first_bad) \(.subject)\n https://github.com/mozilla/nss/commit/\(.first_bad)" end)\n\n```\n\(.log)\n```\n"' all.json) | ||||||||||||||||||||||||
| body=$(cat <<EOF | ||||||||||||||||||||||||
| Building and testing nss-rs (https://github.com/mozilla/nss-rs) against NSS | ||||||||||||||||||||||||
| head $HEAD_SHA fails on: $failed | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| $detail | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Reported automatically by $RUN | ||||||||||||||||||||||||
| nss-rs-fingerprint: $FINGERPRINT | ||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| if [ "$NO_BUILD" == "true" ]; then | ||||||||||||||||||||||||
| echo "::warning::NSS head does not build on $failed; not filing" | ||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| summary="nss-rs fails against NSS head on $failed" | ||||||||||||||||||||||||
| if [ -z "$id" ]; then | ||||||||||||||||||||||||
| id=$(mutate POST bug "$(jq -n --arg s "$summary" \ | ||||||||||||||||||||||||
| --arg d "$body" --arg w "$MARKER" \ | ||||||||||||||||||||||||
| '{product: "NSS", component: "Libraries", version: "trunk", type: "defect", | ||||||||||||||||||||||||
| summary: $s, description: $d, whiteboard: $w}')" | jq -r '.id') | ||||||||||||||||||||||||
| echo "::notice::Filed $show$id" | ||||||||||||||||||||||||
| elif ! comments=$(bz GET "bug/$id/comment"); then | ||||||||||||||||||||||||
| echo "::error::Could not read the comments on bug $id"; exit 1 | ||||||||||||||||||||||||
| elif grep -qF "$FINGERPRINT" <<< "$comments"; then | ||||||||||||||||||||||||
| echo "Bug $id already reports this set of failures." | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| # The failing set changed, so the summary is stale. | ||||||||||||||||||||||||
| mutate PUT "bug/$id" "$(jq -n --arg s "$summary" --arg d "$body" \ | ||||||||||||||||||||||||
| '{summary: $s, comment: {body: $d}}')" > /dev/null | ||||||||||||||||||||||||
| echo "::notice::Updated $show$id" | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
larseggert marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Fail if any platform is broken | ||||||||||||||||||||||||
| if: env.BROKEN == 'true' | ||||||||||||||||||||||||
| run: exit 1 | ||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.