Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GHA trigger for Windows images #30

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions Jenkinsfile.trigger
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,8 @@ node {
# https://docs.github.com/en/free-pro-team@latest/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
payload="$(
jq <<<"$json" -L.scripts '
include "meta";
{
ref: "subset", # TODO back to main
inputs: (
{
buildId: .buildId,
bashbrewArch: .build.arch,
firstTag: .source.tags[0],
} + (
[ .build.resolvedParents[].manifest.desc.platform? | select(has("os.version")) | ."os.version" ][0] // ""
| if . != "" then
{ windowsVersion: (
# https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/base-image-lifecycle
# https://github.com/microsoft/hcsshim/blob/e8208853ff0f7f23fa5d2e018deddff2249d35c8/osversion/windowsbuilds.go
capture("^10[.]0[.](?<build>[0-9]+)([.]|$)")
| {
# since this is specifically for GitHub Actions support, this is limited to the underlying versions they actually support
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
"20348": "2022",
"17763": "2019",
"": "",
}[.build] // "unknown"
) }
else {} end
)
)
}
include "jenkins";
gha_payload
'
)"

Expand Down
31 changes: 31 additions & 0 deletions jenkins.jq
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,34 @@ def crane_deploy_commands:
@sh "crane index append --tag \($target) " + (map("--manifest " + @sh) | join(" ")) + " --flatten"
end
;

# input: "build" object (with "buildId" top level key)
# output: json object (to trigger the build on GitHub Actions)
def gha_payload:
{
ref: "subset", # TODO back to main
inputs: (
{
buildId: .buildId,
bashbrewArch: .build.arch,
firstTag: .source.tags[0],
} + (
[ .build.resolvedParents[].manifests[].platform? | select(has("os.version")) | ."os.version" ][0] // ""
| if . != "" then
{ windowsVersion: (
# https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/base-image-lifecycle
# https://github.com/microsoft/hcsshim/blob/e8208853ff0f7f23fa5d2e018deddff2249d35c8/osversion/windowsbuilds.go
capture("^10[.]0[.](?<build>[0-9]+)([.]|$)")
| {
# since this is specifically for GitHub Actions support, this is limited to the underlying versions they actually support
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
"20348": "2022",
"17763": "2019",
"": "",
}[.build] // "unknown"
) }
else {} end
)
)
}
;