Skip to content

Commit 9a26dbb

Browse files
committed
Attempt to split build into windows nodes
1 parent b85d1bd commit 9a26dbb

10 files changed

Lines changed: 124 additions & 27 deletions

File tree

.github/workflows/base-release.yaml

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
goarch:
1313
required: true
1414
type: string
15+
runner_os:
16+
required: false
17+
type: string
18+
default: ubuntu-24.04
1519

1620
env:
1721
# renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
@@ -21,26 +25,18 @@ jobs:
2125
prepare:
2226
strategy:
2327
matrix:
24-
GOOS: ${{ fromJSON( inputs.goos) }}
25-
GOARCH: ${{ fromJSON( inputs.goarch) }}
28+
GOOS: ${{ fromJSON(inputs.goos) }}
29+
GOARCH: ${{ fromJSON(inputs.goarch) }}
2630
exclude:
2731
- GOOS: darwin
2832
GOARCH: "386"
2933
- GOOS: darwin
3034
GOARCH: s390x
31-
- GOOS: windows
32-
GOARCH: arm64
3335
- GOOS: darwin
34-
GOARCH: arm
35-
- GOOS: windows
36-
GOARCH: arm
37-
- GOOS: windows
38-
GOARCH: s390x
39-
- GOOS: darwin
40-
GOARCH: ppc64le
41-
- GOOS: windows
4236
GOARCH: ppc64le
43-
runs-on: ubuntu-24.04
37+
- GOOS: darwin
38+
GOARCH: arm
39+
runs-on: ${{ inputs.runner_os }}
4440

4541
steps:
4642
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -52,22 +48,28 @@ jobs:
5248
- uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
5349

5450
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
51+
if: runner.os != 'Windows'
5552
with:
5653
platforms: arm64,ppc64le,linux/arm/v7,s390x
5754

5855
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
56+
if: runner.os != 'Windows'
57+
58+
# Fix slow Go compile and cache restore
59+
# See https://github.com/actions/setup-go/pull/515
60+
- name: Fix slow setup-go cache restore in Windows
61+
if: runner.os == 'Windows'
62+
run: |
63+
echo "GOCACHE=D:\gocache" | Out-File -FilePath $env:GITHUB_ENV -Append
64+
echo "GOMODCACHE=D:\gomodcache" | Out-File -FilePath $env:GITHUB_ENV -Append
65+
echo "GOTMPDIR=D:\gotmp" | Out-File -FilePath $env:GITHUB_ENV -Append
66+
mkdir D:\gotmp
5967
6068
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
6169
with:
6270
go-version: "~1.24"
6371
check-latest: true
6472

65-
- name: Setup wixl # Required to build MSI packages for Windows
66-
if: ${{ matrix.GOOS == 'windows' && ( matrix.GOARCH == '386' || matrix.GOARCH == 'amd64') }}
67-
run: |
68-
sudo apt-get update
69-
sudo apt-get install -y wixl
70-
7173
- name: Generate distribution sources
7274
run: make generate-sources
7375

@@ -115,10 +117,14 @@ jobs:
115117
if: inputs.distribution == 'otelcol-contrib'
116118
run: mv distributions/otelcol-contrib/dist/**/* distributions/otelcol-contrib/artifacts/
117119

118-
- name: Show built or downloaded content
119-
if: inputs.distribution == 'otelcol-contrib'
120+
- name: Show built or downloaded content (Linux)
121+
if: inputs.distribution == 'otelcol-contrib' && runner.os != 'Windows'
120122
run: ls -laR distributions/otelcol-contrib/artifacts
121123

124+
- name: Show built or downloaded content (Windows)
125+
if: inputs.distribution == 'otelcol-contrib' && runner.os == 'Windows'
126+
run: ls -Path distributions/otelcol-contrib/artifacts -Force -Recurse | Format-List
127+
122128
- uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
123129
with:
124130
distribution: goreleaser-pro
@@ -141,7 +147,7 @@ jobs:
141147

142148
release:
143149
name: ${{ inputs.distribution }} Release
144-
runs-on: ubuntu-24.04
150+
runs-on: ${{ inputs.runner_os }}
145151
needs: prepare
146152

147153
permissions:
@@ -159,25 +165,57 @@ jobs:
159165
- uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
160166

161167
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
168+
if: runner.os != 'Windows'
162169
with:
163170
platforms: arm64,ppc64le,s390x
164171

165172
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
173+
if: runner.os != 'Windows'
174+
175+
# Fix slow Go compile and cache restore
176+
# See https://github.com/actions/setup-go/pull/515
177+
- name: Fix slow setup-go cache restore in Windows
178+
if: runner.os == 'Windows'
179+
run: |
180+
echo "GOCACHE=D:\gocache" | Out-File -FilePath $env:GITHUB_ENV -Append
181+
echo "GOMODCACHE=D:\gomodcache" | Out-File -FilePath $env:GITHUB_ENV -Append
182+
echo "GOTMPDIR=D:\gotmp" | Out-File -FilePath $env:GITHUB_ENV -Append
183+
mkdir D:\gotmp
166184
167185
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
168186
with:
169187
go-version: "~1.24"
170188
check-latest: true
171189

172190
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
191+
if: runner.os == 'Windows'
192+
with:
193+
pattern: artifacts-${{ inputs.distribution }}-windows-*
194+
path: distributions/${{ inputs.distribution }}/dist
195+
merge-multiple: true
196+
197+
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
198+
if: runner.os != 'Windows'
173199
with:
174-
pattern: artifacts-${{ inputs.distribution }}-*
200+
pattern: artifacts-${{ inputs.distribution }}-darwin-*
201+
path: distributions/${{ inputs.distribution }}/dist
202+
merge-multiple: true
203+
204+
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
205+
if: runner.os != 'Windows'
206+
with:
207+
pattern: artifacts-${{ inputs.distribution }}-linux-*
175208
path: distributions/${{ inputs.distribution }}/dist
176209
merge-multiple: true
177210

178211
- name: Display structure of downloaded files
212+
if: runner.os != 'Windows'
179213
run: ls -R distributions/${{ inputs.distribution }}/dist
180214

215+
- name: Display structure of downloaded files (Windows)
216+
if: runner.os == 'Windows'
217+
run: ls -Path distributions/${{ inputs.distribution }}/dist -Force -Recurse | Format-List
218+
181219
- name: Log into Docker.io
182220
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
183221
with:

.github/workflows/release-contrib.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ jobs:
1010
uses: ./.github/workflows/base-release.yaml
1111
with:
1212
distribution: otelcol-contrib
13-
goos: '[ "linux", "windows", "darwin" ]'
13+
goos: '[ "linux", "darwin" ]'
1414
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
1515
secrets: inherit
1616
permissions: write-all
17+
release-windows:
18+
name: Release Contrib (Windows)
19+
uses: ./.github/workflows/base-release.yaml
20+
with:
21+
distribution: otelcol-contrib
22+
goos: '[ "windows" ]'
23+
goarch: '[ "386", "amd64" ]'
24+
runner_os: windows-2022
25+
secrets: inherit
26+
permissions: write-all

.github/workflows/release-core.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ jobs:
1010
uses: ./.github/workflows/base-release.yaml
1111
with:
1212
distribution: otelcol
13-
goos: '[ "linux", "windows", "darwin" ]'
13+
goos: '[ "linux", "darwin" ]'
1414
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
1515
secrets: inherit
1616
permissions: write-all
17+
release-windows:
18+
name: Release Core (Windows)
19+
uses: ./.github/workflows/base-release.yaml
20+
with:
21+
distribution: otelcol
22+
goos: '[ "windows" ]'
23+
goarch: '[ "386", "amd64" ]'
24+
runner_os: windows-2022
25+
secrets: inherit
26+
permissions: write-all

.github/workflows/release-k8s.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ jobs:
1414
goarch: '[ "amd64", "arm64", "ppc64le", "s390x" ]'
1515
secrets: inherit
1616
permissions: write-all
17+
release-windows:
18+
name: Release k8s (Windows)
19+
uses: ./.github/workflows/base-release.yaml
20+
with:
21+
distribution: otelcol-k8s
22+
goos: '[ "windows" ]'
23+
goarch: '[ "386", "amd64" ]'
24+
runner_os: windows-2022
25+
secrets: inherit
26+
permissions: write-all

.github/workflows/release-otlp.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ jobs:
1010
uses: ./.github/workflows/base-release.yaml
1111
with:
1212
distribution: otelcol-otlp
13-
goos: '[ "linux", "windows", "darwin" ]'
13+
goos: '[ "linux", "darwin" ]'
1414
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
1515
secrets: inherit
1616
permissions: write-all
17+
release-windows:
18+
name: Release OTLP (Windows)
19+
uses: ./.github/workflows/base-release.yaml
20+
with:
21+
distribution: otelcol-otlp
22+
goos: '[ "windows" ]'
23+
goarch: '[ "386", "amd64" ]'
24+
runner_os: windows-2022
25+
secrets: inherit
26+
permissions: write-all

cmd/goreleaser/internal/configure.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,13 @@ func dockerImageWithOS(dist, os, arch string, opts containerImageOptions) config
547547
}
548548
if os == "windows" {
549549
imageConfig.BuildFlagTemplates = slices.Insert(
550-
imageConfig.BuildFlagTemplates, 1, fmt.Sprintf("--build-arg=WIN_VERSION=%s", opts.winVersion),
550+
imageConfig.BuildFlagTemplates, 1,
551+
fmt.Sprintf("--build-arg=WIN_VERSION=%s", opts.winVersion),
551552
)
552553
imageConfig.Dockerfile = "Windows.dockerfile"
553554
imageConfig.Use = "docker"
555+
imageConfig.SkipBuild = "{{ not (eq .Runtime.Goos \"windows\") }}"
556+
imageConfig.SkipPush = "{{ not (eq .Runtime.Goos \"windows\") }}"
554557
}
555558
return imageConfig
556559
}

distributions/otelcol-contrib/.goreleaser.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ dockers:
232232
- otel/opentelemetry-collector-contrib:latest-windows-2019-amd64
233233
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-windows-2019-amd64
234234
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-windows-2019-amd64
235+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
236+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
235237
extra_files:
236238
- config.yaml
237239
build_flag_templates:
@@ -253,6 +255,8 @@ dockers:
253255
- otel/opentelemetry-collector-contrib:latest-windows-2022-amd64
254256
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-windows-2022-amd64
255257
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-windows-2022-amd64
258+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
259+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
256260
extra_files:
257261
- config.yaml
258262
build_flag_templates:

distributions/otelcol-k8s/.goreleaser.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ dockers:
124124
- otel/opentelemetry-collector-k8s:latest-windows-2019-amd64
125125
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:{{ .Version }}-windows-2019-amd64
126126
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:latest-windows-2019-amd64
127+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
128+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
127129
build_flag_templates:
128130
- --pull
129131
- --build-arg=WIN_VERSION=2019
@@ -143,6 +145,8 @@ dockers:
143145
- otel/opentelemetry-collector-k8s:latest-windows-2022-amd64
144146
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:{{ .Version }}-windows-2022-amd64
145147
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:latest-windows-2022-amd64
148+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
149+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
146150
build_flag_templates:
147151
- --pull
148152
- --build-arg=WIN_VERSION=2022

distributions/otelcol-otlp/.goreleaser.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ dockers:
211211
- otel/opentelemetry-collector-otlp:latest-windows-2019-amd64
212212
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-windows-2019-amd64
213213
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-windows-2019-amd64
214+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
215+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
214216
build_flag_templates:
215217
- --pull
216218
- --build-arg=WIN_VERSION=2019
@@ -230,6 +232,8 @@ dockers:
230232
- otel/opentelemetry-collector-otlp:latest-windows-2022-amd64
231233
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-windows-2022-amd64
232234
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-windows-2022-amd64
235+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
236+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
233237
build_flag_templates:
234238
- --pull
235239
- --build-arg=WIN_VERSION=2022

distributions/otelcol/.goreleaser.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ dockers:
227227
- otel/opentelemetry-collector:latest-windows-2019-amd64
228228
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-windows-2019-amd64
229229
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-windows-2019-amd64
230+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
231+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
230232
extra_files:
231233
- config.yaml
232234
build_flag_templates:
@@ -248,6 +250,8 @@ dockers:
248250
- otel/opentelemetry-collector:latest-windows-2022-amd64
249251
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-windows-2022-amd64
250252
- ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-windows-2022-amd64
253+
skip_build: '{{ not (eq .Runtime.Goos "windows") }}'
254+
skip_push: '{{ not (eq .Runtime.Goos "windows") }}'
251255
extra_files:
252256
- config.yaml
253257
build_flag_templates:

0 commit comments

Comments
 (0)