Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

ci(signing): avoid interactive certificate import

rcourtman1f45db6e5470
diff --git a/.github/workflows/signpath-test-signing.yml b/.github/workflows/signpath-test-signing.yml
index 27bfbaab30..7b1fc3969f 100644
--- a/.github/workflows/signpath-test-signing.yml
+++ b/.github/workflows/signpath-test-signing.yml
@@ -158,10 +158,25 @@ jobs:
$certificate.Export([Security.Cryptography.X509Certificates.X509ContentType]::Cert)
)
- Write-Host "Temporarily trusting test signer $thumbprint on the ephemeral runner."
- Import-Certificate -FilePath $certificatePath -CertStoreLocation Cert:\CurrentUser\Root -Confirm:$false | Out-Null
- Import-Certificate -FilePath $certificatePath -CertStoreLocation Cert:\CurrentUser\TrustedPublisher -Confirm:$false | Out-Null
+ $trustedStoreNames = @()
try {
+ foreach ($storeName in @('Root', 'TrustedPublisher')) {
+ Write-Host "Adding test signer $thumbprint to CurrentUser/$storeName on the ephemeral runner."
+ $store = [Security.Cryptography.X509Certificates.X509Store]::new(
+ $storeName,
+ [Security.Cryptography.X509Certificates.StoreLocation]::CurrentUser
+ )
+ try {
+ $store.Open([Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
+ $store.Add($certificate)
+ $trustedStoreNames += $storeName
+ }
+ finally {
+ $store.Close()
+ $store.Dispose()
+ }
+ }
+
Write-Host 'Locating signtool.exe.'
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin" -Filter signtool.exe -Recurse |
Sort-Object FullName -Descending |
@@ -254,8 +269,20 @@ jobs:
$evidence | ConvertTo-Json -Depth 6 | Set-Content signpath-test-signing-evidence.json -Encoding utf8NoBOM
}
finally {
- Remove-Item "Cert:\CurrentUser\Root\$thumbprint" -Force -ErrorAction SilentlyContinue
- Remove-Item "Cert:\CurrentUser\TrustedPublisher\$thumbprint" -Force -ErrorAction SilentlyContinue
+ foreach ($storeName in $trustedStoreNames) {
+ $store = [Security.Cryptography.X509Certificates.X509Store]::new(
+ $storeName,
+ [Security.Cryptography.X509Certificates.StoreLocation]::CurrentUser
+ )
+ try {
+ $store.Open([Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
+ $store.Remove($certificate)
+ }
+ finally {
+ $store.Close()
+ $store.Dispose()
+ }
+ }
}
- name: Upload non-production evidence
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index 90d6e5c30a..c9a8b6e798 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -529,8 +529,17 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("signedArtifactsUploadedAsGitHubArtifact = $false", workflow)
self.assertIn("nonProduction = $true", workflow)
self.assertIn("WaitForExit(90000)", workflow)
- self.assertIn("-Confirm:$false", workflow)
+ self.assertIn("X509Store]::new", workflow)
+ self.assertIn("OpenFlags]::ReadWrite", workflow)
+ self.assertNotIn("Import-Certificate", workflow)
self.assertIn("path: signpath-test-signing-evidence.json", workflow)
+ self.assertEqual(
+ workflow.count(
+ "uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1"
+ ),
+ 2,
+ )
+ self.assertNotIn("path: signpath-test-output", workflow)
self.assertNotIn("gh release", workflow)
self.assertNotIn("release-candidate", workflow)
for name in (