From 26708ac3d9ce342e9dd719ac5d10ae8fb11b9582 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Fri, 20 Nov 2026 05:39:31 +0000 Subject: [PATCH 1/2] ci: update release workflow inputs --- .github/workflows/release.yaml | 6 +++- .github/workflows/sign-mutagen-agents.yml | 9 ++++++ scripts/Publish.ps1 | 37 ++++++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 16b99bd..d684a88 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,11 @@ jobs: contents: read id-token: write uses: coder/coder-desktop-windows/.github/workflows/sign-mutagen-agents.yml@main - secrets: inherit + secrets: + AC_CERTIFICATE_PEM: ${{ secrets.AC_CERTIFICATE_PEM }} + AC_KMS_KEY_RING: ${{ secrets.AC_KMS_KEY_RING }} + AC_WORKLOAD_ID_PROVIDER: ${{ secrets.AC_WORKLOAD_ID_PROVIDER }} + AC_SERVICE_ACCOUNT: ${{ secrets.AC_SERVICE_ACCOUNT }} release: needs: sign-mutagen-agents diff --git a/.github/workflows/sign-mutagen-agents.yml b/.github/workflows/sign-mutagen-agents.yml index f88cd94..a095ddd 100644 --- a/.github/workflows/sign-mutagen-agents.yml +++ b/.github/workflows/sign-mutagen-agents.yml @@ -4,6 +4,15 @@ name: sign-mutagen-agents on: workflow_call: + secrets: + AC_CERTIFICATE_PEM: + required: true + AC_KMS_KEY_RING: + required: true + AC_WORKLOAD_ID_PROVIDER: + required: true + AC_SERVICE_ACCOUNT: + required: true outputs: sha256: description: SHA-256 of mutagen-agents.tar.gz in the mutagen-agents artifact. diff --git a/scripts/Publish.ps1 b/scripts/Publish.ps1 index e5d13fb..587ec68 100644 --- a/scripts/Publish.ps1 +++ b/scripts/Publish.ps1 @@ -160,14 +160,49 @@ Copy-Item $mutagenSrcPath $mutagenDestPath Add-CoderSignature $mutagenDestPath -replaceExisting $mutagenAgentsSrcPath = Join-Path $scriptRoot "files\mutagen-agents.tar.gz" +$tar = Join-Path ([Environment]::SystemDirectory) "tar.exe" if ($mutagenAgentsPath -ne "") { + # Compare the supplied mutagen agents with the pinned ones. The macOS + # agents are not compared. + $pinnedAgentsDir = Join-Path $publishDir "mutagen-agents-pinned-$($version)-$($arch)" + $suppliedAgentsDir = Join-Path $publishDir "mutagen-agents-supplied-$($version)-$($arch)" + foreach ($dir in @($pinnedAgentsDir, $suppliedAgentsDir)) { + if (Test-Path $dir) { + Remove-Item -Recurse -Force $dir + } + New-Item -ItemType Directory -Path $dir -Force + } + $pinnedAgents = @(& $tar -tf $mutagenAgentsSrcPath) + if ($LASTEXITCODE -ne 0) { throw "Failed to list pinned mutagen agents" } + $suppliedAgents = @(& $tar -tf $mutagenAgentsPath) + if ($LASTEXITCODE -ne 0) { throw "Failed to list supplied mutagen agents" } + if (($suppliedAgents -join "`n") -cne ($pinnedAgents -join "`n")) { + throw "Supplied mutagen agents '$suppliedAgents' do not match pinned mutagen agents '$pinnedAgents'" + } + & $tar -xf $mutagenAgentsSrcPath -C $pinnedAgentsDir + if ($LASTEXITCODE -ne 0) { throw "Failed to unpack pinned mutagen agents" } + & $tar -xf $mutagenAgentsPath -C $suppliedAgentsDir + if ($LASTEXITCODE -ne 0) { throw "Failed to unpack supplied mutagen agents" } + foreach ($agent in $pinnedAgents) { + $suppliedAgentPath = Join-Path $suppliedAgentsDir $agent + if ((Get-Item -LiteralPath $suppliedAgentPath -Force).LinkType) { + throw "Supplied mutagen agent '$agent' is not a regular file" + } + if ($agent -cin @("darwin_amd64", "darwin_arm64")) { continue } + $pinnedHash = (Get-FileHash -Algorithm SHA256 -LiteralPath (Join-Path $pinnedAgentsDir $agent) -ErrorAction Stop).Hash + $suppliedHash = (Get-FileHash -Algorithm SHA256 -LiteralPath $suppliedAgentPath -ErrorAction Stop).Hash + if ($suppliedHash -ne $pinnedHash) { + throw "Supplied mutagen agent '$agent' does not match the pinned mutagen agent" + } + } + Remove-Item -Recurse -Force $pinnedAgentsDir + Remove-Item -Recurse -Force $suppliedAgentsDir $mutagenAgentsSrcPath = $mutagenAgentsPath } $mutagenAgentsDestPath = Join-Path $vpnFilesPath "mutagen-agents.tar.gz" if ($sign) { # Unpack the mutagen agents, sign the Windows agents and repack them in the # same order. - $tar = Join-Path ([Environment]::SystemDirectory) "tar.exe" $mutagenAgentsDir = Join-Path $publishDir "mutagen-agents-$($version)-$($arch)" if (Test-Path $mutagenAgentsDir) { Remove-Item -Recurse -Force $mutagenAgentsDir From 1c3d39af3ca5cad8e8685303877da5b77ca12d16 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Fri, 20 Nov 2026 06:37:34 +0000 Subject: [PATCH 2/2] ci: restore release workflow files --- .github/workflows/release.yaml | 6 +----- .github/workflows/sign-mutagen-agents.yml | 9 --------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d684a88..16b99bd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,11 +16,7 @@ jobs: contents: read id-token: write uses: coder/coder-desktop-windows/.github/workflows/sign-mutagen-agents.yml@main - secrets: - AC_CERTIFICATE_PEM: ${{ secrets.AC_CERTIFICATE_PEM }} - AC_KMS_KEY_RING: ${{ secrets.AC_KMS_KEY_RING }} - AC_WORKLOAD_ID_PROVIDER: ${{ secrets.AC_WORKLOAD_ID_PROVIDER }} - AC_SERVICE_ACCOUNT: ${{ secrets.AC_SERVICE_ACCOUNT }} + secrets: inherit release: needs: sign-mutagen-agents diff --git a/.github/workflows/sign-mutagen-agents.yml b/.github/workflows/sign-mutagen-agents.yml index a095ddd..f88cd94 100644 --- a/.github/workflows/sign-mutagen-agents.yml +++ b/.github/workflows/sign-mutagen-agents.yml @@ -4,15 +4,6 @@ name: sign-mutagen-agents on: workflow_call: - secrets: - AC_CERTIFICATE_PEM: - required: true - AC_KMS_KEY_RING: - required: true - AC_WORKLOAD_ID_PROVIDER: - required: true - AC_SERVICE_ACCOUNT: - required: true outputs: sha256: description: SHA-256 of mutagen-agents.tar.gz in the mutagen-agents artifact.