Skip to content

Commit 96ed6a9

Browse files
authored
Merge pull request #30 from infosiftr/windows
Fix GHA trigger for Windows images
2 parents ef82d9c + 196a628 commit 96ed6a9

File tree

2 files changed

+33
-27
lines changed

2 files changed

+33
-27
lines changed

Jenkinsfile.trigger

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -109,33 +109,8 @@ node {
109109
# https://docs.github.com/en/free-pro-team@latest/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
110110
payload="$(
111111
jq <<<"$json" -L.scripts '
112-
include "meta";
113-
{
114-
ref: "subset", # TODO back to main
115-
inputs: (
116-
{
117-
buildId: .buildId,
118-
bashbrewArch: .build.arch,
119-
firstTag: .source.tags[0],
120-
} + (
121-
[ .build.resolvedParents[].manifest.desc.platform? | select(has("os.version")) | ."os.version" ][0] // ""
122-
| if . != "" then
123-
{ windowsVersion: (
124-
# https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/base-image-lifecycle
125-
# https://github.com/microsoft/hcsshim/blob/e8208853ff0f7f23fa5d2e018deddff2249d35c8/osversion/windowsbuilds.go
126-
capture("^10[.]0[.](?<build>[0-9]+)([.]|$)")
127-
| {
128-
# since this is specifically for GitHub Actions support, this is limited to the underlying versions they actually support
129-
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
130-
"20348": "2022",
131-
"17763": "2019",
132-
"": "",
133-
}[.build] // "unknown"
134-
) }
135-
else {} end
136-
)
137-
)
138-
}
112+
include "jenkins";
113+
gha_payload
139114
'
140115
)"
141116

jenkins.jq

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,34 @@ def crane_deploy_commands:
1616
@sh "crane index append --tag \($target) " + (map("--manifest " + @sh) | join(" ")) + " --flatten"
1717
end
1818
;
19+
20+
# input: "build" object (with "buildId" top level key)
21+
# output: json object (to trigger the build on GitHub Actions)
22+
def gha_payload:
23+
{
24+
ref: "subset", # TODO back to main
25+
inputs: (
26+
{
27+
buildId: .buildId,
28+
bashbrewArch: .build.arch,
29+
firstTag: .source.tags[0],
30+
} + (
31+
[ .build.resolvedParents[].manifests[].platform? | select(has("os.version")) | ."os.version" ][0] // ""
32+
| if . != "" then
33+
{ windowsVersion: (
34+
# https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/base-image-lifecycle
35+
# https://github.com/microsoft/hcsshim/blob/e8208853ff0f7f23fa5d2e018deddff2249d35c8/osversion/windowsbuilds.go
36+
capture("^10[.]0[.](?<build>[0-9]+)([.]|$)")
37+
| {
38+
# since this is specifically for GitHub Actions support, this is limited to the underlying versions they actually support
39+
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
40+
"20348": "2022",
41+
"17763": "2019",
42+
"": "",
43+
}[.build] // "unknown"
44+
) }
45+
else {} end
46+
)
47+
)
48+
}
49+
;

0 commit comments

Comments
 (0)