From d649f1ac4e86e0855950867bc6aefcf26b756171 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Sun, 1 Sep 2024 16:52:43 +0700 Subject: [PATCH 01/15] chore: update pipeline version --- .github/workflows/ci.yml | 3 ++- .github/workflows/publish.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a07c4a7a..e42b4e3ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,10 @@ jobs: run-unit-tests: true run-integration-tests: false run-lint: true + run-build: true docker_pipeline: - uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.5.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-platform secrets: inherit with: publish: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8f5d901cb..aa44244fc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,7 @@ on: branches: - 'main' - 'dev' + - 'hiep/update-pipeline-version' tags: - '*' @@ -16,6 +17,7 @@ jobs: run-unit-tests: true run-integration-tests: false run-lint: true + run-build: true docker_pipeline: uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.5.0 From aa1c6674c188f95cdbbfe4da0c89db138a920c63 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Tue, 3 Sep 2024 18:08:11 +0700 Subject: [PATCH 02/15] without lint_test --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aa44244fc..8035a91dc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: docker_pipeline: uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.5.0 - needs: ["lint_test"] + # needs: ["lint_test"] secrets: inherit with: publish: true From ac2554b6f601d3e8f51478ebae533cc6ee88d49e Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Tue, 3 Sep 2024 19:18:07 +0700 Subject: [PATCH 03/15] BUILDPLATFORM --- contrib/images/babylond/Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index ce6a6564a..37dc52c48 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 AS build-env +FROM --platform=$BUILDPLATFORM golang:1.21 AS build-env # Version to build. Default is empty ARG VERSION @@ -6,6 +6,11 @@ ARG BUILD_TAGS="" ARG LEDGER_ENABLED="false" ARG COSMOS_BUILD_OPTIONS="" +ARG TARGETPLATFORM +ARG BUILDPLATFORM +ARG TARGETOS +ARG TARGETARCH + WORKDIR /go/src/github.com/babylonlabs-io/babylon COPY ./ /go/src/github.com/babylonlabs-io/babylon/ @@ -22,6 +27,8 @@ RUN LEDGER_ENABLED=$LEDGER_ENABLED \ BUILD_TAGS=$BUILD_TAGS \ COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ LINK_STATICALLY=false \ + GOOS=${TARGETOS} \ + GOARCH=${TARGETARCH} \ make build FROM debian:bookworm-slim AS wasm-link From 8385e9994180d28f1ca7789c8568406c0b7dbdf5 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Tue, 3 Sep 2024 20:03:31 +0700 Subject: [PATCH 04/15] only BUILDPLATFORM --- contrib/images/babylond/Dockerfile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index 37dc52c48..216697889 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -6,11 +6,6 @@ ARG BUILD_TAGS="" ARG LEDGER_ENABLED="false" ARG COSMOS_BUILD_OPTIONS="" -ARG TARGETPLATFORM -ARG BUILDPLATFORM -ARG TARGETOS -ARG TARGETARCH - WORKDIR /go/src/github.com/babylonlabs-io/babylon COPY ./ /go/src/github.com/babylonlabs-io/babylon/ @@ -27,8 +22,6 @@ RUN LEDGER_ENABLED=$LEDGER_ENABLED \ BUILD_TAGS=$BUILD_TAGS \ COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ LINK_STATICALLY=false \ - GOOS=${TARGETOS} \ - GOARCH=${TARGETARCH} \ make build FROM debian:bookworm-slim AS wasm-link From 89108ebf50d718a1267562c8e6823536689059e0 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Tue, 3 Sep 2024 20:13:38 +0700 Subject: [PATCH 05/15] test --- contrib/images/babylond/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index 216697889..f8d2761d2 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -6,6 +6,8 @@ ARG BUILD_TAGS="" ARG LEDGER_ENABLED="false" ARG COSMOS_BUILD_OPTIONS="" +ARG TARGETOS TARGETARCH + WORKDIR /go/src/github.com/babylonlabs-io/babylon COPY ./ /go/src/github.com/babylonlabs-io/babylon/ @@ -22,6 +24,9 @@ RUN LEDGER_ENABLED=$LEDGER_ENABLED \ BUILD_TAGS=$BUILD_TAGS \ COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ LINK_STATICALLY=false \ + GOOS=${TARGETOS} \ + GOARCH=${TARGETARCH} \ + CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 \ make build FROM debian:bookworm-slim AS wasm-link From 084b99458ad8c1971953facc5607552308ff0458 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Tue, 3 Sep 2024 20:17:03 +0700 Subject: [PATCH 06/15] gcc-arm-linux-gnueabi --- contrib/images/babylond/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index f8d2761d2..05dcf6b80 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -1,5 +1,10 @@ FROM --platform=$BUILDPLATFORM golang:1.21 AS build-env +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc-arm-linux-gnueabi \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + # Version to build. Default is empty ARG VERSION ARG BUILD_TAGS="" @@ -24,9 +29,6 @@ RUN LEDGER_ENABLED=$LEDGER_ENABLED \ BUILD_TAGS=$BUILD_TAGS \ COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ LINK_STATICALLY=false \ - GOOS=${TARGETOS} \ - GOARCH=${TARGETARCH} \ - CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 \ make build FROM debian:bookworm-slim AS wasm-link From 8e6472e9c7a67e6d51debf94642e2bd8e7345bed Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Wed, 4 Sep 2024 07:32:45 +0700 Subject: [PATCH 07/15] revert --- contrib/images/babylond/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index 05dcf6b80..9fd46bfbc 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -29,6 +29,9 @@ RUN LEDGER_ENABLED=$LEDGER_ENABLED \ BUILD_TAGS=$BUILD_TAGS \ COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ LINK_STATICALLY=false \ + GOOS=${TARGETOS} \ + GOARCH=${TARGETARCH} \ + CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 \ make build FROM debian:bookworm-slim AS wasm-link From 7ba94edb716ac5f011d258ab2d825c164f153b1c Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Thu, 5 Sep 2024 08:41:54 +0700 Subject: [PATCH 08/15] gcc-i686-linux-gnu --- contrib/images/babylond/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index 9fd46bfbc..470747bcc 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -1,7 +1,7 @@ FROM --platform=$BUILDPLATFORM golang:1.21 AS build-env RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc-arm-linux-gnueabi \ + gcc-i686-linux-gnu \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* From dc935977f7abb4d1d64d1909fece83793fa6026f Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Fri, 6 Sep 2024 19:09:15 +0700 Subject: [PATCH 09/15] Remove dockerfile change --- contrib/images/babylond/Dockerfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index 470747bcc..aa0f59e3f 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -1,10 +1,5 @@ FROM --platform=$BUILDPLATFORM golang:1.21 AS build-env -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc-i686-linux-gnu \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - # Version to build. Default is empty ARG VERSION ARG BUILD_TAGS="" @@ -29,9 +24,6 @@ RUN LEDGER_ENABLED=$LEDGER_ENABLED \ BUILD_TAGS=$BUILD_TAGS \ COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ LINK_STATICALLY=false \ - GOOS=${TARGETOS} \ - GOARCH=${TARGETARCH} \ - CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 \ make build FROM debian:bookworm-slim AS wasm-link From c0bc5c3a248bda9f5d179ead31ded972a7ed7fa4 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Sat, 7 Sep 2024 07:18:05 +0700 Subject: [PATCH 10/15] remove version --- contrib/images/babylond/Dockerfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index aa0f59e3f..c243ae5e4 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -1,7 +1,5 @@ FROM --platform=$BUILDPLATFORM golang:1.21 AS build-env -# Version to build. Default is empty -ARG VERSION ARG BUILD_TAGS="" ARG LEDGER_ENABLED="false" ARG COSMOS_BUILD_OPTIONS="" @@ -11,12 +9,6 @@ ARG TARGETOS TARGETARCH WORKDIR /go/src/github.com/babylonlabs-io/babylon COPY ./ /go/src/github.com/babylonlabs-io/babylon/ -# Handle if version is set -RUN if [ -n "${VERSION}" ]; then \ - git fetch origin tag ${VERSION} --no-tags; \ - git checkout -f ${VERSION}; \ - fi - # Cache mod dependencies RUN go mod download From 8c58c81bb1b49739b2090c7b7fd6e623765165ae Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Sat, 7 Sep 2024 15:50:42 +0700 Subject: [PATCH 11/15] revert --- contrib/images/babylond/Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index c243ae5e4..ce6a6564a 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -1,14 +1,20 @@ -FROM --platform=$BUILDPLATFORM golang:1.21 AS build-env +FROM golang:1.21 AS build-env +# Version to build. Default is empty +ARG VERSION ARG BUILD_TAGS="" ARG LEDGER_ENABLED="false" ARG COSMOS_BUILD_OPTIONS="" -ARG TARGETOS TARGETARCH - WORKDIR /go/src/github.com/babylonlabs-io/babylon COPY ./ /go/src/github.com/babylonlabs-io/babylon/ +# Handle if version is set +RUN if [ -n "${VERSION}" ]; then \ + git fetch origin tag ${VERSION} --no-tags; \ + git checkout -f ${VERSION}; \ + fi + # Cache mod dependencies RUN go mod download From ae8a34bc1f91ced1c2d8f2422c1c3bef3622fd83 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Fri, 13 Sep 2024 19:41:04 +0700 Subject: [PATCH 12/15] Add gosec --- .github/workflows/ci.yml | 5 +++-- .github/workflows/publish.yml | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e42b4e3ab..d8ff65872 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,16 +11,17 @@ concurrency: jobs: lint_test: - uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.5.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@hiep/add-gosec secrets: inherit with: run-unit-tests: true run-integration-tests: false run-lint: true run-build: true + run-gosec: true docker_pipeline: - uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-platform + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-gosec secrets: inherit with: publish: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8035a91dc..927280c62 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,13 +5,12 @@ on: branches: - 'main' - 'dev' - - 'hiep/update-pipeline-version' tags: - '*' jobs: lint_test: - uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.5.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@hiep/add-gosec secrets: inherit with: run-unit-tests: true @@ -20,8 +19,8 @@ jobs: run-build: true docker_pipeline: - uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.5.0 - # needs: ["lint_test"] + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-gosec + needs: ["lint_test"] secrets: inherit with: publish: true From a10c7b5a42f117ddc1d969e23b7ad7768e8da446 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Thu, 19 Sep 2024 08:18:15 +0700 Subject: [PATCH 13/15] no fail --- .github/workflows/ci.yml | 1 + .github/workflows/publish.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8ff65872..5035d20f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: run-lint: true run-build: true run-gosec: true + gosec-args: "-no-fail ./..." docker_pipeline: uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-gosec diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 927280c62..3b30d470f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,6 @@ jobs: run-unit-tests: true run-integration-tests: false run-lint: true - run-build: true docker_pipeline: uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-gosec From 23fd47efbe5f545c9a8197f205391fb23f5824f0 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Mon, 23 Sep 2024 07:39:09 +0700 Subject: [PATCH 14/15] tag --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5035d20f8..f2c5f01ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ concurrency: jobs: lint_test: - uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@hiep/add-gosec + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.6.0 secrets: inherit with: run-unit-tests: true @@ -22,7 +22,7 @@ jobs: gosec-args: "-no-fail ./..." docker_pipeline: - uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-gosec + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.6.0 secrets: inherit with: publish: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3b30d470f..49ff8fa3f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ on: jobs: lint_test: - uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@hiep/add-gosec + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.6.0 secrets: inherit with: run-unit-tests: true @@ -18,7 +18,7 @@ jobs: run-lint: true docker_pipeline: - uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-gosec + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.6.0 needs: ["lint_test"] secrets: inherit with: From 47a35e415f52408c87f97468ef0896828827dc31 Mon Sep 17 00:00:00 2001 From: Hiep Mai Date: Thu, 26 Sep 2024 08:35:12 +0700 Subject: [PATCH 15/15] Try out -exclude-generated option --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2c5f01ab..58106fc84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: run-lint: true run-build: true run-gosec: true - gosec-args: "-no-fail ./..." + gosec-args: "-no-fail -exclude-generated ./..." docker_pipeline: uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.6.0