Skip to content

Commit

Permalink
Merge pull request #30 from infosiftr/windows
Browse files Browse the repository at this point in the history
Fix GHA trigger for Windows images
  • Loading branch information
tianon authored Mar 8, 2024
2 parents ef82d9c + 196a628 commit 96ed6a9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
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
)
)
}
;

0 comments on commit 96ed6a9

Please sign in to comment.