From 35f9848efd83f91792325b11a0bedf01b239164c Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 14 Sep 2025 04:14:26 +0200 Subject: [PATCH 1/4] dev: use goreleaser docker_v2 --- .goreleaser.yml | 153 +++++++++------------------------ build/buildx-alpine.Dockerfile | 4 +- build/buildx.Dockerfile | 4 +- 3 files changed, 45 insertions(+), 116 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 8153340cc9e6..db90b852a357 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -218,121 +218,46 @@ nfpms: rpm: group: Development/Tools -docker_manifests: - # basic - - name_template: 'golangci/golangci-lint:latest' - image_templates: - - 'golangci/golangci-lint:{{ .Tag }}-amd64' - - 'golangci/golangci-lint:{{ .Tag }}-arm64' - - - name_template: 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}' - image_templates: - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-amd64' - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-arm64' - - - name_template: 'golangci/golangci-lint:{{ .Tag }}' - image_templates: - - 'golangci/golangci-lint:{{ .Tag }}-amd64' - - 'golangci/golangci-lint:{{ .Tag }}-arm64' - - # alpine - - name_template: 'golangci/golangci-lint:latest-alpine' - image_templates: - - 'golangci/golangci-lint:{{ .Tag }}-alpine-amd64' - - 'golangci/golangci-lint:{{ .Tag }}-alpine-arm64' - - - name_template: 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-alpine' - image_templates: - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-alpine-amd64' - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-alpine-arm64' - - - name_template: 'golangci/golangci-lint:{{ .Tag }}-alpine' - image_templates: - - 'golangci/golangci-lint:{{ .Tag }}-alpine-amd64' - - 'golangci/golangci-lint:{{ .Tag }}-alpine-arm64' - -dockers: - - use: buildx - skip_push: false - goos: linux - goarch: amd64 +dockers_v2: + - id: golangci-lint + images: + - 'golangci/golangci-lint' dockerfile: build/buildx.Dockerfile - image_templates: - - 'golangci/golangci-lint:latest-amd64' - - 'golangci/golangci-lint:{{ .Tag }}-amd64' - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-amd64' - build_flag_templates: - - '--pull' + platforms: + - linux/amd64 + - linux/arm64 + tags: + - 'latest' + - '{{ .Tag }}' + - 'v{{ .Major }}.{{ .Minor }}' + labels: # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys - - '--label=org.opencontainers.image.title={{.ProjectName}}' - - '--label=org.opencontainers.image.description=Fast linters Runner for Go' - - '--label=org.opencontainers.image.source={{.GitURL}}' - - '--label=org.opencontainers.image.url={{.GitURL}}' - - '--label=org.opencontainers.image.documentation=https://golangci-lint.run' - - '--label=org.opencontainers.image.created={{.Date}}' - - '--label=org.opencontainers.image.revision={{.FullCommit}}' - - '--label=org.opencontainers.image.version={{.Version}}' - - '--platform=linux/amd64' - - - use: buildx - goos: linux - goarch: arm64 - dockerfile: build/buildx.Dockerfile - image_templates: - - 'golangci/golangci-lint:latest-arm64' - - 'golangci/golangci-lint:{{ .Tag }}-arm64' - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-arm64' - build_flag_templates: - - '--pull' - # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys - - '--label=org.opencontainers.image.title={{.ProjectName}}' - - '--label=org.opencontainers.image.description=Fast linters Runner for Go' - - '--label=org.opencontainers.image.source={{.GitURL}}' - - '--label=org.opencontainers.image.url={{.GitURL}}' - - '--label=org.opencontainers.image.documentation=https://golangci-lint.run' - - '--label=org.opencontainers.image.created={{.Date}}' - - '--label=org.opencontainers.image.revision={{.FullCommit}}' - - '--label=org.opencontainers.image.version={{.Version}}' - - '--platform=linux/arm64' - - - use: buildx - goos: linux - goarch: amd64 - dockerfile: build/buildx-alpine.Dockerfile - image_templates: - - 'golangci/golangci-lint:latest-alpine-amd64' - - 'golangci/golangci-lint:{{ .Tag }}-alpine-amd64' - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-alpine-amd64' - build_flag_templates: - - '--pull' - # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys - - '--label=org.opencontainers.image.title={{.ProjectName}}' - - '--label=org.opencontainers.image.description=Fast linters Runner for Go' - - '--label=org.opencontainers.image.source={{.GitURL}}' - - '--label=org.opencontainers.image.url={{.GitURL}}' - - '--label=org.opencontainers.image.documentation=https://golangci-lint.run' - - '--label=org.opencontainers.image.created={{.Date}}' - - '--label=org.opencontainers.image.revision={{.FullCommit}}' - - '--label=org.opencontainers.image.version={{.Version}}' - - '--platform=linux/amd64' - - - use: buildx - goos: linux - goarch: arm64 + 'org.opencontainers.image.title': '{{.ProjectName}}' + 'org.opencontainers.image.description': 'Fast linters Runner for Go' + 'org.opencontainers.image.source': '{{.GitURL}}' + 'org.opencontainers.image.url': '{{.GitURL}}' + 'org.opencontainers.image.documentation': 'https://golangci-lint.run' + 'org.opencontainers.image.created': '{{.Date}}' + 'org.opencontainers.image.revision': '{{.FullCommit}}' + 'org.opencontainers.image.version': '{{.Version}}' + - id: golangci-lint-alpine + images: + - 'golangci/golangci-lint' dockerfile: build/buildx-alpine.Dockerfile - image_templates: - - 'golangci/golangci-lint:latest-alpine-arm64' - - 'golangci/golangci-lint:{{ .Tag }}-alpine-arm64' - - 'golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-alpine-arm64' - build_flag_templates: - - '--pull' + platforms: + - linux/amd64 + - linux/arm64 + tags: + - 'latest-alpine' + - '{{ .Tag }}-alpine' + - 'v{{ .Major }}.{{ .Minor }}-alpine' + labels: # https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys - - '--label=org.opencontainers.image.title={{.ProjectName}}' - - '--label=org.opencontainers.image.description=Fast linters Runner for Go' - - '--label=org.opencontainers.image.source={{.GitURL}}' - - '--label=org.opencontainers.image.url={{.GitURL}}' - - '--label=org.opencontainers.image.documentation=https://golangci-lint.run' - - '--label=org.opencontainers.image.created={{.Date}}' - - '--label=org.opencontainers.image.revision={{.FullCommit}}' - - '--label=org.opencontainers.image.version={{.Version}}' - - '--platform=linux/arm64' + 'org.opencontainers.image.title': '{{.ProjectName}}' + 'org.opencontainers.image.description': 'Fast linters Runner for Go' + 'org.opencontainers.image.source': '{{.GitURL}}' + 'org.opencontainers.image.url': '{{.GitURL}}' + 'org.opencontainers.image.documentation': 'https://golangci-lint.run' + 'org.opencontainers.image.created': '{{.Date}}' + 'org.opencontainers.image.revision': '{{.FullCommit}}' + 'org.opencontainers.image.version': '{{.Version}}' diff --git a/build/buildx-alpine.Dockerfile b/build/buildx-alpine.Dockerfile index c9a3615d67b0..61f9d7fa96aa 100644 --- a/build/buildx-alpine.Dockerfile +++ b/build/buildx-alpine.Dockerfile @@ -1,6 +1,8 @@ # syntax=docker/dockerfile:1.4 FROM golang:1.25-alpine +ARG TARGETPLATFORM + # related to https://github.com/golangci/golangci-lint/issues/3107 ENV GOROOT /usr/local/go @@ -17,5 +19,5 @@ RUN apk --no-cache add gcc musl-dev git mercurial # Set all directories as safe RUN git config --global --add safe.directory '*' -COPY golangci-lint /usr/bin/ +COPY $TARGETPLATFORM/golangci-lint /usr/bin/ CMD ["golangci-lint"] diff --git a/build/buildx.Dockerfile b/build/buildx.Dockerfile index bcebe98bbe08..9f626b579c21 100644 --- a/build/buildx.Dockerfile +++ b/build/buildx.Dockerfile @@ -1,6 +1,8 @@ # syntax=docker/dockerfile:1.4 FROM golang:1.25 +ARG TARGETPLATFORM + # related to https://github.com/golangci/golangci-lint/issues/3107 ENV GOROOT /usr/local/go @@ -12,5 +14,5 @@ ENV GOTOOLCHAIN auto # Set all directories as safe RUN git config --global --add safe.directory '*' -COPY golangci-lint /usr/bin/ +COPY $TARGETPLATFORM/golangci-lint /usr/bin/ CMD ["golangci-lint"] From 7899c252ef287097d47dc7d85c45208c3c7b6df6 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 14 Sep 2025 04:14:40 +0200 Subject: [PATCH 2/4] dev: remove windows/arm --- .goreleaser.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index db90b852a357..02ed39427692 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -36,6 +36,10 @@ builds: ignore: - goos: darwin goarch: 386 + # Deprecated in go1.25, Removed in go1.26 + # https://go.dev/doc/go1.25#windows + - goos: windows + goarch: arm archives: - formats: [ 'tar.gz' ] From b38f529c25fcc08779647e12109f312659a88c9a Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 16 Sep 2025 02:09:03 +0200 Subject: [PATCH 3/4] dev: attestations --- .github/workflows/release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34abc0527d03..9e2ca6d7bf9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,3 +76,10 @@ jobs: CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }} + + - uses: actions/attest-build-provenance@v3 + with: + subject-checksums: ./dist/golangci-lint-*-checksums.txt + - uses: actions/attest-build-provenance@v3 + with: + subject-checksums: ./dist/digests.txt From 4d3b532bb281578ce9cac38de6420e8d85b3cd6d Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 28 Oct 2025 01:57:38 +0100 Subject: [PATCH 4/4] dev: note about chocolatey --- .goreleaser.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 02ed39427692..11084d15ed48 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -116,6 +116,9 @@ brews: test: | system "#{bin}/golangci-lint --version" +## chocolatey is disabled because mono has been removed from GitHub Actions runners due to security and maintenance concerns. +## The release is done manually and locally, with goreleaser after the release of the other elements. +## Note(ldez): add documentation about how to do it. #chocolateys: # - summary: Fast linters Runner for Go # description: |