diff --git a/.github/workflows/base-ci-goreleaser.yaml b/.github/workflows/base-ci-goreleaser.yaml index 97cefb5d..4e942985 100644 --- a/.github/workflows/base-ci-goreleaser.yaml +++ b/.github/workflows/base-ci-goreleaser.yaml @@ -32,7 +32,7 @@ jobs: GOARCH: arm - GOOS: windows GOARCH: s390x - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout @@ -45,6 +45,11 @@ jobs: with: platforms: arm64,ppc64le,linux/arm/v7,s390x + - name: Setup wixl + run: | + sudo apt-get update + sudo apt-get install -y wixl + - name: Setup Docker Buildx uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 diff --git a/.github/workflows/base-release.yaml b/.github/workflows/base-release.yaml index c6277a25..7f68cd2b 100644 --- a/.github/workflows/base-release.yaml +++ b/.github/workflows/base-release.yaml @@ -32,7 +32,7 @@ jobs: GOARCH: arm - GOOS: windows GOARCH: s390x - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 @@ -95,7 +95,7 @@ jobs: release: name: ${{ inputs.distribution }} Release - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: prepare permissions: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 708fc3d5..03b940fc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ on: jobs: build: name: Build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c3d85310..e40a1a21 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,8 @@ This repository contains a set of resources that ultimately results in OpenTelem ### Distribution directory -Each distribution has its own directory at the root of this repository, such as `opentelemetry-collector`. Within each one of those, you'll find at least two files: +Each distribution has its own directory under the [`distributions`](./distributions/) folder, such as [`otelcol`](./distributions/otelcol/). +Within each one of those, you'll find at least two files: - `Dockerfile`, determining how to build the container image for this distribution - `manifest.yaml`, which is used with [ocb](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder) to generate the sources for the distribution. diff --git a/cmd/goreleaser/internal/configure.go b/cmd/goreleaser/internal/configure.go index 00cd2980..21cc2e46 100644 --- a/cmd/goreleaser/internal/configure.go +++ b/cmd/goreleaser/internal/configure.go @@ -24,8 +24,7 @@ import ( "path" "strings" - "github.com/goreleaser/goreleaser/pkg/config" - "github.com/goreleaser/nfpm/v2/files" + "github.com/goreleaser/goreleaser-pro/pkg/config" ) const ArmArch = "arm" @@ -45,6 +44,7 @@ func Generate(dist string) config.Project { Env: []string{"COSIGN_YES=true"}, Builds: Builds(dist), Archives: Archives(dist), + MSI: WinPackages(dist), NFPMs: Packages(dist), Dockers: DockerImages(dist), DockerManifests: DockerManifests(dist), @@ -102,6 +102,26 @@ func Archive(dist string) config.Archive { } } +func WinPackages(dist string) []config.MSI { + return []config.MSI{ + WinPackage(dist), + } +} + +// Package configures goreleaser to build a Windows MSI package. +// https://goreleaser.com/customization/msi/ +func WinPackage(dist string) config.MSI { + return config.MSI{ + ID: dist, + Name: fmt.Sprintf("%s_{{ .Version }}_{{ .Os }}_{{ .MsiArch }}", dist), + WXS: "windows-installer.wxs", + Files: []string{ + "config.yaml", + "opentelemetry.ico", + }, + } +} + func Packages(dist string) (r []config.NFPM) { return []config.NFPM{ Package(dist), @@ -127,7 +147,7 @@ func Package(dist string) config.NFPM { PostInstall: "postinstall.sh", PreRemove: "preremove.sh", }, - Contents: files.Contents{ + Contents: config.NFPMContents{ { Source: fmt.Sprintf("%s.service", dist), Destination: path.Join("/lib", "systemd", "system", fmt.Sprintf("%s.service", dist)), diff --git a/distributions/otelcol-contrib/.goreleaser.yaml b/distributions/otelcol-contrib/.goreleaser.yaml index 515d8ba6..477c2e64 100644 --- a/distributions/otelcol-contrib/.goreleaser.yaml +++ b/distributions/otelcol-contrib/.goreleaser.yaml @@ -3,6 +3,13 @@ partial: project_name: opentelemetry-collector-releases env: - COSIGN_YES=true +msi: + - id: otelcol-contrib + name: otelcol-contrib_{{ .Version }}_{{ .Os }}_{{ .MsiArch }} + wxs: windows-installer.wxs + extra_files: + - config.yaml + - opentelemetry.ico builds: - id: otelcol-contrib goos: diff --git a/distributions/otelcol-contrib/opentelemetry.ico b/distributions/otelcol-contrib/opentelemetry.ico new file mode 100644 index 00000000..9bdd4cf5 Binary files /dev/null and b/distributions/otelcol-contrib/opentelemetry.ico differ diff --git a/distributions/otelcol-contrib/windows-installer.wxs b/distributions/otelcol-contrib/windows-installer.wxs new file mode 100644 index 00000000..0c7d7135 --- /dev/null +++ b/distributions/otelcol-contrib/windows-installer.wxs @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + NOT COLLECTOR_SVC_ARGS + + + + + + + + + + + + + + + + + + + + + + diff --git a/distributions/otelcol/.goreleaser.yaml b/distributions/otelcol/.goreleaser.yaml index d1e19e3e..fb7ff6fc 100644 --- a/distributions/otelcol/.goreleaser.yaml +++ b/distributions/otelcol/.goreleaser.yaml @@ -3,6 +3,13 @@ partial: project_name: opentelemetry-collector-releases env: - COSIGN_YES=true +msi: + - id: otelcol + name: otelcol_{{ .Version }}_{{ .Os }}_{{ .MsiArch }} + wxs: windows-installer.wxs + extra_files: + - config.yaml + - opentelemetry.ico builds: - id: otelcol goos: diff --git a/distributions/otelcol/opentelemetry.ico b/distributions/otelcol/opentelemetry.ico new file mode 100644 index 00000000..9bdd4cf5 Binary files /dev/null and b/distributions/otelcol/opentelemetry.ico differ diff --git a/distributions/otelcol/windows-installer.wxs b/distributions/otelcol/windows-installer.wxs new file mode 100644 index 00000000..0c7d7135 --- /dev/null +++ b/distributions/otelcol/windows-installer.wxs @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + NOT COLLECTOR_SVC_ARGS + + + + + + + + + + + + + + + + + + + + + + diff --git a/go.mod b/go.mod index a60b7b0a..7d24d12d 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.7 require ( - github.com/goreleaser/goreleaser v1.25.1 + github.com/goreleaser/goreleaser-pro v1.25.1-pro github.com/goreleaser/nfpm/v2 v2.37.1 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 3c7cfcbc..80fb0232 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,8 @@ github.com/goreleaser/fileglob v1.3.0 h1:/X6J7U8lbDpQtBvGcwwPS6OpzkNVlVEsFUVRx9+ github.com/goreleaser/fileglob v1.3.0/go.mod h1:Jx6BoXv3mbYkEzwm9THo7xbr5egkAraxkGorbJb4RxU= github.com/goreleaser/goreleaser v1.25.1 h1:a9skjeROotTN5GPPJDHDfhmOK4n13cBgJ34sTdXRDN0= github.com/goreleaser/goreleaser v1.25.1/go.mod h1:nsbhCYp9eImbE2fyd9/3Tgv5hjuGuDIQRoBozEUEYbc= +github.com/goreleaser/goreleaser-pro v1.25.1-pro h1:NOoSx96oAK0zNA1+hiL0p6pY1DWL101kwPmpmkiExXk= +github.com/goreleaser/goreleaser-pro v1.25.1-pro/go.mod h1:7q9HURJC4ZYBT9VyX3XlqjK0kwe5QbG/VIUAJSP3CKc= github.com/goreleaser/nfpm/v2 v2.37.1 h1:RUmeEt8OlEVeSzKRrO5Vl5qVWCtUwx4j9uivGuRo5fw= github.com/goreleaser/nfpm/v2 v2.37.1/go.mod h1:q8+sZXFqn106/eGw+9V+I8+izFxZ/sJjrhwmEUxXhUg= github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=