From e78a0910dc30007b409957a37736a26d3a8c2b27 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Thu, 6 Mar 2025 11:06:00 +0100 Subject: [PATCH 1/8] Add Go code to generate Windows-containers config --- cmd/goreleaser/internal/configure.go | 91 ++++++++++++++----- .../otelcol-contrib/.goreleaser-build.yaml | 2 + .../otelcol-contrib/.goreleaser.yaml | 44 +++++++++ distributions/otelcol-k8s/.goreleaser.yaml | 52 +++++++++++ distributions/otelcol-otlp/.goreleaser.yaml | 40 ++++++++ distributions/otelcol/.goreleaser.yaml | 44 +++++++++ 6 files changed, 248 insertions(+), 25 deletions(-) diff --git a/cmd/goreleaser/internal/configure.go b/cmd/goreleaser/internal/configure.go index 4b0be8c38..103b0baa9 100644 --- a/cmd/goreleaser/internal/configure.go +++ b/cmd/goreleaser/internal/configure.go @@ -22,6 +22,7 @@ package internal import ( "fmt" "path" + "slices" "strings" "github.com/goreleaser/goreleaser-pro/v2/pkg/config" @@ -40,10 +41,11 @@ const ( ) var ( - baseArchs = []string{"386", "amd64", "arm", "arm64", "ppc64le", "s390x"} - winArchs = []string{"386", "amd64", "arm64"} - darwinArchs = []string{"amd64", "arm64"} - k8sArchs = []string{"amd64", "arm64", "ppc64le", "s390x"} + baseArchs = []string{"386", "amd64", "arm", "arm64", "ppc64le", "s390x"} + winArchs = []string{"386", "amd64", "arm64"} + winContainerArchs = []string{"amd64"} + darwinArchs = []string{"amd64", "arm64"} + k8sArchs = []string{"amd64", "arm64", "ppc64le", "s390x"} imageRepos = []string{dockerHub, ghcr} @@ -54,8 +56,14 @@ var ( &fullBuildConfig{targetOS: "darwin", targetArch: darwinArchs}, &fullBuildConfig{targetOS: "windows", targetArch: winArchs}, } - d.containerImages = newContainerImages(d.name, "linux", baseArchs, containerImageOptions{armVersion: "7"}) - d.containerImageManifests = newContainerImageManifests(d.name, "linux", baseArchs) + d.containerImages = slices.Concat( + newContainerImages(d.name, "linux", baseArchs, containerImageOptions{armVersion: "7"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2019"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2022"}), + ) + d.containerImageManifests = slices.Concat( + newContainerImageManifests(d.name, "linux", baseArchs, containerImageOptions{}), + ) }).WithPackagingDefaults().WithDefaultConfigIncluded().Build() // otlp distro @@ -65,8 +73,14 @@ var ( &fullBuildConfig{targetOS: "darwin", targetArch: darwinArchs}, &fullBuildConfig{targetOS: "windows", targetArch: winArchs}, } - d.containerImages = newContainerImages(d.name, "linux", baseArchs, containerImageOptions{armVersion: "7"}) - d.containerImageManifests = newContainerImageManifests(d.name, "linux", baseArchs) + d.containerImages = slices.Concat( + newContainerImages(d.name, "linux", baseArchs, containerImageOptions{armVersion: "7"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2019"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2022"}), + ) + d.containerImageManifests = slices.Concat( + newContainerImageManifests(d.name, "linux", baseArchs, containerImageOptions{}), + ) }).WithPackagingDefaults().Build() // contrib distro @@ -94,8 +108,14 @@ var ( }, }, } - d.containerImages = newContainerImages(d.name, "linux", baseArchs, containerImageOptions{armVersion: "7"}) - d.containerImageManifests = newContainerImageManifests(d.name, "linux", baseArchs) + d.containerImages = slices.Concat( + newContainerImages(d.name, "linux", baseArchs, containerImageOptions{armVersion: "7"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2019"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2022"}), + ) + d.containerImageManifests = slices.Concat( + newContainerImageManifests(d.name, "linux", baseArchs, containerImageOptions{}), + ) }).WithPackagingDefaults().WithDefaultConfigIncluded().Build() // contrib build-only project @@ -111,9 +131,16 @@ var ( k8sDist = newDistributionBuilder(k8sDistro).WithConfigFunc(func(d *distribution) { d.buildConfigs = []buildConfig{ &fullBuildConfig{targetOS: "linux", targetArch: k8sArchs, ppc64Version: []string{"power8"}}, + &fullBuildConfig{targetOS: "windows", targetArch: winContainerArchs}, } - d.containerImages = newContainerImages(d.name, "linux", k8sArchs, containerImageOptions{}) - d.containerImageManifests = newContainerImageManifests(d.name, "linux", k8sArchs) + d.containerImages = slices.Concat( + newContainerImages(d.name, "linux", k8sArchs, containerImageOptions{armVersion: "7"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2019"}), + newContainerImages(d.name, "windows", winContainerArchs, containerImageOptions{winVersion: "2022"}), + ) + d.containerImageManifests = slices.Concat( + newContainerImageManifests(d.name, "linux", k8sArchs, containerImageOptions{}), + ) }).WithDefaultArchives().WithDefaultChecksum().WithDefaultSigns().WithDefaultDockerSigns().WithDefaultSBOMs().Build() ) @@ -368,7 +395,10 @@ func (d *distribution) BuildProject() config.Project { return config.Project{ ProjectName: "opentelemetry-collector-releases", - Checksum: d.checksum, + Release: config.Release{ + ReplaceExistingArtifacts: true, + }, + Checksum: d.checksum, Env: []string{ "COSIGN_YES=true", "LD_FLAGS=-s -w", @@ -392,8 +422,14 @@ func (d *distribution) BuildProject() config.Project { } } -func newContainerImageManifests(dist, os string, archs []string) []config.DockerManifest { +func newContainerImageManifests(dist, os string, archs []string, opts containerImageOptions) []config.DockerManifest { tags := []string{`{{ .Version }}`, "latest"} + if os == "windows" { + for i, tag := range tags { + tags[i] = fmt.Sprintf("%s-%s-%s", tag, os, opts.winVersion) + } + } + var r []config.DockerManifest for _, imageRepo := range imageRepos { for _, tag := range tags { @@ -509,6 +545,13 @@ func dockerImageWithOS(dist, os, arch string, opts containerImageOptions) config if arch == armArch { imageConfig.Goarm = opts.armVersion } + if os == "windows" { + imageConfig.BuildFlagTemplates = slices.Insert( + imageConfig.BuildFlagTemplates, 1, fmt.Sprintf("--build-arg=WIN_VERSION=%s", opts.winVersion), + ) + imageConfig.Dockerfile = "Windows.dockerfile" + imageConfig.Use = "docker" + } return imageConfig } @@ -523,6 +566,8 @@ func (o *osArch) buildPlatform() string { case armArch: return fmt.Sprintf("linux/arm/v%s", o.version) } + case "windows": + return fmt.Sprintf("windows/%s", o.arch) } return fmt.Sprintf("linux/%s", o.arch) } @@ -534,6 +579,8 @@ func (o *osArch) imageTag() string { case armArch: return fmt.Sprintf("armv%s", o.version) } + case "windows": + return fmt.Sprintf("windows-%s-%s", o.version, o.arch) } return o.arch } @@ -576,10 +623,14 @@ func osDockerManifest(prefix, version, dist, os string, archs []string) config.D } } - return config.DockerManifest{ + manifest := config.DockerManifest{ NameTemplate: fmt.Sprintf("%s/%s:%s", prefix, imageName(dist), version), ImageTemplates: imageTemplates, } + if os == "windows" { + manifest.SkipPush = "{{ not (eq .Runtime.Goos \"windows\") }}" + } + return manifest } func armVersions(dist string) []string { @@ -593,13 +644,3 @@ func armVersions(dist string) []string { func imageName(dist string) string { return strings.Replace(dist, binaryNamePrefix, imageNamePrefix, 1) } - -// archName translates architecture to docker platform names. -func archName(arch, armVersion string) string { - switch arch { - case armArch: - return fmt.Sprintf("%s/v%s", arch, armVersion) - default: - return arch - } -} diff --git a/distributions/otelcol-contrib/.goreleaser-build.yaml b/distributions/otelcol-contrib/.goreleaser-build.yaml index 2fd481da4..7e1ced8eb 100644 --- a/distributions/otelcol-contrib/.goreleaser-build.yaml +++ b/distributions/otelcol-contrib/.goreleaser-build.yaml @@ -5,6 +5,8 @@ env: - LD_FLAGS=-s -w - CGO_ENABLED=0 - BUILD_FLAGS=-trimpath +release: + replace_existing_artifacts: true builds: - id: otelcol-contrib-linux goos: diff --git a/distributions/otelcol-contrib/.goreleaser.yaml b/distributions/otelcol-contrib/.goreleaser.yaml index bd1c23edb..738291e07 100644 --- a/distributions/otelcol-contrib/.goreleaser.yaml +++ b/distributions/otelcol-contrib/.goreleaser.yaml @@ -5,6 +5,8 @@ env: - LD_FLAGS=-s -w - CGO_ENABLED=0 - BUILD_FLAGS=-trimpath +release: + replace_existing_artifacts: true msi: - id: otelcol-contrib name: otelcol-contrib_{{ .Version }}_{{ .Os }}_{{ .MsiArch }} @@ -222,6 +224,48 @@ dockers: - --label=org.opencontainers.image.source={{.GitURL}} - --label=org.opencontainers.image.licenses=Apache-2.0 use: buildx + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector-contrib:{{ .Version }}-windows-2019-amd64 + - otel/opentelemetry-collector-contrib:latest-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-windows-2019-amd64 + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2019 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector-contrib:{{ .Version }}-windows-2022-amd64 + - otel/opentelemetry-collector-contrib:latest-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-windows-2022-amd64 + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2022 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker docker_manifests: - name_template: otel/opentelemetry-collector-contrib:{{ .Version }} image_templates: diff --git a/distributions/otelcol-k8s/.goreleaser.yaml b/distributions/otelcol-k8s/.goreleaser.yaml index 643d024fe..a42d5354a 100644 --- a/distributions/otelcol-k8s/.goreleaser.yaml +++ b/distributions/otelcol-k8s/.goreleaser.yaml @@ -5,6 +5,8 @@ env: - LD_FLAGS=-s -w - CGO_ENABLED=0 - BUILD_FLAGS=-trimpath +release: + replace_existing_artifacts: true builds: - id: otelcol-k8s-linux goos: @@ -22,10 +24,22 @@ builds: - '{{ .Env.LD_FLAGS }}' flags: - '{{ .Env.BUILD_FLAGS }}' + - id: otelcol-k8s-windows + goos: + - windows + goarch: + - amd64 + dir: _build + binary: otelcol-k8s + ldflags: + - '{{ .Env.LD_FLAGS }}' + flags: + - '{{ .Env.BUILD_FLAGS }}' archives: - id: otelcol-k8s builds: - otelcol-k8s-linux + - otelcol-k8s-windows name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' checksum: name_template: '{{ .ProjectName }}_otelcol-k8s_checksums.txt' @@ -102,6 +116,44 @@ dockers: - --label=org.opencontainers.image.source={{.GitURL}} - --label=org.opencontainers.image.licenses=Apache-2.0 use: buildx + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector-k8s:{{ .Version }}-windows-2019-amd64 + - otel/opentelemetry-collector-k8s:latest-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:{{ .Version }}-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:latest-windows-2019-amd64 + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2019 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector-k8s:{{ .Version }}-windows-2022-amd64 + - otel/opentelemetry-collector-k8s:latest-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:{{ .Version }}-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:latest-windows-2022-amd64 + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2022 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker docker_manifests: - name_template: otel/opentelemetry-collector-k8s:{{ .Version }} image_templates: diff --git a/distributions/otelcol-otlp/.goreleaser.yaml b/distributions/otelcol-otlp/.goreleaser.yaml index 4b61da350..412e402ec 100644 --- a/distributions/otelcol-otlp/.goreleaser.yaml +++ b/distributions/otelcol-otlp/.goreleaser.yaml @@ -5,6 +5,8 @@ env: - LD_FLAGS=-s -w - CGO_ENABLED=0 - BUILD_FLAGS=-trimpath +release: + replace_existing_artifacts: true msi: - id: otelcol-otlp name: otelcol-otlp_{{ .Version }}_{{ .Os }}_{{ .MsiArch }} @@ -201,6 +203,44 @@ dockers: - --label=org.opencontainers.image.source={{.GitURL}} - --label=org.opencontainers.image.licenses=Apache-2.0 use: buildx + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-windows-2019-amd64 + - otel/opentelemetry-collector-otlp:latest-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-windows-2019-amd64 + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2019 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector-otlp:{{ .Version }}-windows-2022-amd64 + - otel/opentelemetry-collector-otlp:latest-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-windows-2022-amd64 + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2022 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker docker_manifests: - name_template: otel/opentelemetry-collector-otlp:{{ .Version }} image_templates: diff --git a/distributions/otelcol/.goreleaser.yaml b/distributions/otelcol/.goreleaser.yaml index 670cfa0ab..977d7ec49 100644 --- a/distributions/otelcol/.goreleaser.yaml +++ b/distributions/otelcol/.goreleaser.yaml @@ -5,6 +5,8 @@ env: - LD_FLAGS=-s -w - CGO_ENABLED=0 - BUILD_FLAGS=-trimpath +release: + replace_existing_artifacts: true msi: - id: otelcol name: otelcol_{{ .Version }}_{{ .Os }}_{{ .MsiArch }} @@ -217,6 +219,48 @@ dockers: - --label=org.opencontainers.image.source={{.GitURL}} - --label=org.opencontainers.image.licenses=Apache-2.0 use: buildx + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector:{{ .Version }}-windows-2019-amd64 + - otel/opentelemetry-collector:latest-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-windows-2019-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-windows-2019-amd64 + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2019 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker + - goos: windows + goarch: amd64 + dockerfile: Windows.dockerfile + image_templates: + - otel/opentelemetry-collector:{{ .Version }}-windows-2022-amd64 + - otel/opentelemetry-collector:latest-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-windows-2022-amd64 + - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-windows-2022-amd64 + extra_files: + - config.yaml + build_flag_templates: + - --pull + - --build-arg=WIN_VERSION=2022 + - --platform=windows/amd64 + - --label=org.opencontainers.image.created={{.Date}} + - --label=org.opencontainers.image.name={{.ProjectName}} + - --label=org.opencontainers.image.revision={{.FullCommit}} + - --label=org.opencontainers.image.version={{.Version}} + - --label=org.opencontainers.image.source={{.GitURL}} + - --label=org.opencontainers.image.licenses=Apache-2.0 + use: docker docker_manifests: - name_template: otel/opentelemetry-collector:{{ .Version }} image_templates: From 47be048891be5b1a0e508a09e45c8df0ffd79a92 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Thu, 6 Mar 2025 11:06:18 +0100 Subject: [PATCH 2/8] Add a Windows dockerfile for all distros --- distributions/otelcol-contrib/Windows.dockerfile | 12 ++++++++++++ distributions/otelcol-k8s/Windows.dockerfile | 15 +++++++++++++++ distributions/otelcol-otlp/Windows.dockerfile | 10 ++++++++++ distributions/otelcol/Windows.dockerfile | 12 ++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 distributions/otelcol-contrib/Windows.dockerfile create mode 100644 distributions/otelcol-k8s/Windows.dockerfile create mode 100644 distributions/otelcol-otlp/Windows.dockerfile create mode 100644 distributions/otelcol/Windows.dockerfile diff --git a/distributions/otelcol-contrib/Windows.dockerfile b/distributions/otelcol-contrib/Windows.dockerfile new file mode 100644 index 000000000..d1db76dcc --- /dev/null +++ b/distributions/otelcol-contrib/Windows.dockerfile @@ -0,0 +1,12 @@ +# escape=` +ARG WIN_VERSION=2019 +FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} + +COPY otelcol-contrib.exe ./otelcol-contrib.exe +COPY config.yaml ./config.yaml + +ENV NO_WINDOWS_SERVICE=1 + +ENTRYPOINT ["otelcol-contrib.exe"] +CMD ["--config", "config.yaml"] +EXPOSE 4317 4318 55678 55679 diff --git a/distributions/otelcol-k8s/Windows.dockerfile b/distributions/otelcol-k8s/Windows.dockerfile new file mode 100644 index 000000000..a856d830d --- /dev/null +++ b/distributions/otelcol-k8s/Windows.dockerfile @@ -0,0 +1,15 @@ +# escape=` +ARG WIN_VERSION=2019 +FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} + +COPY otelcol-k8s.exe ./otelcol-k8s.exe + +ENV NO_WINDOWS_SERVICE=1 + +ENTRYPOINT ["otelcol-k8s.exe"] +# `4137` and `4318`: OTLP +# `55678`: OpenCensus +# `55679`: zpages +# `6831`, `14268`, and `14250`: Jaeger +# `9411`: Zipkin +EXPOSE 4317 4318 55678 55679 6831 14268 14250 9411 diff --git a/distributions/otelcol-otlp/Windows.dockerfile b/distributions/otelcol-otlp/Windows.dockerfile new file mode 100644 index 000000000..3278c08af --- /dev/null +++ b/distributions/otelcol-otlp/Windows.dockerfile @@ -0,0 +1,10 @@ +# escape=` +ARG WIN_VERSION=2019 +FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} + +COPY otelcol-otlp.exe ./otelcol-otlp.exe + +ENV NO_WINDOWS_SERVICE=1 + +ENTRYPOINT ["otelcol-otlp.exe"] +EXPOSE 4317 4318 diff --git a/distributions/otelcol/Windows.dockerfile b/distributions/otelcol/Windows.dockerfile new file mode 100644 index 000000000..4737d4f28 --- /dev/null +++ b/distributions/otelcol/Windows.dockerfile @@ -0,0 +1,12 @@ +# escape=` +ARG WIN_VERSION=2019 +FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} + +COPY otelcol.exe ./otelcol.exe +COPY config.yaml ./config.yaml + +ENV NO_WINDOWS_SERVICE=1 + +ENTRYPOINT ["otelcol.exe"] +CMD ["--config", "config.yaml"] +EXPOSE 4317 4318 55678 55679 From b85d1bd532c620e4409ee00bc28c6b5f5addd8bc Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:14:14 +0100 Subject: [PATCH 3/8] Fix wxs binary ID with dashes --- distributions/otelcol-contrib/windows-installer.wxs | 2 +- distributions/otelcol-otlp/windows-installer.wxs | 2 +- distributions/otelcol/windows-installer.wxs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/distributions/otelcol-contrib/windows-installer.wxs b/distributions/otelcol-contrib/windows-installer.wxs index 0c7d71353..b3d132e26 100644 --- a/distributions/otelcol-contrib/windows-installer.wxs +++ b/distributions/otelcol-contrib/windows-installer.wxs @@ -43,7 +43,7 @@ diff --git a/distributions/otelcol-otlp/windows-installer.wxs b/distributions/otelcol-otlp/windows-installer.wxs index 81be711ef..628834b5f 100644 --- a/distributions/otelcol-otlp/windows-installer.wxs +++ b/distributions/otelcol-otlp/windows-installer.wxs @@ -43,7 +43,7 @@ diff --git a/distributions/otelcol/windows-installer.wxs b/distributions/otelcol/windows-installer.wxs index 0c7d71353..b3d132e26 100644 --- a/distributions/otelcol/windows-installer.wxs +++ b/distributions/otelcol/windows-installer.wxs @@ -43,7 +43,7 @@ From 9a26dbb0b3cfbc6e93a2c3de7ba2255f059c24f1 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:07:55 +0100 Subject: [PATCH 4/8] Attempt to split build into windows nodes --- .github/workflows/base-release.yaml | 84 ++++++++++++++----- .github/workflows/release-contrib.yaml | 12 ++- .github/workflows/release-core.yaml | 12 ++- .github/workflows/release-k8s.yaml | 10 +++ .github/workflows/release-otlp.yaml | 12 ++- cmd/goreleaser/internal/configure.go | 5 +- .../otelcol-contrib/.goreleaser.yaml | 4 + distributions/otelcol-k8s/.goreleaser.yaml | 4 + distributions/otelcol-otlp/.goreleaser.yaml | 4 + distributions/otelcol/.goreleaser.yaml | 4 + 10 files changed, 124 insertions(+), 27 deletions(-) diff --git a/.github/workflows/base-release.yaml b/.github/workflows/base-release.yaml index 02ac86e64..271e500d4 100644 --- a/.github/workflows/base-release.yaml +++ b/.github/workflows/base-release.yaml @@ -12,6 +12,10 @@ on: goarch: required: true type: string + runner_os: + required: false + type: string + default: ubuntu-24.04 env: # renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro @@ -21,26 +25,18 @@ jobs: prepare: strategy: matrix: - GOOS: ${{ fromJSON( inputs.goos) }} - GOARCH: ${{ fromJSON( inputs.goarch) }} + GOOS: ${{ fromJSON(inputs.goos) }} + GOARCH: ${{ fromJSON(inputs.goarch) }} exclude: - GOOS: darwin GOARCH: "386" - GOOS: darwin GOARCH: s390x - - GOOS: windows - GOARCH: arm64 - GOOS: darwin - GOARCH: arm - - GOOS: windows - GOARCH: arm - - GOOS: windows - GOARCH: s390x - - GOOS: darwin - GOARCH: ppc64le - - GOOS: windows GOARCH: ppc64le - runs-on: ubuntu-24.04 + - GOOS: darwin + GOARCH: arm + runs-on: ${{ inputs.runner_os }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -52,22 +48,28 @@ jobs: - uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0 - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 + if: runner.os != 'Windows' with: platforms: arm64,ppc64le,linux/arm/v7,s390x - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + if: runner.os != 'Windows' + + # Fix slow Go compile and cache restore + # See https://github.com/actions/setup-go/pull/515 + - name: Fix slow setup-go cache restore in Windows + if: runner.os == 'Windows' + run: | + echo "GOCACHE=D:\gocache" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "GOMODCACHE=D:\gomodcache" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "GOTMPDIR=D:\gotmp" | Out-File -FilePath $env:GITHUB_ENV -Append + mkdir D:\gotmp - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: go-version: "~1.24" check-latest: true - - name: Setup wixl # Required to build MSI packages for Windows - if: ${{ matrix.GOOS == 'windows' && ( matrix.GOARCH == '386' || matrix.GOARCH == 'amd64') }} - run: | - sudo apt-get update - sudo apt-get install -y wixl - - name: Generate distribution sources run: make generate-sources @@ -115,10 +117,14 @@ jobs: if: inputs.distribution == 'otelcol-contrib' run: mv distributions/otelcol-contrib/dist/**/* distributions/otelcol-contrib/artifacts/ - - name: Show built or downloaded content - if: inputs.distribution == 'otelcol-contrib' + - name: Show built or downloaded content (Linux) + if: inputs.distribution == 'otelcol-contrib' && runner.os != 'Windows' run: ls -laR distributions/otelcol-contrib/artifacts + - name: Show built or downloaded content (Windows) + if: inputs.distribution == 'otelcol-contrib' && runner.os == 'Windows' + run: ls -Path distributions/otelcol-contrib/artifacts -Force -Recurse | Format-List + - uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 with: distribution: goreleaser-pro @@ -141,7 +147,7 @@ jobs: release: name: ${{ inputs.distribution }} Release - runs-on: ubuntu-24.04 + runs-on: ${{ inputs.runner_os }} needs: prepare permissions: @@ -159,10 +165,22 @@ jobs: - uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0 - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 + if: runner.os != 'Windows' with: platforms: arm64,ppc64le,s390x - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + if: runner.os != 'Windows' + + # Fix slow Go compile and cache restore + # See https://github.com/actions/setup-go/pull/515 + - name: Fix slow setup-go cache restore in Windows + if: runner.os == 'Windows' + run: | + echo "GOCACHE=D:\gocache" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "GOMODCACHE=D:\gomodcache" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "GOTMPDIR=D:\gotmp" | Out-File -FilePath $env:GITHUB_ENV -Append + mkdir D:\gotmp - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: @@ -170,14 +188,34 @@ jobs: check-latest: true - uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 + if: runner.os == 'Windows' + with: + pattern: artifacts-${{ inputs.distribution }}-windows-* + path: distributions/${{ inputs.distribution }}/dist + merge-multiple: true + + - uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 + if: runner.os != 'Windows' with: - pattern: artifacts-${{ inputs.distribution }}-* + pattern: artifacts-${{ inputs.distribution }}-darwin-* + path: distributions/${{ inputs.distribution }}/dist + merge-multiple: true + + - uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 + if: runner.os != 'Windows' + with: + pattern: artifacts-${{ inputs.distribution }}-linux-* path: distributions/${{ inputs.distribution }}/dist merge-multiple: true - name: Display structure of downloaded files + if: runner.os != 'Windows' run: ls -R distributions/${{ inputs.distribution }}/dist + - name: Display structure of downloaded files (Windows) + if: runner.os == 'Windows' + run: ls -Path distributions/${{ inputs.distribution }}/dist -Force -Recurse | Format-List + - name: Log into Docker.io uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: diff --git a/.github/workflows/release-contrib.yaml b/.github/workflows/release-contrib.yaml index efb6e03e1..a0eb233fe 100644 --- a/.github/workflows/release-contrib.yaml +++ b/.github/workflows/release-contrib.yaml @@ -10,7 +10,17 @@ jobs: uses: ./.github/workflows/base-release.yaml with: distribution: otelcol-contrib - goos: '[ "linux", "windows", "darwin" ]' + goos: '[ "linux", "darwin" ]' goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]' secrets: inherit permissions: write-all + release-windows: + name: Release Contrib (Windows) + uses: ./.github/workflows/base-release.yaml + with: + distribution: otelcol-contrib + goos: '[ "windows" ]' + goarch: '[ "386", "amd64" ]' + runner_os: windows-2022 + secrets: inherit + permissions: write-all diff --git a/.github/workflows/release-core.yaml b/.github/workflows/release-core.yaml index 9c1b7ce70..81699906f 100644 --- a/.github/workflows/release-core.yaml +++ b/.github/workflows/release-core.yaml @@ -10,7 +10,17 @@ jobs: uses: ./.github/workflows/base-release.yaml with: distribution: otelcol - goos: '[ "linux", "windows", "darwin" ]' + goos: '[ "linux", "darwin" ]' goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]' secrets: inherit permissions: write-all + release-windows: + name: Release Core (Windows) + uses: ./.github/workflows/base-release.yaml + with: + distribution: otelcol + goos: '[ "windows" ]' + goarch: '[ "386", "amd64" ]' + runner_os: windows-2022 + secrets: inherit + permissions: write-all diff --git a/.github/workflows/release-k8s.yaml b/.github/workflows/release-k8s.yaml index 20a595f98..b26500e5c 100644 --- a/.github/workflows/release-k8s.yaml +++ b/.github/workflows/release-k8s.yaml @@ -14,3 +14,13 @@ jobs: goarch: '[ "amd64", "arm64", "ppc64le", "s390x" ]' secrets: inherit permissions: write-all + release-windows: + name: Release k8s (Windows) + uses: ./.github/workflows/base-release.yaml + with: + distribution: otelcol-k8s + goos: '[ "windows" ]' + goarch: '[ "386", "amd64" ]' + runner_os: windows-2022 + secrets: inherit + permissions: write-all diff --git a/.github/workflows/release-otlp.yaml b/.github/workflows/release-otlp.yaml index aa96c3689..df0de7300 100644 --- a/.github/workflows/release-otlp.yaml +++ b/.github/workflows/release-otlp.yaml @@ -10,7 +10,17 @@ jobs: uses: ./.github/workflows/base-release.yaml with: distribution: otelcol-otlp - goos: '[ "linux", "windows", "darwin" ]' + goos: '[ "linux", "darwin" ]' goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]' secrets: inherit permissions: write-all + release-windows: + name: Release OTLP (Windows) + uses: ./.github/workflows/base-release.yaml + with: + distribution: otelcol-otlp + goos: '[ "windows" ]' + goarch: '[ "386", "amd64" ]' + runner_os: windows-2022 + secrets: inherit + permissions: write-all diff --git a/cmd/goreleaser/internal/configure.go b/cmd/goreleaser/internal/configure.go index 103b0baa9..42da497a3 100644 --- a/cmd/goreleaser/internal/configure.go +++ b/cmd/goreleaser/internal/configure.go @@ -547,10 +547,13 @@ func dockerImageWithOS(dist, os, arch string, opts containerImageOptions) config } if os == "windows" { imageConfig.BuildFlagTemplates = slices.Insert( - imageConfig.BuildFlagTemplates, 1, fmt.Sprintf("--build-arg=WIN_VERSION=%s", opts.winVersion), + imageConfig.BuildFlagTemplates, 1, + fmt.Sprintf("--build-arg=WIN_VERSION=%s", opts.winVersion), ) imageConfig.Dockerfile = "Windows.dockerfile" imageConfig.Use = "docker" + imageConfig.SkipBuild = "{{ not (eq .Runtime.Goos \"windows\") }}" + imageConfig.SkipPush = "{{ not (eq .Runtime.Goos \"windows\") }}" } return imageConfig } diff --git a/distributions/otelcol-contrib/.goreleaser.yaml b/distributions/otelcol-contrib/.goreleaser.yaml index 738291e07..ea0a114a5 100644 --- a/distributions/otelcol-contrib/.goreleaser.yaml +++ b/distributions/otelcol-contrib/.goreleaser.yaml @@ -232,6 +232,8 @@ dockers: - otel/opentelemetry-collector-contrib:latest-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-windows-2019-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' extra_files: - config.yaml build_flag_templates: @@ -253,6 +255,8 @@ dockers: - otel/opentelemetry-collector-contrib:latest-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-windows-2022-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' extra_files: - config.yaml build_flag_templates: diff --git a/distributions/otelcol-k8s/.goreleaser.yaml b/distributions/otelcol-k8s/.goreleaser.yaml index a42d5354a..42d4d2b76 100644 --- a/distributions/otelcol-k8s/.goreleaser.yaml +++ b/distributions/otelcol-k8s/.goreleaser.yaml @@ -124,6 +124,8 @@ dockers: - otel/opentelemetry-collector-k8s:latest-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:{{ .Version }}-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:latest-windows-2019-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' build_flag_templates: - --pull - --build-arg=WIN_VERSION=2019 @@ -143,6 +145,8 @@ dockers: - otel/opentelemetry-collector-k8s:latest-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:{{ .Version }}-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:latest-windows-2022-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' build_flag_templates: - --pull - --build-arg=WIN_VERSION=2022 diff --git a/distributions/otelcol-otlp/.goreleaser.yaml b/distributions/otelcol-otlp/.goreleaser.yaml index 412e402ec..4b1b9d994 100644 --- a/distributions/otelcol-otlp/.goreleaser.yaml +++ b/distributions/otelcol-otlp/.goreleaser.yaml @@ -211,6 +211,8 @@ dockers: - otel/opentelemetry-collector-otlp:latest-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-windows-2019-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' build_flag_templates: - --pull - --build-arg=WIN_VERSION=2019 @@ -230,6 +232,8 @@ dockers: - otel/opentelemetry-collector-otlp:latest-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:{{ .Version }}-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-otlp:latest-windows-2022-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' build_flag_templates: - --pull - --build-arg=WIN_VERSION=2022 diff --git a/distributions/otelcol/.goreleaser.yaml b/distributions/otelcol/.goreleaser.yaml index 977d7ec49..2167ea897 100644 --- a/distributions/otelcol/.goreleaser.yaml +++ b/distributions/otelcol/.goreleaser.yaml @@ -227,6 +227,8 @@ dockers: - otel/opentelemetry-collector:latest-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-windows-2019-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-windows-2019-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' extra_files: - config.yaml build_flag_templates: @@ -248,6 +250,8 @@ dockers: - otel/opentelemetry-collector:latest-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-windows-2022-amd64 - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-windows-2022-amd64 + skip_build: '{{ not (eq .Runtime.Goos "windows") }}' + skip_push: '{{ not (eq .Runtime.Goos "windows") }}' extra_files: - config.yaml build_flag_templates: From b7e73ed52b1b7b678d7b35bf2d8ca925fc8c7d81 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Wed, 12 Mar 2025 14:42:57 +0100 Subject: [PATCH 5/8] Add changelog entry --- .chloggen/add_windows_container_images.yaml | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .chloggen/add_windows_container_images.yaml diff --git a/.chloggen/add_windows_container_images.yaml b/.chloggen/add_windows_container_images.yaml new file mode 100644 index 000000000..83775e10b --- /dev/null +++ b/.chloggen/add_windows_container_images.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: packaging + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Start producing images for Windows 2019 and 2022 on amd64 + +# One or more tracking issues or pull requests related to the change +issues: [339] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] From 51590f530daf1839b45cc45fb3b6ae59fb6b86d3 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Mon, 17 Mar 2025 10:36:07 +0100 Subject: [PATCH 6/8] Improve changelog note --- .chloggen/add_windows_container_images.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/add_windows_container_images.yaml b/.chloggen/add_windows_container_images.yaml index 83775e10b..868d5aef1 100644 --- a/.chloggen/add_windows_container_images.yaml +++ b/.chloggen/add_windows_container_images.yaml @@ -7,7 +7,7 @@ change_type: enhancement component: packaging # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Start producing images for Windows 2019 and 2022 on amd64 +note: Start producing container images for Windows 2019 and 2022 on amd64 # One or more tracking issues or pull requests related to the change issues: [339] From 6530ad2b051a4c7176c53f561c93d12739c1da9a Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Mon, 17 Mar 2025 10:36:26 +0100 Subject: [PATCH 7/8] Remove env var with no effect from Windows dockerfile --- distributions/otelcol-contrib/Windows.dockerfile | 2 -- distributions/otelcol-k8s/Windows.dockerfile | 2 -- distributions/otelcol-otlp/Windows.dockerfile | 2 -- distributions/otelcol/Windows.dockerfile | 2 -- 4 files changed, 8 deletions(-) diff --git a/distributions/otelcol-contrib/Windows.dockerfile b/distributions/otelcol-contrib/Windows.dockerfile index d1db76dcc..f6b042725 100644 --- a/distributions/otelcol-contrib/Windows.dockerfile +++ b/distributions/otelcol-contrib/Windows.dockerfile @@ -5,8 +5,6 @@ FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} COPY otelcol-contrib.exe ./otelcol-contrib.exe COPY config.yaml ./config.yaml -ENV NO_WINDOWS_SERVICE=1 - ENTRYPOINT ["otelcol-contrib.exe"] CMD ["--config", "config.yaml"] EXPOSE 4317 4318 55678 55679 diff --git a/distributions/otelcol-k8s/Windows.dockerfile b/distributions/otelcol-k8s/Windows.dockerfile index a856d830d..49a2a6ea8 100644 --- a/distributions/otelcol-k8s/Windows.dockerfile +++ b/distributions/otelcol-k8s/Windows.dockerfile @@ -4,8 +4,6 @@ FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} COPY otelcol-k8s.exe ./otelcol-k8s.exe -ENV NO_WINDOWS_SERVICE=1 - ENTRYPOINT ["otelcol-k8s.exe"] # `4137` and `4318`: OTLP # `55678`: OpenCensus diff --git a/distributions/otelcol-otlp/Windows.dockerfile b/distributions/otelcol-otlp/Windows.dockerfile index 3278c08af..fe17faf64 100644 --- a/distributions/otelcol-otlp/Windows.dockerfile +++ b/distributions/otelcol-otlp/Windows.dockerfile @@ -4,7 +4,5 @@ FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} COPY otelcol-otlp.exe ./otelcol-otlp.exe -ENV NO_WINDOWS_SERVICE=1 - ENTRYPOINT ["otelcol-otlp.exe"] EXPOSE 4317 4318 diff --git a/distributions/otelcol/Windows.dockerfile b/distributions/otelcol/Windows.dockerfile index 4737d4f28..07d094710 100644 --- a/distributions/otelcol/Windows.dockerfile +++ b/distributions/otelcol/Windows.dockerfile @@ -5,8 +5,6 @@ FROM mcr.microsoft.com/windows/nanoserver:ltsc${WIN_VERSION} COPY otelcol.exe ./otelcol.exe COPY config.yaml ./config.yaml -ENV NO_WINDOWS_SERVICE=1 - ENTRYPOINT ["otelcol.exe"] CMD ["--config", "config.yaml"] EXPOSE 4317 4318 55678 55679 From 16b28d817250fd5a64110132f0c9c03936cdeff1 Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Mon, 17 Mar 2025 10:51:47 +0100 Subject: [PATCH 8/8] Avoid using powershell in Windows --- .github/workflows/base-release.yaml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/base-release.yaml b/.github/workflows/base-release.yaml index 271e500d4..17fde0749 100644 --- a/.github/workflows/base-release.yaml +++ b/.github/workflows/base-release.yaml @@ -92,6 +92,7 @@ jobs: - name: Create artifacts directory to store build artifacts if: inputs.distribution == 'otelcol-contrib' + shell: bash run: mkdir -p distributions/otelcol-contrib/artifacts # otelcol-contrib is built in a separate stage @@ -115,16 +116,14 @@ jobs: - name: Move built artifacts if: inputs.distribution == 'otelcol-contrib' + shell: bash run: mv distributions/otelcol-contrib/dist/**/* distributions/otelcol-contrib/artifacts/ - - name: Show built or downloaded content (Linux) - if: inputs.distribution == 'otelcol-contrib' && runner.os != 'Windows' + - name: Show built or downloaded content + if: inputs.distribution == 'otelcol-contrib' + shell: bash run: ls -laR distributions/otelcol-contrib/artifacts - - name: Show built or downloaded content (Windows) - if: inputs.distribution == 'otelcol-contrib' && runner.os == 'Windows' - run: ls -Path distributions/otelcol-contrib/artifacts -Force -Recurse | Format-List - - uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 with: distribution: goreleaser-pro @@ -209,13 +208,9 @@ jobs: merge-multiple: true - name: Display structure of downloaded files - if: runner.os != 'Windows' + shell: bash run: ls -R distributions/${{ inputs.distribution }}/dist - - name: Display structure of downloaded files (Windows) - if: runner.os == 'Windows' - run: ls -Path distributions/${{ inputs.distribution }}/dist -Force -Recurse | Format-List - - name: Log into Docker.io uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: