From a069e82e7072d90a209e7e7e6f0247d099bdc821 Mon Sep 17 00:00:00 2001 From: Eyal Birger Date: Thu, 21 Sep 2023 11:11:10 +0300 Subject: [PATCH] NSOF-8035 goreleaser: adapt to our build needs - Remove ocoltel distribution and unneeded archs/platforms from build as we only need ocoltel-contrib deb on amd64 in the forseeable future. - Remove the Makefile dependency that validates .goreleaser.yaml as we manually change it - the alternative would have been to mess around with the validation tool which isn't worth it for now. - Remove the "partial" statement from the yaml as partial builds [1] are only supported by Goreleaser pro. [1] https://goreleaser.com/customization/partial/ --- .goreleaser.yaml | 330 ----------------------------------------------- Makefile | 2 +- 2 files changed, 1 insertion(+), 331 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c3b6a04c..1d835653 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,60 +1,10 @@ -partial: - by: target project_name: opentelemetry-collector-releases builds: - - id: otelcol - goos: - - darwin - - linux - - windows - goarch: - - "386" - - amd64 - - arm - - arm64 - - ppc64le - goarm: - - "7" - ignore: - - goos: darwin - goarch: "386" - - goos: darwin - goarch: arm - - goos: windows - goarch: arm - - goos: windows - goarch: arm64 - dir: distributions/otelcol/_build - binary: otelcol - ldflags: - - -s - - -w - flags: - - -trimpath - env: - - CGO_ENABLED=0 - id: otelcol-contrib goos: - - darwin - linux - - windows goarch: - - "386" - amd64 - - arm - - arm64 - - ppc64le - goarm: - - "7" - ignore: - - goos: darwin - goarch: "386" - - goos: darwin - goarch: arm - - goos: windows - goarch: arm - - goos: windows - goarch: arm64 dir: distributions/otelcol-contrib/_build binary: otelcol-contrib ldflags: @@ -65,39 +15,11 @@ builds: env: - CGO_ENABLED=0 archives: - - id: otelcol - builds: - - otelcol - name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' - id: otelcol-contrib builds: - otelcol-contrib name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}' nfpms: - - package_name: otelcol - contents: - - src: distributions/otelcol/otelcol.service - dst: /lib/systemd/system/otelcol.service - - src: distributions/otelcol/otelcol.conf - dst: /etc/otelcol/otelcol.conf - type: config|noreplace - - src: configs/otelcol.yaml - dst: /etc/otelcol/config.yaml - type: config - scripts: - preinstall: distributions/otelcol/preinstall.sh - postinstall: distributions/otelcol/postinstall.sh - preremove: distributions/otelcol/preremove.sh - id: otelcol - builds: - - otelcol - formats: - - apk - - deb - - rpm - maintainer: The OpenTelemetry Collector maintainers - description: OpenTelemetry Collector - otelcol - license: Apache 2.0 - package_name: otelcol-contrib contents: - src: distributions/otelcol-contrib/otelcol-contrib.service @@ -116,261 +38,9 @@ nfpms: builds: - otelcol-contrib formats: - - apk - deb - - rpm maintainer: The OpenTelemetry Collector maintainers description: OpenTelemetry Collector - otelcol-contrib license: Apache 2.0 checksum: name_template: '{{ .ProjectName }}_checksums.txt' -dockers: - - goos: linux - goarch: "386" - dockerfile: distributions/otelcol/Dockerfile - image_templates: - - otel/opentelemetry-collector:{{ .Version }}-386 - - otel/opentelemetry-collector:latest-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-386 - extra_files: - - configs/otelcol.yaml - build_flag_templates: - - --pull - - --platform=linux/386 - - --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}} - use: buildx - - goos: linux - goarch: amd64 - dockerfile: distributions/otelcol/Dockerfile - image_templates: - - otel/opentelemetry-collector:{{ .Version }}-amd64 - - otel/opentelemetry-collector:latest-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-amd64 - extra_files: - - configs/otelcol.yaml - build_flag_templates: - - --pull - - --platform=linux/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}} - use: buildx - - goos: linux - goarch: arm - goarm: "7" - dockerfile: distributions/otelcol/Dockerfile - image_templates: - - otel/opentelemetry-collector:{{ .Version }}-armv7 - - otel/opentelemetry-collector:latest-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-armv7 - extra_files: - - configs/otelcol.yaml - build_flag_templates: - - --pull - - --platform=linux/arm/v7 - - --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}} - use: buildx - - goos: linux - goarch: arm64 - dockerfile: distributions/otelcol/Dockerfile - image_templates: - - otel/opentelemetry-collector:{{ .Version }}-arm64 - - otel/opentelemetry-collector:latest-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-arm64 - extra_files: - - configs/otelcol.yaml - build_flag_templates: - - --pull - - --platform=linux/arm64 - - --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}} - use: buildx - - goos: linux - goarch: ppc64le - dockerfile: distributions/otelcol/Dockerfile - image_templates: - - otel/opentelemetry-collector:{{ .Version }}-ppc64le - - otel/opentelemetry-collector:latest-ppc64le - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-ppc64le - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-ppc64le - extra_files: - - configs/otelcol.yaml - build_flag_templates: - - --pull - - --platform=linux/ppc64le - - --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}} - use: buildx - - goos: linux - goarch: "386" - dockerfile: distributions/otelcol-contrib/Dockerfile - image_templates: - - otel/opentelemetry-collector-contrib:{{ .Version }}-386 - - otel/opentelemetry-collector-contrib:latest-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-386 - extra_files: - - configs/otelcol-contrib.yaml - build_flag_templates: - - --pull - - --platform=linux/386 - - --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}} - use: buildx - - goos: linux - goarch: amd64 - dockerfile: distributions/otelcol-contrib/Dockerfile - image_templates: - - otel/opentelemetry-collector-contrib:{{ .Version }}-amd64 - - otel/opentelemetry-collector-contrib:latest-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-amd64 - extra_files: - - configs/otelcol-contrib.yaml - build_flag_templates: - - --pull - - --platform=linux/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}} - use: buildx - - goos: linux - goarch: arm - goarm: "7" - dockerfile: distributions/otelcol-contrib/Dockerfile - image_templates: - - otel/opentelemetry-collector-contrib:{{ .Version }}-armv7 - - otel/opentelemetry-collector-contrib:latest-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-armv7 - extra_files: - - configs/otelcol-contrib.yaml - build_flag_templates: - - --pull - - --platform=linux/arm/v7 - - --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}} - use: buildx - - goos: linux - goarch: arm64 - dockerfile: distributions/otelcol-contrib/Dockerfile - image_templates: - - otel/opentelemetry-collector-contrib:{{ .Version }}-arm64 - - otel/opentelemetry-collector-contrib:latest-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-arm64 - extra_files: - - configs/otelcol-contrib.yaml - build_flag_templates: - - --pull - - --platform=linux/arm64 - - --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}} - use: buildx - - goos: linux - goarch: ppc64le - dockerfile: distributions/otelcol-contrib/Dockerfile - image_templates: - - otel/opentelemetry-collector-contrib:{{ .Version }}-ppc64le - - otel/opentelemetry-collector-contrib:latest-ppc64le - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-ppc64le - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-ppc64le - extra_files: - - configs/otelcol-contrib.yaml - build_flag_templates: - - --pull - - --platform=linux/ppc64le - - --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}} - use: buildx -docker_manifests: - - name_template: otel/opentelemetry-collector:{{ .Version }} - image_templates: - - otel/opentelemetry-collector:{{ .Version }}-386 - - otel/opentelemetry-collector:{{ .Version }}-amd64 - - otel/opentelemetry-collector:{{ .Version }}-armv7 - - otel/opentelemetry-collector:{{ .Version }}-arm64 - - otel/opentelemetry-collector:{{ .Version }}-ppc64le - - name_template: otel/opentelemetry-collector:latest - image_templates: - - otel/opentelemetry-collector:latest-386 - - otel/opentelemetry-collector:latest-amd64 - - otel/opentelemetry-collector:latest-armv7 - - otel/opentelemetry-collector:latest-arm64 - - otel/opentelemetry-collector:latest-ppc64le - - name_template: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }} - image_templates: - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:{{ .Version }}-ppc64le - - name_template: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest - image_templates: - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:latest-ppc64le - - name_template: otel/opentelemetry-collector-contrib:{{ .Version }} - image_templates: - - otel/opentelemetry-collector-contrib:{{ .Version }}-386 - - otel/opentelemetry-collector-contrib:{{ .Version }}-amd64 - - otel/opentelemetry-collector-contrib:{{ .Version }}-armv7 - - otel/opentelemetry-collector-contrib:{{ .Version }}-arm64 - - otel/opentelemetry-collector-contrib:{{ .Version }}-ppc64le - - name_template: otel/opentelemetry-collector-contrib:latest - image_templates: - - otel/opentelemetry-collector-contrib:latest-386 - - otel/opentelemetry-collector-contrib:latest-amd64 - - otel/opentelemetry-collector-contrib:latest-armv7 - - otel/opentelemetry-collector-contrib:latest-arm64 - - otel/opentelemetry-collector-contrib:latest-ppc64le - - name_template: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }} - image_templates: - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:{{ .Version }}-ppc64le - - name_template: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest - image_templates: - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-386 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-amd64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-armv7 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-arm64 - - ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest-ppc64le diff --git a/Makefile b/Makefile index ac63200e..9e4083d4 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ OTELCOL_BUILDER ?= ${OTELCOL_BUILDER_DIR}/ocb DISTRIBUTIONS ?= "otelcol,otelcol-contrib" ci: check build -check: ensure-goreleaser-up-to-date +check: build: go ocb @./scripts/build.sh -d "${DISTRIBUTIONS}" -b ${OTELCOL_BUILDER} -g ${GO}