a8c-ci-toolkit-buildkite-plugin icon indicating copy to clipboard operation
a8c-ci-toolkit-buildkite-plugin copied to clipboard

Consider adding Windows support to our a8c-ci-toolkit plugin

Open AliSoftware opened this issue 1 year ago • 4 comments

Now that we're starting to have project which are building on Windows agents (esp. Desktop apps like Studio, etc), it would be useful if we can confirm that the generic helpers from a8c-ci-toolkit (e.g. save_cache, hash_file, …) are able to be used on Windows agents too, and if not, make them Windows-compatible.

We'll first need to check:

  • If our Windows agent already have bash support built-in (maybe everything already works already? We just haven't tested it yet)
  • Or if the calls to any a8c-ci-toolkit-buildkite-plugin/bin helper needs to be wrapped in a .ps1 PowerShell script that would run them in a bash container or something…
  • Or if we'll need to translate each of our helpers in .ps1 (thus having two copies of each helper, one written in .ps1 and one in bash?)

AliSoftware avatar Jun 04 '24 11:06 AliSoftware

💡 If we end up adding ps1 scripts for Windows in this plugin, we might want to look at at tool like PSScriptAnalyzer to lint our .ps1 scripts on CI, similar to how we use shellcheck to lint our bash scripts for Linux/Mac.

(See also official doc of the tool, PSScriptAnalyzer GitHub repo, Docker image repo, Docker image on DockerHub

AliSoftware avatar Jun 25 '24 14:06 AliSoftware

Related https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/issues/132

mokagio avatar Nov 06 '24 00:11 mokagio

See also:

  • https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/pull/100
  • https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/releases/tag/3.10.0
  • https://github.com/Automattic/studio/pull/875

mokagio avatar Feb 04 '25 00:02 mokagio

RTO: @mokagio I noticed that this In Progress issue is missing a Start Date and an ETA, a requirement as per the definition, not sure about the need to attach an RFC or/and Project Thread as well. 🙏

Image

ParaskP7 avatar Mar 27 '25 15:03 ParaskP7

Thanks @ParaskP7 !

For the record, I self-assigned and move this to "In Progress" when I picked back up the PRs to update the Windows scripts in the CI Toolkit.

From one point of view, we could consider this done because CI Toolkit has "support" for Windows in the form of functionality that we already use from it to DRY Windows automation in the apps.

But @AliSoftware asks as good question in the description:

confirm that the generic helpers from a8c-ci-toolkit (e.g. save_cache, hash_file, …) are able to be used on Windows agents too, and if not, make them Windows-compatible.

I know those are available via the toolkit for Windows to call, but I don't think we ever used them.

As such, I propose to rename this task to "Verify existing cross-platform CI Toolkit commands work on Windows." I'll make the change tomorrow unless someone brings up a reason not to.

I also set an arbitrary ETA of June 13th. As I get ready for my sabbatical, I'd like to collaborate with folks on Windows related tasks to remove myself as the single point of failure when it comes to our Windows infra.

mokagio avatar Apr 08 '25 06:04 mokagio

I think we can consider this "done" in that our Windows CI supports running Bash, and we also have projects that leverage it.

For example, Studio runs save_cache and restore_cache via the following chain:

https://github.com/Automattic/studio/blob/b97381e63d9b6f041522518178d50629b6ffb29d/package.json#L22-L23

https://github.com/Automattic/studio/blob/b97381e63d9b6f041522518178d50629b6ffb29d/.buildkite/pipeline.yml#L132

https://github.com/Automattic/studio/blob/b97381e63d9b6f041522518178d50629b6ffb29d/.buildkite/commands/build-for-windows.ps1#L22

https://github.com/Automattic/studio/blob/b97381e63d9b6f041522518178d50629b6ffb29d/.buildkite/commands/install-node-dependencies.sh#L16-L23

Alternatively, we could write integration-tests-like scripts for each command (or for the most important ones) and run them on Windows' CI from this repo. I like the idea but it seems overkill. We are capable of dealing with OS issues in the commands in this plugin as they arise and given the relatively small footprint of Windows, I think we have more valuable things to do than being proactive on that front here.

cc @iangmaia , what do you think?

mokagio avatar Jun 11 '25 01:06 mokagio

our Windows CI supports running Bash

For the scope of this issue, I agree we can consider this done 👍

we could write integration-tests-like scripts for each command (or for the most important ones)

In fact, we even have this single test running on a windows agent using bash https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/blob/0d65ae9c130f1bcf02079dc9f7fb715890dad4cb/.buildkite/pipeline-windows-tests.yml#L11.

We could indeed extend that to other commands... but I agree we have more valuable things to tackle (including better test coverage for the existing commands).

iangmaia avatar Jun 17 '25 11:06 iangmaia

Thanks for the input @iangmaia 🙇‍♂

I'll close this and ensure the matching Linear item is closed, too.

mokagio avatar Jun 18 '25 10:06 mokagio