From 68f0de49e261dc258004727f556c7d855ce39d51 Mon Sep 17 00:00:00 2001 From: David M Date: Mon, 21 Aug 2023 12:00:56 -0500 Subject: [PATCH] 32-bit binaries are no longer supported. Update CI/CD-related files (#2524) Co-authored-by: Tom Limoncelli --- .github/workflows/build.yml | 23 +++++++++++++------ .github/workflows/draft_release.yml | 20 ++++++++++++----- .goreleaser.yml | 34 ++++++++++------------------- Dockerfile | 5 +---- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e5822457..5dfa79c43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,8 +21,6 @@ jobs: key: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} restore-keys: linux-go-${{ hashFiles('go.sum') }}-${{ env.cache-key }} path: ${{ env.go-mod-path }} - - name: Install goreleaser - run: go install github.com/goreleaser/goreleaser@latest - run: mkdir -p "$TEST_RESULTS" - name: Run unit tests run: | @@ -44,15 +42,26 @@ jobs: echo "TAG_NAME=$(git config --global --add safe.directory /__w/dnscontrol/dnscontrol ; git describe)" >> $GITHUB_OUTPUT - name: Reveal version run: echo ${{ steps.version.outputs.TAG_NAME }} - - - name: Build binaries (if tagged) + - + id: build_binaries_tagged + name: Build binaries (if tagged) if: github.ref_type == 'tag' - run: goreleaser build + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: build env: GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }} - - name: Build binaries (not tagged) + - + id: build_binaries_not_tagged + name: Build binaries (not tagged) if: github.ref_type != 'tag' - run: goreleaser build --snapshot + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: build --snapshot env: GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }} integration-test-providers: diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index 2a303177a..fbe2623d0 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -15,10 +15,16 @@ jobs: pull-requests: write steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Checkout repo uses: actions/checkout@v3 with: fetch-depth: 0 +# Why "fetch-depth: 0"? To generate the release notes, we need the +# full git history. A shallow checkout would make release notes going +# back one commit. - name: Login to Docker Hub uses: docker/login-action@v2 @@ -38,9 +44,6 @@ jobs: with: go-version: ^1.20 - - name: Install goreleaser - run: go install github.com/goreleaser/goreleaser@latest - # For some reason goreleaser isn't correctly setting the version # string used by "dnscontrol version". Therefore, we're forcing the # string using the GORELEASER_CURRENT_TAG feature. @@ -53,9 +56,14 @@ jobs: - name: Reveal version run: echo ${{ steps.version.outputs.TAG_NAME }} - - - name: Goreleaser release - run: goreleaser release + - + id: release + name: Goreleaser release + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }} diff --git a/.goreleaser.yml b/.goreleaser.yml index ce104e6f7..dbf10e4e8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,6 +9,14 @@ builds: - windows - darwin - freebsd +# List of combinations of GOOS + GOARCH + GOARM to ignore. + ignore: + - goos: linux + goarch: "386" + - goos: windows + goarch: "386" + - goos: freebsd + goarch: "386" ldflags: - -linkmode=internal -s -w -X main.Version="{{ .Version }}" -X main.SHA="{{ .FullCommit }}" -X main.BuildTime={{ .Timestamp }} before: @@ -50,7 +58,7 @@ nfpms: - id: packages_rpm file_name_template: >- {{ .ProjectName }}- - {{ .Version }}. + {{- .Version }}. {{- if eq .Arch "386" }}i386 {{- else if eq .Arch "amd64" }}x86_64 {{- else }}{{ .Arch }}{{ end }} @@ -63,7 +71,7 @@ nfpms: - id: packages_deb file_name_template: >- {{ .ProjectName }}- - {{ .Version }}. + {{- .Version }}. {{- if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} homepage: https://docs.dnscontrol.org/ @@ -83,28 +91,12 @@ dockers: - build build_flag_templates: - "--pull" - - "--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 }}" - "--platform=linux/amd64" - - image_templates: - - &386_image "stackexchange/{{.ProjectName}}:{{ .Version }}-386" - - &386_image_ghcr "ghcr.io/stackexchange/{{.ProjectName}}:{{ .Version }}-386" - goos: linux - goarch: '386' - use: buildx - ids: - - build - build_flag_templates: - - "--pull" - "--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 }}" - - "--platform=linux/i386" - image_templates: - &arm_image "stackexchange/{{.ProjectName}}:{{ .Version }}-arm64" - &arm_image_ghcr "ghcr.io/stackexchange/{{.ProjectName}}:{{ .Version }}-arm64" @@ -115,34 +107,30 @@ dockers: - build 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 }}" - - "--platform=linux/arm64" docker_manifests: - name_template: "stackexchange/{{.ProjectName}}:{{ .Version }}" image_templates: - *amd_image - - *386_image - *arm_image - name_template: "ghcr.io/stackexchange/{{.ProjectName}}:{{ .Version }}" image_templates: - *amd_image_ghcr - - *386_image_ghcr - *arm_image_ghcr - name_template: "stackexchange/{{.ProjectName}}:latest" skip_push: auto image_templates: - *amd_image - - *386_image - *arm_image - name_template: "ghcr.io/stackexchange/{{.ProjectName}}:latest" skip_push: auto image_templates: - *amd_image_ghcr - - *386_image_ghcr - *arm_image_ghcr checksum: name_template: 'checksums.txt' diff --git a/Dockerfile b/Dockerfile index 6f34f33e3..c2405e582 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,10 @@ FROM alpine:3.18.3@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a as RUN - # Add runtime dependencies # - tzdata: Go time required external dependency eg: TRANSIP and possibly others # - ca-certificates: Needed for https to work properly -RUN --mount=type=cache,target=/var/cache/apk apk update -RUN --mount=type=cache,target=/var/cache/apk apk add --no-cache tzdata ca-certificates -RUN --mount=type=cache,target=/var/cache/apk update-ca-certificates +RUN apk update && apk add --no-cache tzdata ca-certificates && update-ca-certificates COPY dnscontrol /usr/local/bin/