Skip to content

Commit cd30bdc

Browse files
[core,contrib,k8s,otlp] Add Windows 2019 and 2022 container image (amd64 only) (#872)
* Add Go code to generate Windows-containers config * Add a Windows dockerfile for all distros * Fix wxs binary ID with dashes * Attempt to split build into windows nodes * Add changelog entry * Improve changelog note * Remove env var with no effect from Windows dockerfile * Avoid using powershell in Windows
1 parent 8d735b1 commit cd30bdc

19 files changed

+433
-52
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: packaging
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Start producing container images for Windows 2019 and 2022 on amd64
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [339]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [user]

.github/workflows/base-release.yaml

Lines changed: 54 additions & 21 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
33-
- GOOS: darwin
34-
GOARCH: arm
35-
- GOOS: windows
36-
GOARCH: arm
37-
- GOOS: windows
38-
GOARCH: s390x
3935
- GOOS: darwin
4036
GOARCH: ppc64le
41-
- GOOS: windows
42-
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

@@ -86,6 +88,7 @@ jobs:
8688

8789
- name: Create artifacts directory to store build artifacts
8890
if: inputs.distribution == 'otelcol-contrib'
91+
shell: bash
8992
run: mkdir -p distributions/otelcol-contrib/artifacts
9093

9194
# otelcol-contrib is built in a separate stage
@@ -109,10 +112,12 @@ jobs:
109112

110113
- name: Move built artifacts
111114
if: inputs.distribution == 'otelcol-contrib'
115+
shell: bash
112116
run: mv distributions/otelcol-contrib/dist/**/* distributions/otelcol-contrib/artifacts/
113117

114118
- name: Show built or downloaded content
115119
if: inputs.distribution == 'otelcol-contrib'
120+
shell: bash
116121
run: ls -laR distributions/otelcol-contrib/artifacts
117122

118123
- uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
@@ -137,7 +142,7 @@ jobs:
137142

138143
release:
139144
name: ${{ inputs.distribution }} Release
140-
runs-on: ubuntu-24.04
145+
runs-on: ${{ inputs.runner_os }}
141146
needs: prepare
142147

143148
permissions:
@@ -155,23 +160,51 @@ jobs:
155160
- uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
156161

157162
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
163+
if: runner.os != 'Windows'
158164
with:
159165
platforms: arm64,ppc64le,s390x
160166

161167
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
168+
if: runner.os != 'Windows'
169+
170+
# Fix slow Go compile and cache restore
171+
# See https://github.com/actions/setup-go/pull/515
172+
- name: Fix slow setup-go cache restore in Windows
173+
if: runner.os == 'Windows'
174+
run: |
175+
echo "GOCACHE=D:\gocache" | Out-File -FilePath $env:GITHUB_ENV -Append
176+
echo "GOMODCACHE=D:\gomodcache" | Out-File -FilePath $env:GITHUB_ENV -Append
177+
echo "GOTMPDIR=D:\gotmp" | Out-File -FilePath $env:GITHUB_ENV -Append
178+
mkdir D:\gotmp
162179
163180
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
164181
with:
165182
go-version: "~1.24"
166183
check-latest: true
167184

168185
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
186+
if: runner.os == 'Windows'
187+
with:
188+
pattern: artifacts-${{ inputs.distribution }}-windows-*
189+
path: distributions/${{ inputs.distribution }}/dist
190+
merge-multiple: true
191+
192+
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
193+
if: runner.os != 'Windows'
194+
with:
195+
pattern: artifacts-${{ inputs.distribution }}-darwin-*
196+
path: distributions/${{ inputs.distribution }}/dist
197+
merge-multiple: true
198+
199+
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
200+
if: runner.os != 'Windows'
169201
with:
170-
pattern: artifacts-${{ inputs.distribution }}-*
202+
pattern: artifacts-${{ inputs.distribution }}-linux-*
171203
path: distributions/${{ inputs.distribution }}/dist
172204
merge-multiple: true
173205

174206
- name: Display structure of downloaded files
207+
shell: bash
175208
run: ls -R distributions/${{ inputs.distribution }}/dist
176209

177210
- name: Log into Docker.io

.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

0 commit comments

Comments
 (0)