From b594c33442be451bef4766b9d5c6bc59ddc70003 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:08:21 -0700 Subject: [PATCH 01/24] Build Docker images for PR --- .github/workflows/build.yaml | 15 +++--- .goreleaser.yml | 94 ++++++++++++++++++++---------------- Makefile | 7 ++- 3 files changed, 64 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 491d1fa8..e4c29b82 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,7 @@ on: push: branches: - - "main" + - "*" tags: - "v*" pull_request: @@ -82,13 +82,16 @@ jobs: # path: ${{ github.workspace }}/.docker-creds # contents: | # ${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}:docker.io - - name: goreleaser release-dry-run - run: make release-dry-run + # - name: goreleaser release-dry-run + # run: make release-dry-run + # if: "!startsWith(github.ref, 'refs/tags/v')" + + - name: goreleaser release branch + run: make release-branch if: "!startsWith(github.ref, 'refs/tags/v')" - - name: goreleaser release main branch - run: make release-main-branch - if: github.ref == 'refs/heads/main' + - run: docker manifest inspect ecadlabs/signatory:docker_images_branch_preview + if: "!startsWith(github.ref, 'refs/tags/v')" - name: goreleaser release run: make release diff --git a/.goreleaser.yml b/.goreleaser.yml index 42f5621c..baf45cd2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,7 +1,5 @@ -before: - hooks: builds: - - id: signatory-linux-armv6 + - id: signatory-linux-arm binary: signatory env: - CGO_ENABLED=1 @@ -17,40 +15,8 @@ builds: - arm goarm: - '6' - - - id: signatory-cli-linux-armv6 - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=arm-linux-gnueabihf-gcc - - CXX=arm-linux-gnueabihf-g++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm - goarm: - - '6' - - id: signatory-linux-armv7 - binary: signatory - env: - - CGO_ENABLED=1 - - CC=arm-linux-gnueabihf-gcc - - CXX=arm-linux-gnueabihf-g++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm - goarm: - '7' - - id: signatory-cli-linux-armv7 + - id: signatory-cli-linux-arm binary: signatory-cli env: - CGO_ENABLED=1 @@ -65,6 +31,7 @@ builds: goarch: - arm goarm: + - '6' - '7' - id: signatory-linux-arm64 binary: signatory @@ -215,8 +182,8 @@ dockers: - signatory - signatory-cli - image_templates: - - 'ecadlabs/signatory:{{ .Tag }}-amd64' - - 'ecadlabs/signatory:latest-amd64' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-amd64' + - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-amd64{{ end }}' dockerfile: Dockerfile use: buildx build_flag_templates: @@ -228,8 +195,21 @@ dockers: - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/amd64" - image_templates: - - 'ecadlabs/signatory:{{ .Tag }}-arm64' - - 'ecadlabs/signatory:latest-arm64' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' + - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-amd64{{ end }}' + dockerfile: Dockerfile + use: buildx + 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=darwin/amd64" + - image_templates: + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' + - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' dockerfile: Dockerfile use: buildx build_flag_templates: @@ -242,8 +222,23 @@ dockers: - "--platform=linux/arm64" goarch: arm64 - image_templates: - - 'ecadlabs/signatory:{{ .Tag }}-armv7' - - 'ecadlabs/signatory:latest-armv7' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' + - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-arm64{{ end }}' + dockerfile: Dockerfile + use: buildx + 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=darwin/arm64" + goos: darwin + goarch: arm64 + - image_templates: + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' + - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-linux-armv7{{ end }}' dockerfile: Dockerfile use: buildx build_flag_templates: @@ -256,6 +251,21 @@ dockers: - "--platform=linux/arm/v7" goarch: arm goarm: '7' +docker_manifests: + - name_template: 'ecadlabs/signatory:latest' + image_templates: + - 'ecadlabs/signatory:latest-linux-amd64' + - 'ecadlabs/signatory:latest-darwin-amd64' + - 'ecadlabs/signatory:latest-linux-arm64' + - 'ecadlabs/signatory:latest-darwin-arm64' + - 'ecadlabs/signatory:latest-linux-armv7' + - name_template: 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}' + image_templates: + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-amd64' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' checksum: name_template: checksums.txt snapshot: diff --git a/Makefile b/Makefile index 294aacea..d0f1d3f2 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,8 @@ release-dry-run: --rm-dist \ --snapshot -.PHONY: release-main-branch -release-main-branch: +.PHONY: release-branch +release-branch: @if [ ! -f ".release-env" ]; then \ echo "\033[91m.release-env is required for release\033[0m";\ exit 1;\ @@ -52,9 +52,8 @@ release-main-branch: -w /go/src/$(PACKAGE_NAME) \ goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ release \ - --config .goreleaser-branch.yml \ --rm-dist \ - --skip-validate + --snapshot .PHONY: release release: From 5fdf2b8c858c106d2970525f5162a5389ef79d0f Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:30:20 -0700 Subject: [PATCH 02/24] Disable darwin --- .goreleaser.yml | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index baf45cd2..df031219 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -194,19 +194,19 @@ dockers: - "--label=org.opencontainers.image.version={{.Version}}" - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/amd64" - - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' - - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-amd64{{ end }}' - dockerfile: Dockerfile - use: buildx - 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=darwin/amd64" + # - image_templates: + # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' + # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-amd64{{ end }}' + # dockerfile: Dockerfile + # use: buildx + # 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=darwin/amd64" - image_templates: - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' @@ -221,21 +221,21 @@ dockers: - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/arm64" goarch: arm64 - - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' - - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-arm64{{ end }}' - dockerfile: Dockerfile - use: buildx - 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=darwin/arm64" - goos: darwin - goarch: arm64 + # - image_templates: + # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' + # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-arm64{{ end }}' + # dockerfile: Dockerfile + # use: buildx + # 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=darwin/arm64" + # goos: darwin + # goarch: arm64 - image_templates: - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-linux-armv7{{ end }}' @@ -255,16 +255,16 @@ docker_manifests: - name_template: 'ecadlabs/signatory:latest' image_templates: - 'ecadlabs/signatory:latest-linux-amd64' - - 'ecadlabs/signatory:latest-darwin-amd64' + # - 'ecadlabs/signatory:latest-darwin-amd64' - 'ecadlabs/signatory:latest-linux-arm64' - - 'ecadlabs/signatory:latest-darwin-arm64' + # - 'ecadlabs/signatory:latest-darwin-arm64' - 'ecadlabs/signatory:latest-linux-armv7' - name_template: 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}' image_templates: - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-amd64' - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' + # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' + # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' checksum: name_template: checksums.txt From 685c883b5f138eed4556b305022c3cd253a0c411 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:47:58 -0700 Subject: [PATCH 03/24] Create Docker manifest --- .github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e4c29b82..db58b620 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -90,6 +90,9 @@ jobs: run: make release-branch if: "!startsWith(github.ref, 'refs/tags/v')" + - run: docker image ls + + - run: docker manifest create ecadlabs/signatory:docker_images_branch_preview docker_images_branch_preview-linux-armv7 ecadlabs/signatory:docker_images_branch_preview-linux-amd64 ecadlabs/signatory:docker_images_branch_preview-linux-arm64 - run: docker manifest inspect ecadlabs/signatory:docker_images_branch_preview if: "!startsWith(github.ref, 'refs/tags/v')" From c7a31a8f4082c42dd3bd009b5e2796715ee1baba Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 20 Apr 2023 17:08:44 -0700 Subject: [PATCH 04/24] Add dockerhub login --- .github/workflows/build.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index db58b620..11d5b2d0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -61,6 +61,11 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Set up QEMU uses: docker/setup-qemu-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Set up Go uses: actions/setup-go@v3 with: From 4acdbd3b2f1d49fed19ea53f987382b9a812359c Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Wed, 26 Apr 2023 08:57:48 -0700 Subject: [PATCH 05/24] Build only for amd64 and arm64 --- .github/workflows/build.yaml | 62 +++---- .goreleaser.yml | 308 ++++++++++++++++------------------- 2 files changed, 164 insertions(+), 206 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 11d5b2d0..8af87d99 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,45 +18,43 @@ env: CC_BINARY_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 jobs: - test: - name: Test - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - uses: actions/checkout@v2 - - name: Setup Code Climate test-reporter - run: | - curl -L "$CC_BINARY_URL" > ./cc-test-reporter - chmod +x ./cc-test-reporter - - name: Run tests - run: | - export GIT_COMMIT_SHA='${{ github.sha }}' - export GIT_BRANCH="$(echo '${{ github.ref }}' | sed -E -e 's/.*\/(.*)/\1/')" - export CC_TEST_REPORTER_ID='${{ secrets.CC_TEST_REPORTER_ID }}' + # test: + # name: Test + # runs-on: ubuntu-latest + # steps: + # - uses: actions/setup-go@v2 + # with: + # go-version: 1.19 + # - uses: actions/checkout@v2 + # - name: Setup Code Climate test-reporter + # run: | + # curl -L "$CC_BINARY_URL" > ./cc-test-reporter + # chmod +x ./cc-test-reporter + # - name: Run tests + # run: | + # export GIT_COMMIT_SHA='${{ github.sha }}' + # export GIT_BRANCH="$(echo '${{ github.ref }}' | sed -E -e 's/.*\/(.*)/\1/')" + # export CC_TEST_REPORTER_ID='${{ secrets.CC_TEST_REPORTER_ID }}' - ./cc-test-reporter before-build + # ./cc-test-reporter before-build - echo "Running tests..." - go test -coverprofile c.out ./... + # echo "Running tests..." + # go test -coverprofile c.out ./... - mod="$(cat go.mod | awk '/^module/ {print $2}')" + # mod="$(cat go.mod | awk '/^module/ {print $2}')" - if [[ ! -z "$CC_TEST_REPORTER_ID" ]]; then - echo "Generating coverage report..." - ./cc-test-reporter after-build -p "${mod}/" -t gocov - fi + # if [[ ! -z "$CC_TEST_REPORTER_ID" ]]; then + # echo "Generating coverage report..." + # ./cc-test-reporter after-build -p "${mod}/" -t gocov + # fi publish: name: Goreleaser runs-on: ubuntu-latest - needs: test + # needs: test steps: - name: Checkout uses: actions/checkout@v3 - with: - fetch-depth: 0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Set up QEMU @@ -66,10 +64,6 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.17 - name: Write release-env file uses: DamianReeves/write-file-action@v1.0 @@ -97,10 +91,6 @@ jobs: - run: docker image ls - - run: docker manifest create ecadlabs/signatory:docker_images_branch_preview docker_images_branch_preview-linux-armv7 ecadlabs/signatory:docker_images_branch_preview-linux-amd64 ecadlabs/signatory:docker_images_branch_preview-linux-arm64 - - run: docker manifest inspect ecadlabs/signatory:docker_images_branch_preview - if: "!startsWith(github.ref, 'refs/tags/v')" - - name: goreleaser release run: make release if: startsWith(github.ref, 'refs/tags/v') diff --git a/.goreleaser.yml b/.goreleaser.yml index df031219..40511fbd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,38 +1,38 @@ builds: - - id: signatory-linux-arm - binary: signatory - env: - - CGO_ENABLED=1 - - CC=arm-linux-gnueabihf-gcc - - CXX=arm-linux-gnueabihf-g++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm - goarm: - - '6' - - '7' - - id: signatory-cli-linux-arm - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=arm-linux-gnueabihf-gcc - - CXX=arm-linux-gnueabihf-g++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm - goarm: - - '6' - - '7' + # - id: signatory-linux-arm + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=arm-linux-gnueabihf-gcc + # - CXX=arm-linux-gnueabihf-g++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - linux + # goarch: + # - arm + # goarm: + # - '6' + # - '7' + # - id: signatory-cli-linux-arm + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=arm-linux-gnueabihf-gcc + # - CXX=arm-linux-gnueabihf-g++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - linux + # goarch: + # - arm + # goarm: + # - '6' + # - '7' - id: signatory-linux-arm64 binary: signatory env: @@ -91,92 +91,92 @@ builds: goarch: - amd64 - - id: signatory-darwin-amd - binary: signatory - env: - - CGO_ENABLED=1 - - CC=o64-clang - - CXX=o64-clang++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - amd64 - - id: signatory-cli-darwing-amd - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=o64-clang - - CXX=o64-clang++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - amd64 + # - id: signatory-darwin-amd + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=o64-clang + # - CXX=o64-clang++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - amd64 + # - id: signatory-cli-darwing-amd + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=o64-clang + # - CXX=o64-clang++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - amd64 - - id: signatory-darwin-arm - binary: signatory - env: - - CGO_ENABLED=1 - - CC=oa64-clang - - CXX=oa64-clang++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - arm64 - - id: signatory-cli-darwing-arm - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=oa64-clang - - CXX=oa64-clang++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - arm64 + # - id: signatory-darwin-arm + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=oa64-clang + # - CXX=oa64-clang++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - arm64 + # - id: signatory-cli-darwing-arm + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=oa64-clang + # - CXX=oa64-clang++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - arm64 - - id: signatory-windows-amd - binary: signatory - env: - - CGO_ENABLED=1 - - CC=x86_64-w64-mingw32-gcc - - CXX=x86_64-w64-mingw32-g++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - windows - goarch: - - amd64 - - id: signatory-cli-windows-amd - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=x86_64-w64-mingw32-gcc - - CXX=x86_64-w64-mingw32-g++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - windows - goarch: - - amd64 + # - id: signatory-windows-amd + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=x86_64-w64-mingw32-gcc + # - CXX=x86_64-w64-mingw32-g++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - windows + # goarch: + # - amd64 + # - id: signatory-cli-windows-amd + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=x86_64-w64-mingw32-gcc + # - CXX=x86_64-w64-mingw32-g++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - windows + # goarch: + # - amd64 dockers: - ids: - signatory @@ -195,8 +195,8 @@ dockers: - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/amd64" # - image_templates: - # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' - # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-amd64{{ end }}' + # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' + # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' # dockerfile: Dockerfile # use: buildx # build_flag_templates: @@ -206,24 +206,11 @@ dockers: # - "--label=org.opencontainers.image.revision={{.FullCommit}}" # - "--label=org.opencontainers.image.version={{.Version}}" # - "--label=org.opencontainers.image.source={{.GitURL}}" - # - "--platform=darwin/amd64" - - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' - - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' - dockerfile: Dockerfile - use: buildx - 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/arm64" - goarch: arm64 + # - "--platform=linux/arm64" + # goarch: arm64 # - image_templates: - # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' - # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-darwin-arm64{{ end }}' + # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' + # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-linux-armv7{{ end }}' # dockerfile: Dockerfile # use: buildx # build_flag_templates: @@ -233,39 +220,20 @@ dockers: # - "--label=org.opencontainers.image.revision={{.FullCommit}}" # - "--label=org.opencontainers.image.version={{.Version}}" # - "--label=org.opencontainers.image.source={{.GitURL}}" - # - "--platform=darwin/arm64" - # goos: darwin - # goarch: arm64 - - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' - - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-linux-armv7{{ end }}' - dockerfile: Dockerfile - use: buildx - 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/arm/v7" - goarch: arm - goarm: '7' -docker_manifests: - - name_template: 'ecadlabs/signatory:latest' - image_templates: - - 'ecadlabs/signatory:latest-linux-amd64' - # - 'ecadlabs/signatory:latest-darwin-amd64' - - 'ecadlabs/signatory:latest-linux-arm64' - # - 'ecadlabs/signatory:latest-darwin-arm64' - - 'ecadlabs/signatory:latest-linux-armv7' - - name_template: 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}' - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-amd64' - # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-amd64' - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' - # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-darwin-arm64' - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' + # - "--platform=linux/arm/v7" + # goarch: arm + # goarm: '7' +# docker_manifests: +# - name_template: 'ecadlabs/signatory:latest' +# image_templates: +# - 'ecadlabs/signatory:latest-linux-amd64' +# - 'ecadlabs/signatory:latest-linux-arm64' +# - 'ecadlabs/signatory:latest-linux-armv7' +# - name_template: 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}' +# image_templates: +# - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-amd64' +# - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' +# - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' checksum: name_template: checksums.txt snapshot: From 2a2c2a741d6ac6f3dd48bdb6272da569f0e3a6c7 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:10:52 -0700 Subject: [PATCH 06/24] Change snapshot template name to be more descriptive --- .github/workflows/build.yaml | 6 ++++-- .goreleaser.yml | 36 ++++++++++++++++++------------------ Makefile | 9 ++------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8af87d99..fdb0b5bb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -61,12 +61,14 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Login to DockerHub uses: docker/login-action@v2 + if: "!startsWith(github.ref, 'refs/tags/v')" with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Write release-env file uses: DamianReeves/write-file-action@v1.0 + if: startsWith(github.ref, 'refs/tags/v') with: path: ${{ github.workspace }}/.release-env contents: | @@ -85,8 +87,8 @@ jobs: # run: make release-dry-run # if: "!startsWith(github.ref, 'refs/tags/v')" - - name: goreleaser release branch - run: make release-branch + - name: goreleaser release preview + run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" - run: docker image ls diff --git a/.goreleaser.yml b/.goreleaser.yml index 40511fbd..cacc783c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -182,7 +182,7 @@ dockers: - signatory - signatory-cli - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-amd64' + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-amd64' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-amd64{{ end }}' dockerfile: Dockerfile use: buildx @@ -194,23 +194,23 @@ dockers: - "--label=org.opencontainers.image.version={{.Version}}" - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/amd64" + - image_templates: + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-arm64' + - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' + dockerfile: Dockerfile + use: buildx + 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/arm64" + goarch: arm64 # - image_templates: - # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' - # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' - # dockerfile: Dockerfile - # use: buildx - # 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/arm64" - # goarch: arm64 - # - image_templates: - # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' - # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-linux-armv7{{ end }}' + # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-armv7' + # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-armv7{{ end }}' # dockerfile: Dockerfile # use: buildx # build_flag_templates: @@ -237,7 +237,7 @@ dockers: checksum: name_template: checksums.txt snapshot: - name_template: '{{ .Tag }}-next' + name_template: '{{ .Version }}-SNAPSHOT-{{.ShortCommit}}' changelog: sort: asc filters: diff --git a/Makefile b/Makefile index d0f1d3f2..af9af5e6 100644 --- a/Makefile +++ b/Makefile @@ -36,17 +36,12 @@ release-dry-run: --rm-dist \ --snapshot -.PHONY: release-branch -release-branch: - @if [ ! -f ".release-env" ]; then \ - echo "\033[91m.release-env is required for release\033[0m";\ - exit 1;\ - fi +.PHONY: release-preview +release-preview: docker run \ --rm \ --privileged \ -e CGO_ENABLED=1 \ - --env-file .release-env \ -v /var/run/docker.sock:/var/run/docker.sock \ -v `pwd`:/go/src/$(PACKAGE_NAME) \ -w /go/src/$(PACKAGE_NAME) \ From 8eec6755878c160cced86bfdb29c7128cd6e3bc4 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:35:43 -0700 Subject: [PATCH 07/24] Push preview images to GHCR --- .github/workflows/build.yaml | 21 +++--- .goreleaser.yml | 132 ++++++++++++++++++----------------- 2 files changed, 78 insertions(+), 75 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fdb0b5bb..e94791ca 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -63,8 +63,9 @@ jobs: uses: docker/login-action@v2 if: "!startsWith(github.ref, 'refs/tags/v')" with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Write release-env file uses: DamianReeves/write-file-action@v1.0 @@ -77,22 +78,18 @@ jobs: DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD=${{ secrets.DOCKER_PASSWORD }} - # - name: Write docker-creds file - # uses: DamianReeves/write-file-action@v1.0 - # with: - # path: ${{ github.workspace }}/.docker-creds - # contents: | - # ${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}:docker.io - # - name: goreleaser release-dry-run - # run: make release-dry-run - # if: "!startsWith(github.ref, 'refs/tags/v')" - - name: goreleaser release preview run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" - run: docker image ls + - name: Push Signatory preview images to GH Container Registry + run: > + docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-amd64; + docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-arm64; + if: "!startsWith(github.ref, 'refs/tags/v')" + - name: goreleaser release run: make release if: startsWith(github.ref, 'refs/tags/v') diff --git a/.goreleaser.yml b/.goreleaser.yml index cacc783c..e7c815bd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,44 +1,11 @@ builds: - # - id: signatory-linux-arm - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=arm-linux-gnueabihf-gcc - # - CXX=arm-linux-gnueabihf-g++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - linux - # goarch: - # - arm - # goarm: - # - '6' - # - '7' - # - id: signatory-cli-linux-arm - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=arm-linux-gnueabihf-gcc - # - CXX=arm-linux-gnueabihf-g++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - linux - # goarch: - # - arm - # goarm: - # - '6' - # - '7' - - id: signatory-linux-arm64 +# LINUX + - id: signatory-linux-amd binary: signatory env: - CGO_ENABLED=1 - - CC=aarch64-linux-gnu-gcc - - CXX=aarch64-linux-gnu-g++ + - CC=gcc + - CXX=g++ main: ./cmd/signatory/main.go ldflags: - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' @@ -46,13 +13,13 @@ builds: goos: - linux goarch: - - arm64 - - id: signatory-cli-linux-arm64 + - amd64 + - id: signatory-cli-linux-amd binary: signatory-cli env: - CGO_ENABLED=1 - - CC=aarch64-linux-gnu-gcc - - CXX=aarch64-linux-gnu-g++ + - CC=gcc + - CXX=g++ main: ./cmd/signatory-cli/main.go ldflags: - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' @@ -60,14 +27,14 @@ builds: goos: - linux goarch: - - arm64 + - amd64 - - id: signatory-linux-amd + - id: signatory-linux-arm64 binary: signatory env: - CGO_ENABLED=1 - - CC=gcc - - CXX=g++ + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ main: ./cmd/signatory/main.go ldflags: - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' @@ -75,13 +42,13 @@ builds: goos: - linux goarch: - - amd64 - - id: signatory-cli-linux-amd + - arm64 + - id: signatory-cli-linux-arm64 binary: signatory-cli env: - CGO_ENABLED=1 - - CC=gcc - - CXX=g++ + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ main: ./cmd/signatory-cli/main.go ldflags: - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' @@ -89,8 +56,44 @@ builds: goos: - linux goarch: - - amd64 + - arm64 + # - id: signatory-linux-arm + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=arm-linux-gnueabihf-gcc + # - CXX=arm-linux-gnueabihf-g++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - linux + # goarch: + # - arm + # goarm: + # - '6' + # - '7' + # - id: signatory-cli-linux-arm + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=arm-linux-gnueabihf-gcc + # - CXX=arm-linux-gnueabihf-g++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - linux + # goarch: + # - arm + # goarm: + # - '6' + # - '7' + +# MACOS # - id: signatory-darwin-amd # binary: signatory # env: @@ -149,6 +152,7 @@ builds: # goarch: # - arm64 +# WINDOWS # - id: signatory-windows-amd # binary: signatory # env: @@ -182,7 +186,7 @@ dockers: - signatory - signatory-cli - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-amd64' + - '{{ if .IsSnapshot }}ghcr.io/{{ else }}{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-amd64' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-amd64{{ end }}' dockerfile: Dockerfile use: buildx @@ -195,7 +199,7 @@ dockers: - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/amd64" - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-arm64' + - '{{ if .IsSnapshot }}ghcr.io/{{ else }}{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-arm64' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' dockerfile: Dockerfile use: buildx @@ -223,17 +227,19 @@ dockers: # - "--platform=linux/arm/v7" # goarch: arm # goarm: '7' -# docker_manifests: -# - name_template: 'ecadlabs/signatory:latest' -# image_templates: -# - 'ecadlabs/signatory:latest-linux-amd64' -# - 'ecadlabs/signatory:latest-linux-arm64' -# - 'ecadlabs/signatory:latest-linux-armv7' -# - name_template: 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}' -# image_templates: -# - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-amd64' -# - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-arm64' -# - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-linux-armv7' + +docker_manifests: + - name_template: 'ecadlabs/signatory:latest' + image_templates: + - 'ecadlabs/signatory:latest-amd64' + - 'ecadlabs/signatory:latest-arm64' + - 'ecadlabs/signatory:latest-armv7' + - name_template: 'ecadlabs/signatory:{{ .Tag }}' + image_templates: + - 'ecadlabs/signatory:{{ .Tag }}-amd64' + - 'ecadlabs/signatory:{{ .Tag }}-arm64' + - 'ecadlabs/signatory:{{ .Tag }}-armv7' + checksum: name_template: checksums.txt snapshot: From 3233fb75183481bb050d7e504004e66785e12dc2 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:48:35 -0700 Subject: [PATCH 08/24] Uncomment code --- .github/workflows/build.yaml | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e94791ca..8043b09d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,40 +18,40 @@ env: CC_BINARY_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 jobs: - # test: - # name: Test - # runs-on: ubuntu-latest - # steps: - # - uses: actions/setup-go@v2 - # with: - # go-version: 1.19 - # - uses: actions/checkout@v2 - # - name: Setup Code Climate test-reporter - # run: | - # curl -L "$CC_BINARY_URL" > ./cc-test-reporter - # chmod +x ./cc-test-reporter - # - name: Run tests - # run: | - # export GIT_COMMIT_SHA='${{ github.sha }}' - # export GIT_BRANCH="$(echo '${{ github.ref }}' | sed -E -e 's/.*\/(.*)/\1/')" - # export CC_TEST_REPORTER_ID='${{ secrets.CC_TEST_REPORTER_ID }}' + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: 1.19 + - uses: actions/checkout@v2 + - name: Setup Code Climate test-reporter + run: | + curl -L "$CC_BINARY_URL" > ./cc-test-reporter + chmod +x ./cc-test-reporter + - name: Run tests + run: | + export GIT_COMMIT_SHA='${{ github.sha }}' + export GIT_BRANCH="$(echo '${{ github.ref }}' | sed -E -e 's/.*\/(.*)/\1/')" + export CC_TEST_REPORTER_ID='${{ secrets.CC_TEST_REPORTER_ID }}' - # ./cc-test-reporter before-build + ./cc-test-reporter before-build - # echo "Running tests..." - # go test -coverprofile c.out ./... + echo "Running tests..." + go test -coverprofile c.out ./... - # mod="$(cat go.mod | awk '/^module/ {print $2}')" + mod="$(cat go.mod | awk '/^module/ {print $2}')" - # if [[ ! -z "$CC_TEST_REPORTER_ID" ]]; then - # echo "Generating coverage report..." - # ./cc-test-reporter after-build -p "${mod}/" -t gocov - # fi + if [[ ! -z "$CC_TEST_REPORTER_ID" ]]; then + echo "Generating coverage report..." + ./cc-test-reporter after-build -p "${mod}/" -t gocov + fi publish: name: Goreleaser runs-on: ubuntu-latest - # needs: test + needs: test steps: - name: Checkout uses: actions/checkout@v3 From 18ac9d46db01b27a5f710170cd953054ce5a8cfc Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:52:48 -0700 Subject: [PATCH 09/24] Delete unused .goreleaser-branch.yml file --- .github/workflows/build.yaml | 4 +- .goreleaser-branch.yml | 205 --------------------------- .goreleaser.yml | 266 +++++++++++++++++------------------ 3 files changed, 135 insertions(+), 340 deletions(-) delete mode 100644 .goreleaser-branch.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8043b09d..58ce197b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,7 @@ on: push: branches: - - "*" + - "main" tags: - "v*" pull_request: @@ -82,12 +82,12 @@ jobs: run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" - - run: docker image ls - name: Push Signatory preview images to GH Container Registry run: > docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-amd64; docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-arm64; + docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-armv7; if: "!startsWith(github.ref, 'refs/tags/v')" - name: goreleaser release diff --git a/.goreleaser-branch.yml b/.goreleaser-branch.yml deleted file mode 100644 index 3625bb68..00000000 --- a/.goreleaser-branch.yml +++ /dev/null @@ -1,205 +0,0 @@ -builds: - - id: signatory-linux-armv7 - binary: signatory - env: - - CGO_ENABLED=1 - - CC=arm-linux-gnueabihf-gcc - - CXX=arm-linux-gnueabihf-g++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm - goarm: - - '7' - - id: signatory-cli-linux-armv7 - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=arm-linux-gnueabihf-gcc - - CXX=arm-linux-gnueabihf-g++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm - goarm: - - '7' - - - - id: signatory-linux-arm64 - binary: signatory - env: - - CGO_ENABLED=1 - - CC=aarch64-linux-gnu-gcc - - CXX=aarch64-linux-gnu-g++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm64 - - - id: signatory-cli-linux-arm64 - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=aarch64-linux-gnu-gcc - - CXX=aarch64-linux-gnu-g++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - arm64 - - - - id: signatory-linux-amd - binary: signatory - env: - - CGO_ENABLED=1 - - CC=gcc - - CXX=g++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - amd64 - - - id: signatory-cli-linux-amd - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=gcc - - CXX=g++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - linux - goarch: - - amd64 - - - - id: signatory-darwin-amd - binary: signatory - env: - - CGO_ENABLED=1 - - CC=o64-clang - - CXX=o64-clang++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - amd64 - - - id: signatory-cli-darwin-amd - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=o64-clang - - CXX=o64-clang++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - amd64 - - - - id: signatory-darwin-arm - binary: signatory - env: - - CGO_ENABLED=1 - - CC=oa64-clang - - CXX=oa64-clang++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - arm64 - - - id: signatory-cli-darwin-arm - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=oa64-clang - - CXX=oa64-clang++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - arm64 - - -dockers: - - ids: - - signatory - - signatory-cli - - image_templates: - - 'ecadlabs/signatory:{{ .Branch }}-amd64' - dockerfile: Dockerfile - use: buildx - 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: - - 'ecadlabs/signatory:{{ .Branch }}-arm64' - dockerfile: Dockerfile - use: buildx - 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/arm64" - goarch: arm64 - - image_templates: - - 'ecadlabs/signatory:{{ .Branch }}-armv7' - dockerfile: Dockerfile - use: buildx - 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/arm/v7" - goarch: arm - goarm: '7' - -release: - disable: true diff --git a/.goreleaser.yml b/.goreleaser.yml index e7c815bd..0759571a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -58,129 +58,129 @@ builds: goarch: - arm64 - # - id: signatory-linux-arm - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=arm-linux-gnueabihf-gcc - # - CXX=arm-linux-gnueabihf-g++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - linux - # goarch: - # - arm - # goarm: - # - '6' - # - '7' - # - id: signatory-cli-linux-arm - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=arm-linux-gnueabihf-gcc - # - CXX=arm-linux-gnueabihf-g++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - linux - # goarch: - # - arm - # goarm: - # - '6' - # - '7' + - id: signatory-linux-arm + binary: signatory + env: + - CGO_ENABLED=1 + - CC=arm-linux-gnueabihf-gcc + - CXX=arm-linux-gnueabihf-g++ + main: ./cmd/signatory/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - linux + goarch: + - arm + goarm: + - '6' + - '7' + - id: signatory-cli-linux-arm + binary: signatory-cli + env: + - CGO_ENABLED=1 + - CC=arm-linux-gnueabihf-gcc + - CXX=arm-linux-gnueabihf-g++ + main: ./cmd/signatory-cli/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - linux + goarch: + - arm + goarm: + - '6' + - '7' # MACOS - # - id: signatory-darwin-amd - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=o64-clang - # - CXX=o64-clang++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - amd64 - # - id: signatory-cli-darwing-amd - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=o64-clang - # - CXX=o64-clang++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - amd64 + - id: signatory-darwin-amd + binary: signatory + env: + - CGO_ENABLED=1 + - CC=o64-clang + - CXX=o64-clang++ + main: ./cmd/signatory/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - amd64 + - id: signatory-cli-darwing-amd + binary: signatory-cli + env: + - CGO_ENABLED=1 + - CC=o64-clang + - CXX=o64-clang++ + main: ./cmd/signatory-cli/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - amd64 - # - id: signatory-darwin-arm - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=oa64-clang - # - CXX=oa64-clang++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - arm64 - # - id: signatory-cli-darwing-arm - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=oa64-clang - # - CXX=oa64-clang++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - arm64 + - id: signatory-darwin-arm + binary: signatory + env: + - CGO_ENABLED=1 + - CC=oa64-clang + - CXX=oa64-clang++ + main: ./cmd/signatory/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - arm64 + - id: signatory-cli-darwing-arm + binary: signatory-cli + env: + - CGO_ENABLED=1 + - CC=oa64-clang + - CXX=oa64-clang++ + main: ./cmd/signatory-cli/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - arm64 # WINDOWS - # - id: signatory-windows-amd - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=x86_64-w64-mingw32-gcc - # - CXX=x86_64-w64-mingw32-g++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - windows - # goarch: - # - amd64 - # - id: signatory-cli-windows-amd - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=x86_64-w64-mingw32-gcc - # - CXX=x86_64-w64-mingw32-g++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - windows - # goarch: - # - amd64 + - id: signatory-windows-amd + binary: signatory + env: + - CGO_ENABLED=1 + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + main: ./cmd/signatory/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - windows + goarch: + - amd64 + - id: signatory-cli-windows-amd + binary: signatory-cli + env: + - CGO_ENABLED=1 + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + main: ./cmd/signatory-cli/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - windows + goarch: + - amd64 dockers: - ids: - signatory @@ -212,21 +212,21 @@ dockers: - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/arm64" goarch: arm64 - # - image_templates: - # - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-armv7' - # - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-armv7{{ end }}' - # dockerfile: Dockerfile - # use: buildx - # 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/arm/v7" - # goarch: arm - # goarm: '7' + - image_templates: + - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-armv7' + - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-armv7{{ end }}' + dockerfile: Dockerfile + use: buildx + 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/arm/v7" + goarch: arm + goarm: '7' docker_manifests: - name_template: 'ecadlabs/signatory:latest' From fdd4b5adbfea49f997f6f031bc1ce2bf0ebffa54 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:57:21 -0700 Subject: [PATCH 10/24] Use Docker Manifest for preview images --- .github/workflows/build.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 58ce197b..4f4ea40c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -82,14 +82,21 @@ jobs: run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" + - name: Create Docker manifest for preview images + run: docker manifest create ghcr.io/ecadlabs/signatory:${{ github.ref_name }} ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-armv7 + if: "!startsWith(github.ref, 'refs/tags/v')" - - name: Push Signatory preview images to GH Container Registry - run: > - docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-amd64; - docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-arm64; - docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-armv7; + - name: Push Docker manifest for preview images + run: docker manifest push ghcr.io/ecadlabs/signatory:${{ github.ref_name }} if: "!startsWith(github.ref, 'refs/tags/v')" + #- name: Push Signatory preview images to GH Container Registry + # run: > + # docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-amd64; + # docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-arm64; + # docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-armv7; + # if: "!startsWith(github.ref, 'refs/tags/v')" + - name: goreleaser release run: make release if: startsWith(github.ref, 'refs/tags/v') From d6e2a64d6fc1f049e696134c231c5542d355f4e2 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Wed, 26 Apr 2023 18:33:55 -0700 Subject: [PATCH 11/24] Change branch --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4f4ea40c..2dd0d2e7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,7 @@ on: push: branches: - - "main" + - "*" tags: - "v*" pull_request: From ade8a7f6a04c4a3a486f830cbd8541038091d7f4 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 11:10:01 -0700 Subject: [PATCH 12/24] Debug docker manifest --- .github/workflows/build.yaml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2dd0d2e7..647a7aab 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -82,19 +82,25 @@ jobs: run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" + - run: echo "The head ref is ${{ github.head_ref }}. The ref is ${{ github.ref }}. the ref name is ${{ github.ref_name}}". + + - run: docker image ls + + - run: docker --version + - name: Create Docker manifest for preview images - run: docker manifest create ghcr.io/ecadlabs/signatory:${{ github.ref_name }} ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-armv7 + run: docker manifest create ghcr.io/ecadlabs/signatory:${{ github.head_ref }} ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-armv7 if: "!startsWith(github.ref, 'refs/tags/v')" - name: Push Docker manifest for preview images - run: docker manifest push ghcr.io/ecadlabs/signatory:${{ github.ref_name }} + run: docker manifest push ghcr.io/ecadlabs/signatory:${{ github.head_ref }} if: "!startsWith(github.ref, 'refs/tags/v')" #- name: Push Signatory preview images to GH Container Registry # run: > - # docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-amd64; - # docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-arm64; - # docker push ghcr.io/ecadlabs/signatory:${{ github.ref_name }}-armv7; + # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-amd64; + # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-arm64; + # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-armv7; # if: "!startsWith(github.ref, 'refs/tags/v')" - name: goreleaser release From d66b95169b78fe95e9fd4412d77acc1962bab785 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 16:53:50 -0700 Subject: [PATCH 13/24] fix(build.yaml): add missing quotation mark in echo statement refactor(build.yaml): remove unnecessary echo statement --- .github/workflows/build.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 647a7aab..87578557 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,6 +22,9 @@ jobs: name: Test runs-on: ubuntu-latest steps: + - run: echo "The head ref is ${{ github.head_ref || github.ref_name }} + + - uses: actions/setup-go@v2 with: go-version: 1.19 @@ -82,8 +85,6 @@ jobs: run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" - - run: echo "The head ref is ${{ github.head_ref }}. The ref is ${{ github.ref }}. the ref name is ${{ github.ref_name}}". - - run: docker image ls - run: docker --version From 89b07913cb5a5ce4738375d064adba9591640545 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 16:55:01 -0700 Subject: [PATCH 14/24] fix(build.yaml): add missing quotation mark in echo command --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 87578557..efa6a653 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,7 +22,7 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - run: echo "The head ref is ${{ github.head_ref || github.ref_name }} + - run: echo "The head ref is ${{ github.head_ref || github.ref_name }}" - uses: actions/setup-go@v2 From 9ab36afc9091710a0f0a0cbcfdd92eac29e3275e Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 17:02:14 -0700 Subject: [PATCH 15/24] ci(build.yaml): change push branch to main and add docker manifest GitHub Action --- .github/workflows/build.yaml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index efa6a653..1e1e0227 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,7 @@ on: push: branches: - - "*" + - "main" tags: - "v*" pull_request: @@ -22,9 +22,6 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - run: echo "The head ref is ${{ github.head_ref || github.ref_name }}" - - - uses: actions/setup-go@v2 with: go-version: 1.19 @@ -87,14 +84,12 @@ jobs: - run: docker image ls - - run: docker --version - - - name: Create Docker manifest for preview images - run: docker manifest create ghcr.io/ecadlabs/signatory:${{ github.head_ref }} ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-armv7 - if: "!startsWith(github.ref, 'refs/tags/v')" - - - name: Push Docker manifest for preview images - run: docker manifest push ghcr.io/ecadlabs/signatory:${{ github.head_ref }} + - name: Docker Manifest GitHub Action + uses: Noelware/docker-manifest-action@0.3.1 + with: + inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} + images: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64,ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64,ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7 + push: true if: "!startsWith(github.ref, 'refs/tags/v')" #- name: Push Signatory preview images to GH Container Registry From ad4cfdfb4c9b02a06ea5d735734af1e054c5e7a1 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 17:14:48 -0700 Subject: [PATCH 16/24] feat(build.yaml): add conditional debug output for docker image ls step feat(build.yaml): use format function to generate images input for Docker Manifest GitHub Action --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1e1e0227..25773738 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -83,12 +83,13 @@ jobs: if: "!startsWith(github.ref, 'refs/tags/v')" - run: docker image ls + if: ${{ github.event.client_payload.debug == 'true' }} - name: Docker Manifest GitHub Action uses: Noelware/docker-manifest-action@0.3.1 with: inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} - images: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64,ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64,ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7 + images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', (github.head_ref || github.ref_name) ) }} push: true if: "!startsWith(github.ref, 'refs/tags/v')" From 962ff1c5a5c3d316e55fbfa82440511e095eab16 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 17:33:59 -0700 Subject: [PATCH 17/24] build: update build.yaml and goreleaser.yml build.yaml: - Add echo statements to print github.sha and github event - Update actions/checkout to v3 goreleaser.yml: - Update image_templates to use FullCommit instead of Branch for snapshots - Update snapshot name_template to use FullCommit instead of ShortCommit --- .github/workflows/build.yaml | 8 ++++++-- .goreleaser.yml | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 25773738..5a1aa664 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,10 +22,14 @@ jobs: name: Test runs-on: ubuntu-latest steps: + - run: echo "github.sha=${{ github.sha}} | ${{ github.event.pull_request.head.sha }}" + + - run: echo "${{ toJson(github)}}" + - uses: actions/setup-go@v2 with: go-version: 1.19 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Code Climate test-reporter run: | curl -L "$CC_BINARY_URL" > ./cc-test-reporter @@ -89,7 +93,7 @@ jobs: uses: Noelware/docker-manifest-action@0.3.1 with: inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} - images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', (github.head_ref || github.ref_name) ) }} + images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', github.sha ) }} push: true if: "!startsWith(github.ref, 'refs/tags/v')" diff --git a/.goreleaser.yml b/.goreleaser.yml index 0759571a..17f33175 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -186,7 +186,7 @@ dockers: - signatory - signatory-cli - image_templates: - - '{{ if .IsSnapshot }}ghcr.io/{{ else }}{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-amd64' + - '{{ if .IsSnapshot }}ghcr.io/{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .FullCommit }}{{ else }}{{ .Tag }}{{ end }}-amd64' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-amd64{{ end }}' dockerfile: Dockerfile use: buildx @@ -199,7 +199,7 @@ dockers: - "--label=org.opencontainers.image.source={{.GitURL}}" - "--platform=linux/amd64" - image_templates: - - '{{ if .IsSnapshot }}ghcr.io/{{ else }}{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-arm64' + - '{{ if .IsSnapshot }}ghcr.io/{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .FullCommit }}{{ else }}{{ .Tag }}{{ end }}-arm64' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}' dockerfile: Dockerfile use: buildx @@ -213,7 +213,7 @@ dockers: - "--platform=linux/arm64" goarch: arm64 - image_templates: - - 'ecadlabs/signatory:{{ if .IsSnapshot }}{{ .Branch }}{{ else }}{{ .Tag }}{{ end }}-armv7' + - '{{ if .IsSnapshot }}ghcr.io/{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .FullCommit }}{{ else }}{{ .Tag }}{{ end }}-armv7' - '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-armv7{{ end }}' dockerfile: Dockerfile use: buildx @@ -243,7 +243,7 @@ docker_manifests: checksum: name_template: checksums.txt snapshot: - name_template: '{{ .Version }}-SNAPSHOT-{{.ShortCommit}}' + name_template: '{{ .Version }}-SNAPSHOT-{{.FullCommit}}' changelog: sort: asc filters: From 35d34b3fffe95f5207a02c9f808feda8b9aee686 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 17:38:30 -0700 Subject: [PATCH 18/24] ci(build.yaml): update docker-manifest-action to use pull_request.head.sha instead of sha --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5a1aa664..7bfcd9ba 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,9 +22,9 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - run: echo "github.sha=${{ github.sha}} | ${{ github.event.pull_request.head.sha }}" - - - run: echo "${{ toJson(github)}}" + - run: echo "$GITHUB_CONTEXT" + env: + GITHUB_CONTEXT: ${{ toJson(github) }} - uses: actions/setup-go@v2 with: @@ -93,7 +93,7 @@ jobs: uses: Noelware/docker-manifest-action@0.3.1 with: inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} - images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', github.sha ) }} + images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', github.event.pull_request.head.sha) }} push: true if: "!startsWith(github.ref, 'refs/tags/v')" From fb72d176951556391f3e56918e0140b30dbe0fe6 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Thu, 27 Apr 2023 17:43:14 -0700 Subject: [PATCH 19/24] refactor(build.yaml): remove unnecessary echo step in Test job --- .github/workflows/build.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7bfcd9ba..c1b2c280 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,10 +22,6 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - run: echo "$GITHUB_CONTEXT" - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - - uses: actions/setup-go@v2 with: go-version: 1.19 @@ -87,8 +83,7 @@ jobs: if: "!startsWith(github.ref, 'refs/tags/v')" - run: docker image ls - if: ${{ github.event.client_payload.debug == 'true' }} - + - name: Docker Manifest GitHub Action uses: Noelware/docker-manifest-action@0.3.1 with: From a20687ea84e57795053b8e4b49575222bd8ccda2 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Fri, 28 Apr 2023 09:30:10 -0700 Subject: [PATCH 20/24] Debug manifest --- .github/workflows/build.yaml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c1b2c280..cde043f0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -83,20 +83,29 @@ jobs: if: "!startsWith(github.ref, 'refs/tags/v')" - run: docker image ls + + - run: > + docker tag ghcr.io/ecadlabs/signatory:${{ github.event.pull_request.head.sha }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64; + docker tag ghcr.io/ecadlabs/signatory:${{ github.event.pull_request.head.sha }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64; + docker tag ghcr.io/ecadlabs/signatory:${{ github.event.pull_request.head.sha }}-armv7 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7; + - run: docker image ls + + - run: docker manifest + - name: Docker Manifest GitHub Action uses: Noelware/docker-manifest-action@0.3.1 with: inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} - images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', github.event.pull_request.head.sha) }} + images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', github.event.pull_request.head.sha ) }} push: true if: "!startsWith(github.ref, 'refs/tags/v')" #- name: Push Signatory preview images to GH Container Registry # run: > - # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-amd64; - # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-arm64; - # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref }}-armv7; + # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64; + # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64; + # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7; # if: "!startsWith(github.ref, 'refs/tags/v')" - name: goreleaser release From 80ef08fc7284cdc26f375180c5c749bf8f56e215 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Fri, 28 Apr 2023 09:42:46 -0700 Subject: [PATCH 21/24] chore(.goreleaser.yml): comment out unsupported build targets for signatory and signatory-cli feat(.goreleaser.yml): add snapshot name template using short commit hash --- .github/workflows/build.yaml | 14 +-- .goreleaser.yml | 170 +++++++++++++++++------------------ 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cde043f0..8b6ae86c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -78,6 +78,8 @@ jobs: DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD=${{ secrets.DOCKER_PASSWORD }} + - run: echo github.sha=${{ github.sha }} github.event.pull_request.head.sha=${{ github.event.pull_request.head.sha }} + - name: goreleaser release preview run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" @@ -85,19 +87,17 @@ jobs: - run: docker image ls - run: > - docker tag ghcr.io/ecadlabs/signatory:${{ github.event.pull_request.head.sha }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64; - docker tag ghcr.io/ecadlabs/signatory:${{ github.event.pull_request.head.sha }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64; - docker tag ghcr.io/ecadlabs/signatory:${{ github.event.pull_request.head.sha }}-armv7 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7; + docker tag ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64; + docker tag ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64; + docker tag ghcr.io/ecadlabs/signatory:${{ github.sha }}-armv7 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7; - run: docker image ls - - run: docker manifest - - name: Docker Manifest GitHub Action - uses: Noelware/docker-manifest-action@0.3.1 + uses: Noelware/docker-manifest-action@master with: inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} - images: ${{ format('ghcr.io/ecadlabs/signatory:{0}-amd64,ghcr.io/ecadlabs/signatory:{0}-arm64,ghcr.io/ecadlabs/signatory:{0}-armv7', github.event.pull_request.head.sha ) }} + images: ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64,ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 push: true if: "!startsWith(github.ref, 'refs/tags/v')" diff --git a/.goreleaser.yml b/.goreleaser.yml index 17f33175..b0f1e0f9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -94,93 +94,93 @@ builds: - '7' # MACOS - - id: signatory-darwin-amd - binary: signatory - env: - - CGO_ENABLED=1 - - CC=o64-clang - - CXX=o64-clang++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - amd64 - - id: signatory-cli-darwing-amd - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=o64-clang - - CXX=o64-clang++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - amd64 + # - id: signatory-darwin-amd + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=o64-clang + # - CXX=o64-clang++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - amd64 + # - id: signatory-cli-darwing-amd + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=o64-clang + # - CXX=o64-clang++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - amd64 - - id: signatory-darwin-arm - binary: signatory - env: - - CGO_ENABLED=1 - - CC=oa64-clang - - CXX=oa64-clang++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - arm64 - - id: signatory-cli-darwing-arm - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=oa64-clang - - CXX=oa64-clang++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - darwin - goarch: - - arm64 + # - id: signatory-darwin-arm + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=oa64-clang + # - CXX=oa64-clang++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - arm64 + # - id: signatory-cli-darwing-arm + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=oa64-clang + # - CXX=oa64-clang++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - darwin + # goarch: + # - arm64 # WINDOWS - - id: signatory-windows-amd - binary: signatory - env: - - CGO_ENABLED=1 - - CC=x86_64-w64-mingw32-gcc - - CXX=x86_64-w64-mingw32-g++ - main: ./cmd/signatory/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - windows - goarch: - - amd64 - - id: signatory-cli-windows-amd - binary: signatory-cli - env: - - CGO_ENABLED=1 - - CC=x86_64-w64-mingw32-gcc - - CXX=x86_64-w64-mingw32-g++ - main: ./cmd/signatory-cli/main.go - ldflags: - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - goos: - - windows - goarch: - - amd64 + # - id: signatory-windows-amd + # binary: signatory + # env: + # - CGO_ENABLED=1 + # - CC=x86_64-w64-mingw32-gcc + # - CXX=x86_64-w64-mingw32-g++ + # main: ./cmd/signatory/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - windows + # goarch: + # - amd64 + # - id: signatory-cli-windows-amd + # binary: signatory-cli + # env: + # - CGO_ENABLED=1 + # - CC=x86_64-w64-mingw32-gcc + # - CXX=x86_64-w64-mingw32-g++ + # main: ./cmd/signatory-cli/main.go + # ldflags: + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + # goos: + # - windows + # goarch: + # - amd64 dockers: - ids: - signatory @@ -243,7 +243,7 @@ docker_manifests: checksum: name_template: checksums.txt snapshot: - name_template: '{{ .Version }}-SNAPSHOT-{{.FullCommit}}' + name_template: 'SNAPSHOT-{{.ShortCommit}}' changelog: sort: asc filters: From a8d9299457761e7a48305c85c755f1915d088aad Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Fri, 28 Apr 2023 10:58:07 -0700 Subject: [PATCH 22/24] Use Docker manifest --- .github/workflows/build.yaml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8b6ae86c..10b754ab 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -93,13 +93,15 @@ jobs: - run: docker image ls - - name: Docker Manifest GitHub Action - uses: Noelware/docker-manifest-action@master - with: - inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} - images: ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64,ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 - push: true - if: "!startsWith(github.ref, 'refs/tags/v')" + - run: docker manifest create ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 + + # - name: Docker Manifest GitHub Action + # uses: Noelware/docker-manifest-action@master + # with: + # inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} + # images: ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64,ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 + # push: true + # if: "!startsWith(github.ref, 'refs/tags/v')" #- name: Push Signatory preview images to GH Container Registry # run: > From 39387df353e667c63942e74411724428557a0812 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Fri, 28 Apr 2023 13:41:29 -0700 Subject: [PATCH 23/24] refactor(build.yaml): remove unused steps and comments, rename step to tag Docker images appropriately, and update push step to use a single run command --- .github/workflows/build.yaml | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 10b754ab..860efd4b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -78,37 +78,23 @@ jobs: DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD=${{ secrets.DOCKER_PASSWORD }} - - run: echo github.sha=${{ github.sha }} github.event.pull_request.head.sha=${{ github.event.pull_request.head.sha }} - - name: goreleaser release preview run: make release-preview if: "!startsWith(github.ref, 'refs/tags/v')" - - run: docker image ls - - - run: > + - name: Tag Docker images appropriately + run: > docker tag ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64; docker tag ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64; docker tag ghcr.io/ecadlabs/signatory:${{ github.sha }}-armv7 ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7; - - - run: docker image ls - - - run: docker manifest create ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64 ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 - - # - name: Docker Manifest GitHub Action - # uses: Noelware/docker-manifest-action@master - # with: - # inputs: ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }} - # images: ghcr.io/ecadlabs/signatory:${{ github.sha }}-amd64,ghcr.io/ecadlabs/signatory:${{ github.sha }}-arm64 - # push: true - # if: "!startsWith(github.ref, 'refs/tags/v')" + if: "!startsWith(github.ref, 'refs/tags/v')" - #- name: Push Signatory preview images to GH Container Registry - # run: > - # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64; - # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64; - # docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7; - # if: "!startsWith(github.ref, 'refs/tags/v')" + - name: Push Signatory preview images to GH Container Registry + run: > + docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-amd64; + docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-arm64; + docker push ghcr.io/ecadlabs/signatory:${{ github.head_ref || github.ref_name }}-armv7; + if: "!startsWith(github.ref, 'refs/tags/v')" - name: goreleaser release run: make release From 716e65d4a9364f116d33a481b68c32a72356a289 Mon Sep 17 00:00:00 2001 From: Daniele Lisi <22307776+danielelisi@users.noreply.github.com> Date: Fri, 28 Apr 2023 13:47:35 -0700 Subject: [PATCH 24/24] chore(.goreleaser.yml): uncomment build configurations for MacOS and Windows, and add support for ARM architecture on MacOS. --- .github/workflows/build.yaml | 2 +- .goreleaser.yml | 168 +++++++++++++++++------------------ 2 files changed, 85 insertions(+), 85 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 860efd4b..c9ac7014 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,7 +22,7 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: 1.19 - uses: actions/checkout@v3 diff --git a/.goreleaser.yml b/.goreleaser.yml index b0f1e0f9..b65c4da8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -94,93 +94,93 @@ builds: - '7' # MACOS - # - id: signatory-darwin-amd - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=o64-clang - # - CXX=o64-clang++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - amd64 - # - id: signatory-cli-darwing-amd - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=o64-clang - # - CXX=o64-clang++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - amd64 + - id: signatory-darwin-amd + binary: signatory + env: + - CGO_ENABLED=1 + - CC=o64-clang + - CXX=o64-clang++ + main: ./cmd/signatory/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - amd64 + - id: signatory-cli-darwing-amd + binary: signatory-cli + env: + - CGO_ENABLED=1 + - CC=o64-clang + - CXX=o64-clang++ + main: ./cmd/signatory-cli/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - amd64 - # - id: signatory-darwin-arm - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=oa64-clang - # - CXX=oa64-clang++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - arm64 - # - id: signatory-cli-darwing-arm - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=oa64-clang - # - CXX=oa64-clang++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - darwin - # goarch: - # - arm64 + - id: signatory-darwin-arm + binary: signatory + env: + - CGO_ENABLED=1 + - CC=oa64-clang + - CXX=oa64-clang++ + main: ./cmd/signatory/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - arm64 + - id: signatory-cli-darwing-arm + binary: signatory-cli + env: + - CGO_ENABLED=1 + - CC=oa64-clang + - CXX=oa64-clang++ + main: ./cmd/signatory-cli/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - darwin + goarch: + - arm64 # WINDOWS - # - id: signatory-windows-amd - # binary: signatory - # env: - # - CGO_ENABLED=1 - # - CC=x86_64-w64-mingw32-gcc - # - CXX=x86_64-w64-mingw32-g++ - # main: ./cmd/signatory/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - windows - # goarch: - # - amd64 - # - id: signatory-cli-windows-amd - # binary: signatory-cli - # env: - # - CGO_ENABLED=1 - # - CC=x86_64-w64-mingw32-gcc - # - CXX=x86_64-w64-mingw32-g++ - # main: ./cmd/signatory-cli/main.go - # ldflags: - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' - # - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' - # goos: - # - windows - # goarch: - # - amd64 + - id: signatory-windows-amd + binary: signatory + env: + - CGO_ENABLED=1 + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + main: ./cmd/signatory/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - windows + goarch: + - amd64 + - id: signatory-cli-windows-amd + binary: signatory-cli + env: + - CGO_ENABLED=1 + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + main: ./cmd/signatory-cli/main.go + ldflags: + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitRevision={{.Version}}' + - '-X github.com/ecadlabs/signatory/pkg/metrics.GitBranch={{.Version}}' + goos: + - windows + goarch: + - amd64 dockers: - ids: - signatory