Skip to content

Conversation

@mokagio
Copy link
Contributor

@mokagio mokagio commented Oct 30, 2025

https://linear.app/a8c/issue/AINFRA-1459


  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

@mokagio mokagio force-pushed the ainfra-1459-update-ci-toolkit-to-introspect-ci-env-and-skip-unnecessary branch from 363f3a9 to 657e18f Compare October 30, 2025 04:16
@mokagio mokagio force-pushed the ainfra-1459-update-ci-toolkit-to-introspect-ci-env-and-skip-unnecessary branch from 657e18f to 6d8e152 Compare October 30, 2025 04:27
@AliSoftware AliSoftware force-pushed the ainfra-1459-update-ci-toolkit-to-introspect-ci-env-and-skip-unnecessary branch from 2313531 to 003b86f Compare October 30, 2025 20:20
$ciDir = "C:\CI"
if (-not (Test-Path $ciDir)) {
New-Item -ItemType Directory -Path $ciDir | Out-Null
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mokagio Note: now that I've updated the logic to expose the ami_version in the AMI_VERSION env var instead of in a file in https://github.com/Automattic/buildkite-ci/pull/740/commits/d5495b0b582d5d164f9c05305129bf88bc899ba9, I've updated the ps1 script accordingly above but haven't touched the unit test, so that part will still have to be updated accordingly before merging.

@mokagio mokagio marked this pull request as ready for review October 31, 2025 02:31
if (![string]::IsNullOrWhiteSpace($amiVersion) -and [version]$amiVersion -ge [version]'0.2') {
Write-Output "Tooling is already pre-installed in AMI versions >= 0.2. Only installing code signing certificate."
& "setup_windows_code_signing.ps1"
Exit 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if Exit $LastExitCode would be more appropriate here.

I remember looking into the exit code management before sabbatical, but I don't remember what I learned or if/where I tracked my findings.

Logged https://linear.app/a8c/issue/AINFRA-1466/audit-ci-toolkit-ps1-scripts-for-appropriate-exit-code-reporting to followup.

Comment on lines +30 to +36
$amiVersion = [Environment]::GetEnvironmentVariable('AMI_VERSION', 'Machine')
Write-Output "AMI_VERSION is: $amiVersion"
if (![string]::IsNullOrWhiteSpace($amiVersion) -and [version]$amiVersion -ge [version]'0.2') {
Write-Output "Tooling is already pre-installed in AMI versions >= 0.2. Only installing code signing certificate."
& "setup_windows_code_signing.ps1"
Exit 0
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, this script should contain only this call. Tracked https://linear.app/a8c/issue/AINFRA-1465/remove-env-setup-logic-now-in-ami-from-ci-toolkit-once-all-projects for it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think ideally we should even just eventually remove that script and have client projects call & setup_windows_code_signing.ps1 directly themselves 🙃 (and only if they really need the distribution certificate; eg Unit Tests jobs probably won't even need it?)

@mokagio
Copy link
Contributor Author

mokagio commented Oct 31, 2025

In the interest of addressing the time consuming / blocking issues in Windows builds downstream, I'm going to merge this PR and ship a -beta.1 tag.

Checks performed:

image image

Write-Output "[!] Failed to download code signing certificate."
Exit $LastExitCode
}
& "setup_windows_code_signing.ps1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test for exit code here? I.e.

Suggested change
& "setup_windows_code_signing.ps1"
& "setup_windows_code_signing.ps1"
If ($LastExitCode -ne 0) {
Exit $LastExitCode
}

Or is that supposed to be automatically handled implicitly in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the earlier question regarding exit codes, I'm not sure.

Will look at it as part of linear.app/a8c/issue/AINFRA-1466/audit-ci-toolkit-ps1-scripts-for-appropriate-exit-code-reporting.

@mokagio mokagio merged commit ce4345b into trunk Nov 2, 2025
26 checks passed
@mokagio mokagio deleted the ainfra-1459-update-ci-toolkit-to-introspect-ci-env-and-skip-unnecessary branch November 2, 2025 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants