Skip to content

Commit 5c12c44

Browse files
authored
chore: remove test azure oidc (#228)
The oidc test is unused since sandbox was removed in monorepo. Updates the input according to the `WARNING: The 'trusted-signing-account-name' input is deprecated. Please use 'signing-account-name' instead.` from https://github.com/braintrustdata/bt/actions/runs/27436460594/job/81099613162. Prevents the action from crashing if code signing fails with `continue-on-error`. The workaround to see it failed while allowing the workflow to continue is a bit ugly since actions/runner#2347 won't be supported anytime soon. **I broke bt (canary) releases when Windows code signing fails and this fixes them.** Feel free to merge it without waiting for me, I'll be ooo next week.
1 parent a202754 commit 5c12c44

5 files changed

Lines changed: 84 additions & 34 deletions

File tree

.github/actions/sign-windows-artifacts/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333
- uses: azure/artifact-signing-action@c7ab2a863ab5f9a846ddb8265964877ef296ee82 # v2.0.0
3434
with:
3535
endpoint: ${{ inputs.endpoint }}
36-
trusted-signing-account-name: ${{ inputs.account-name }}
36+
signing-account-name: ${{ inputs.account-name }}
3737
certificate-profile-name: ${{ inputs.cert-profile }}
3838
files-folder: target/distrib
3939
files-folder-filter: exe
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Verify Windows signature
2+
description: Check that bt.exe binaries are validly Authenticode-signed; if not, post a neutral check run so the unsigned build is surfaced without failing the job. Stops being necessary once GitHub supports https://github.com/actions/runner/issues/2347 (opened 1st April 2020, 1500 reactions, still not done so we'll probably have to wait a few more years)
3+
4+
inputs:
5+
sign-outcome:
6+
required: true
7+
description: Outcome of the signing step (e.g. success/failure/skipped).
8+
targets:
9+
required: true
10+
description: Human-readable build targets, used in the check-run name.
11+
github-token:
12+
required: true
13+
description: Token with checks:write used to create the check run.
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Verify signature and report
19+
shell: pwsh
20+
env:
21+
GH_TOKEN: ${{ inputs.github-token }}
22+
SIGN_OUTCOME: ${{ inputs.sign-outcome }}
23+
TARGETS: ${{ inputs.targets }}
24+
run: |
25+
$exes = Get-ChildItem -Path "target/distrib" -Filter "bt.exe" -Recurse -ErrorAction SilentlyContinue
26+
$unsigned = @()
27+
foreach ($exe in $exes) {
28+
$sig = Get-AuthenticodeSignature $exe.FullName
29+
if ($sig.Status -ne 'Valid') {
30+
$unsigned += "$($exe.FullName) [$($sig.Status)]"
31+
}
32+
}
33+
34+
if ($SIGN_OUTCOME -eq 'success' -and $unsigned.Count -eq 0) {
35+
Write-Host "All bt.exe binaries are validly signed."
36+
exit 0
37+
}
38+
39+
$summary = if ($unsigned.Count -gt 0) {
40+
"Code signing did not produce valid Authenticode signatures. The following binaries are unsigned and were shipped as-is:`n`n" + (($unsigned | ForEach-Object { "- $_" }) -join "`n")
41+
} else {
42+
"The Windows signing step failed (outcome: $SIGN_OUTCOME). Binaries were shipped unsigned."
43+
}
44+
45+
$body = @{
46+
name = "windows-signing ($env:TARGETS)"
47+
head_sha = $env:GITHUB_SHA
48+
status = "completed"
49+
conclusion = "neutral"
50+
output = @{
51+
title = "Windows binaries shipped unsigned"
52+
summary = $summary
53+
}
54+
} | ConvertTo-Json -Depth 5
55+
56+
$body | gh api "repos/$env:GITHUB_REPOSITORY/check-runs" `
57+
--method POST `
58+
-H "Accept: application/vnd.github+json" `
59+
--input -
60+
61+
Write-Host "::warning::$summary"

.github/workflows/release-canary.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616
id-token: write
1717
issues: write
1818
pull-requests: write
19+
checks: write
1920

2021
env:
2122
CARGO_NET_GIT_FETCH_WITH_CLI: true
@@ -186,7 +187,9 @@ jobs:
186187
echo "dist ran successfully"
187188
188189
- name: Sign Windows artifacts
190+
id: sign
189191
if: ${{ runner.os == 'Windows' && env.HAS_AZURE_SIGNING == 'true' }}
192+
continue-on-error: true
190193
uses: ./.github/actions/sign-windows-artifacts
191194
with:
192195
client-id: ${{ secrets.AZURE_CLIENT_ID }}
@@ -196,6 +199,14 @@ jobs:
196199
account-name: ${{ vars.AZURE_SIGNING_ACCOUNT_NAME }}
197200
cert-profile: ${{ vars.AZURE_SIGNING_CERT_PROFILE }}
198201

202+
- name: Verify Windows signature and report
203+
if: ${{ runner.os == 'Windows' && env.HAS_AZURE_SIGNING == 'true' && always() }}
204+
uses: ./.github/actions/verify-windows-signature
205+
with:
206+
sign-outcome: ${{ steps.sign.outcome }}
207+
targets: ${{ join(matrix.targets, ', ') }}
208+
github-token: ${{ secrets.GITHUB_TOKEN }}
209+
199210
- id: dist-files
200211
name: Post-build
201212
shell: bash

.github/workflows/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ concurrency:
2020
permissions:
2121
contents: write
2222
id-token: write
23+
checks: write
2324

2425
env:
2526
CARGO_NET_GIT_FETCH_WITH_CLI: true
@@ -221,7 +222,9 @@ jobs:
221222
echo "dist ran successfully"
222223
223224
- name: Sign Windows artifacts
225+
id: sign
224226
if: ${{ runner.os == 'Windows' && env.HAS_AZURE_SIGNING == 'true' }}
227+
continue-on-error: true
225228
uses: ./.github/actions/sign-windows-artifacts
226229
with:
227230
client-id: ${{ secrets.AZURE_CLIENT_ID }}
@@ -231,6 +234,14 @@ jobs:
231234
account-name: ${{ vars.AZURE_SIGNING_ACCOUNT_NAME }}
232235
cert-profile: ${{ vars.AZURE_SIGNING_CERT_PROFILE }}
233236

237+
- name: Verify Windows signature and report
238+
if: ${{ runner.os == 'Windows' && env.HAS_AZURE_SIGNING == 'true' && always() }}
239+
uses: ./.github/actions/verify-windows-signature
240+
with:
241+
sign-outcome: ${{ steps.sign.outcome }}
242+
targets: ${{ join(matrix.targets, ', ') }}
243+
github-token: ${{ secrets.GITHUB_TOKEN }}
244+
234245
- id: dist-files
235246
name: Post-build
236247
shell: bash

.github/workflows/test-azure-oidc.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)