From 5032a1a45f50ec53a4bea0eeee51e346899b187d Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Mon, 22 Jan 2024 13:42:01 -0600 Subject: [PATCH 01/40] add updated goreleaser templates --- .goreleaser-template.yaml | 102 ++++++++++++++++++++++++++++++++++++++ core/.goreleaser.yaml | 6 +++ 2 files changed, 108 insertions(+) create mode 100644 .goreleaser-template.yaml create mode 100644 core/.goreleaser.yaml diff --git a/.goreleaser-template.yaml b/.goreleaser-template.yaml new file mode 100644 index 00000000000..ee353099726 --- /dev/null +++ b/.goreleaser-template.yaml @@ -0,0 +1,102 @@ +env: + - GOPRIVATE=github.com/smartcontractkit/* + - ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }} + - IMAGE_REPO={{ if index .Env "IMAGE_REPO" }}{{ .Env.IMAGE_REPO }}{{ else }}localhost:5001/{{ .ProjectName }}{{ end }} + +# See https://goreleaser.com/customization/build/ +builds: + - binary: "{{ .ProjectName }}" + id: linux-amd64 + env: + - CGO_ENABLED=1 + - CC=$ZIG_EXEC cc -target x86_64-linux-gnu + - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu + flags: + - -trimpath + - -buildmode=pie + goos: + - linux + goarch: + - amd64 + - binary: "{{ .ProjectName }}" + id: linux-arm64 + env: + - CGO_ENABLED=1 + - CC=$ZIG_EXEC cc -target aarch64-linux-gnu + - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu + flags: + - -trimpath + - -buildmode=pie + goos: + - linux + goarch: + - arm64 + +# See https://goreleaser.com/customization/docker/ +dockers: + - id: linux-amd64 + dockerfile: ./chainlink.goreleaser.Dockerfile + use: buildx + goos: linux + goarch: amd64 + build_flag_templates: + - "--build-arg=app={{ .ProjectName }}" + - "--platform=linux/amd64" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.name={{ .ProjectName }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.version={{ .Version }}" + - "--label=org.opencontainers.image.source={{ .GitURL }}" + image_templates: + - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-amd64{{ end }}" + - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-amd64{{ end }}" + + - id: linux-arm64 + dockerfile: ./chainlink.goreleaser.Dockerfile + use: buildx + goos: linux + goarch: arm64 + build_flag_templates: + - "--build-arg=app={{ .ProjectName }}" + - "--platform=linux/arm64" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.name={{ .ProjectName }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.version={{ .Version }}" + - "--label=org.opencontainers.image.source={{ .GitURL }}" + image_templates: + - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-arm64{{ end }}" + - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-arm64{{ end }}" + +# See https://goreleaser.com/customization/docker_manifest/ +docker_manifests: + - name_template: "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}{{ end }}" + image_templates: + - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-amd64{{ end }}" + - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-arm64{{ end }}" + - name_template: "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}{{ end }}" + image_templates: + - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-amd64{{ end }}" + - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-arm64{{ end }}" + +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +# GitHub Release +release: + github: + owner: smartcontractkit + name: chainlink + # If there is a prerelease suffix on the version tag (e.g. v1.0.0-rc1), then + # the GitHub Release will be created as a "prerelease". + # Default is false. + prerelease: auto + disable: true diff --git a/core/.goreleaser.yaml b/core/.goreleaser.yaml new file mode 100644 index 00000000000..3e5b9561bc1 --- /dev/null +++ b/core/.goreleaser.yaml @@ -0,0 +1,6 @@ +# Requires GoReleaser Pro +includes: + - from_file: + path: ./.goreleaser-template.yaml + +project_name: chainlink From 011d04297a44d65cc2975d3a6938d1d45b9f189f Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Mon, 22 Jan 2024 13:47:43 -0600 Subject: [PATCH 02/40] update zig 0.11.0 --- .tool-versions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tool-versions b/.tool-versions index d8f0afd901d..2ec4cde8ad1 100644 --- a/.tool-versions +++ b/.tool-versions @@ -3,5 +3,5 @@ mockery 2.38.0 nodejs 16.16.0 postgres 13.3 helm 3.10.3 -zig 0.10.1 +zig 0.11.0 golangci-lint 1.55.2 From 26b0489b259e672034530378cc7a7a7af5688ee2 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Mon, 22 Jan 2024 16:34:44 -0600 Subject: [PATCH 03/40] update goreleaser develop --- .goreleaser-template.yaml | 102 -------------------------------------- .goreleaser.develop.yaml | 44 ++++------------ core/.goreleaser.yaml | 6 --- 3 files changed, 11 insertions(+), 141 deletions(-) delete mode 100644 .goreleaser-template.yaml delete mode 100644 core/.goreleaser.yaml diff --git a/.goreleaser-template.yaml b/.goreleaser-template.yaml deleted file mode 100644 index ee353099726..00000000000 --- a/.goreleaser-template.yaml +++ /dev/null @@ -1,102 +0,0 @@ -env: - - GOPRIVATE=github.com/smartcontractkit/* - - ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }} - - IMAGE_REPO={{ if index .Env "IMAGE_REPO" }}{{ .Env.IMAGE_REPO }}{{ else }}localhost:5001/{{ .ProjectName }}{{ end }} - -# See https://goreleaser.com/customization/build/ -builds: - - binary: "{{ .ProjectName }}" - id: linux-amd64 - env: - - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target x86_64-linux-gnu - - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu - flags: - - -trimpath - - -buildmode=pie - goos: - - linux - goarch: - - amd64 - - binary: "{{ .ProjectName }}" - id: linux-arm64 - env: - - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target aarch64-linux-gnu - - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu - flags: - - -trimpath - - -buildmode=pie - goos: - - linux - goarch: - - arm64 - -# See https://goreleaser.com/customization/docker/ -dockers: - - id: linux-amd64 - dockerfile: ./chainlink.goreleaser.Dockerfile - use: buildx - goos: linux - goarch: amd64 - build_flag_templates: - - "--build-arg=app={{ .ProjectName }}" - - "--platform=linux/amd64" - - "--label=org.opencontainers.image.created={{ .Date }}" - - "--label=org.opencontainers.image.name={{ .ProjectName }}" - - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - - "--label=org.opencontainers.image.version={{ .Version }}" - - "--label=org.opencontainers.image.source={{ .GitURL }}" - image_templates: - - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-amd64{{ end }}" - - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-amd64{{ end }}" - - - id: linux-arm64 - dockerfile: ./chainlink.goreleaser.Dockerfile - use: buildx - goos: linux - goarch: arm64 - build_flag_templates: - - "--build-arg=app={{ .ProjectName }}" - - "--platform=linux/arm64" - - "--label=org.opencontainers.image.created={{ .Date }}" - - "--label=org.opencontainers.image.name={{ .ProjectName }}" - - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - - "--label=org.opencontainers.image.version={{ .Version }}" - - "--label=org.opencontainers.image.source={{ .GitURL }}" - image_templates: - - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-arm64{{ end }}" - - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-arm64{{ end }}" - -# See https://goreleaser.com/customization/docker_manifest/ -docker_manifests: - - name_template: "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}{{ end }}" - image_templates: - - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-amd64{{ end }}" - - "{{ if and (not .IsSnapshot) (not .IsNightly) }}{{ .Env.IMAGE_REPO }}:{{ .Version }}-arm64{{ end }}" - - name_template: "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}{{ end }}" - image_templates: - - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-amd64{{ end }}" - - "{{ if or (.IsSnapshot) (.IsNightly) }}{{ .Env.IMAGE_REPO }}:sha-{{ .ShortCommit }}-arm64{{ end }}" - -checksum: - name_template: "checksums.txt" -snapshot: - name_template: "{{ incpatch .Version }}-next" -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" - -# GitHub Release -release: - github: - owner: smartcontractkit - name: chainlink - # If there is a prerelease suffix on the version tag (e.g. v1.0.0-rc1), then - # the GitHub Release will be created as a "prerelease". - # Default is false. - prerelease: auto - disable: true diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 20312491651..f8cfc472ec2 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -1,57 +1,41 @@ -## goreleaser <1.14.0 +# For building binaries locally project_name: chainlink env: - - ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }} - IMAGE_PREFIX={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }} - IMAGE_LABEL_DESCRIPTION="node of the decentralized oracle network, bridging on and off-chain computation" - IMAGE_LABEL_LICENSES="MIT" - IMAGE_LABEL_SOURCE="https://github.com/smartcontractkit/{{ .ProjectName }}" -before: - hooks: - - ./tools/bin/goreleaser_utils before_hook - # See https://goreleaser.com/customization/build/ builds: - - binary: chainlink - id: linux-arm64 + - id: linux-arm64 + binary: "{{ .ProjectName }}" goos: - linux goarch: - arm64 - hooks: - post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target aarch64-linux-gnu - - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu + - CC=zig cc -target aarch64-linux-gnu + - CCX=zig c++ -target aarch64-linux-gnu flags: - -trimpath - -buildmode=pie - ldflags: - - -s -w -r=$ORIGIN/libs - - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} - - binary: chainlink - id: linux-amd64 + + - id: linux-amd64 + binary: "{{ .ProjectName }}" goos: - linux goarch: - amd64 - hooks: - post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target x86_64-linux-gnu - - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu + - CC=zig cc -target x86_64-linux-gnu + - CCX=zig c++ -target x86_64-linux-gnu flags: - -trimpath - -buildmode=pie - ldflags: - - -s -w -r=$ORIGIN/libs - - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} # See https://goreleaser.com/customization/docker/ dockers: @@ -122,6 +106,7 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-amd64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-amd64" + - id: linux-arm64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -170,13 +155,6 @@ docker_signs: - artifacts: all stdin: "{{ .Env.COSIGN_PASSWORD }}" -archives: - - rlcp: true - files: - - src: tmp/{{ .Os }}_{{ .Arch }}/libs/* - dst: libs - strip_parent: true - checksum: name_template: "checksums.txt" diff --git a/core/.goreleaser.yaml b/core/.goreleaser.yaml deleted file mode 100644 index 3e5b9561bc1..00000000000 --- a/core/.goreleaser.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# Requires GoReleaser Pro -includes: - - from_file: - path: ./.goreleaser-template.yaml - -project_name: chainlink From fa9f57a58b5d3ed7c27d2234d3c1b5632542c3ef Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Tue, 23 Jan 2024 11:34:40 -0600 Subject: [PATCH 04/40] add back ldflags and rename goreleaser config file --- .goreleaser.develop.yaml => .goreleaser.develop.local.yaml | 6 ++++++ 1 file changed, 6 insertions(+) rename .goreleaser.develop.yaml => .goreleaser.develop.local.yaml (94%) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.local.yaml similarity index 94% rename from .goreleaser.develop.yaml rename to .goreleaser.develop.local.yaml index f8cfc472ec2..85d81002c12 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.local.yaml @@ -22,6 +22,9 @@ builds: flags: - -trimpath - -buildmode=pie + ldflags: + - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} + - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} - id: linux-amd64 binary: "{{ .ProjectName }}" @@ -36,6 +39,9 @@ builds: flags: - -trimpath - -buildmode=pie + ldflags: + - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} + - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} # See https://goreleaser.com/customization/docker/ dockers: From 09893a6b2148d49132bd2fafde8cd3fefc1feb3b Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Tue, 23 Jan 2024 13:54:30 -0600 Subject: [PATCH 05/40] update goreleaser build gha workflow and pin new versions --- .../goreleaser-build-sign-publish/action.yml | 19 +- .../goreleaser-build-publish-develop.yml | 10 +- .goreleaser.develop.ci.yaml | 179 ++++++++++++++++++ 3 files changed, 193 insertions(+), 15 deletions(-) create mode 100644 .goreleaser.develop.ci.yaml diff --git a/.github/actions/goreleaser-build-sign-publish/action.yml b/.github/actions/goreleaser-build-sign-publish/action.yml index b2d42c1234e..faf7aa01ceb 100644 --- a/.github/actions/goreleaser-build-sign-publish/action.yml +++ b/.github/actions/goreleaser-build-sign-publish/action.yml @@ -3,15 +3,16 @@ description: A composite action that allows building and publishing signed chain inputs: goreleaser-version: description: The goreleaser version - default: 1.15.2 + default: 1.23.0 required: false zig-version: description: The zig version - default: 0.10.1 + default: 0.11.0 required: false cosign-version: description: The cosign version default: v1.13.1 + # TODO update to v2.2.2 required: false macos-sdk-dir: description: The macos sdk directory @@ -67,29 +68,29 @@ runs: - name: Setup docker buildx uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 - name: Set up qemu - uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 + uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 - name: Setup go - uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1 + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: "go.mod" - name: Setup goreleaser - uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # v3.2.0 + uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 with: - distribution: goreleaser + distribution: goreleaser-pro install-only: true version: ${{ inputs.goreleaser-version }} - name: Setup zig - uses: goto-bus-stop/setup-zig@869a4299cf8ac7db4ebffaec36ad82a682f88acb # v2.0.1 + uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 with: version: ${{ inputs.zig-version }} - name: Setup cosign if: inputs.enable-cosign == 'true' - uses: sigstore/cosign-installer@11086d25041f77fe8fe7b9ea4e48e3b9192b8f19 # v3.1.2 + uses: sigstore/cosign-installer@9614fae9e5c5eddabb09f90a270fcb487c9f7149 # v3.3.0 with: cosign-release: ${{ inputs.cosign-version }} - name: Login to docker registry if: inputs.enable-docker-publish == 'true' - uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 with: registry: ${{ inputs.docker-registry }} - name: Goreleaser release diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 514067fd85d..b5d158ab43e 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -2,8 +2,8 @@ name: "Build publish Chainlink develop on private ECR" on: push: - branches: - - develop + # branches: + # - develop jobs: push-chainlink-develop-goreleaser: @@ -32,10 +32,8 @@ jobs: enable-docker-publish: "true" docker-registry: ${{ secrets.AWS_DEVELOP_ECR_HOSTNAME }} enable-goreleaser-snapshot: "true" - goreleaser-exec: ./tools/bin/goreleaser_wrapper - goreleaser-config: .goreleaser.develop.yaml - # ISSUE: https://github.com/golang/go/issues/52690 - zig-version: 0.11.0-dev.3380+7e0a02ee2 # TODO: update action to v0.11.x once released + goreleaser-config: .goreleaser.develop.ci.yaml + zig-version: 0.11.0 - name: Collect Metrics if: always() id: collect-gha-metrics diff --git a/.goreleaser.develop.ci.yaml b/.goreleaser.develop.ci.yaml new file mode 100644 index 00000000000..162b0339c41 --- /dev/null +++ b/.goreleaser.develop.ci.yaml @@ -0,0 +1,179 @@ +# For building binaries in github actions CI +project_name: chainlink + +env: + - ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }} + - IMAGE_PREFIX={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }} + - IMAGE_LABEL_DESCRIPTION="node of the decentralized oracle network, bridging on and off-chain computation" + - IMAGE_LABEL_LICENSES="MIT" + - IMAGE_LABEL_SOURCE="https://github.com/smartcontractkit/{{ .ProjectName }}" + +# See https://goreleaser.com/customization/build/ +builds: + - id: linux-arm64 + binary: "{{ .ProjectName }}" + goos: + - linux + goarch: + - arm64 + env: + - CGO_ENABLED=1 + - CC=$ZIG_EXEC cc -target aarch64-linux-gnu + - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu + flags: + - -trimpath + - -buildmode=pie + ldflags: + - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} + - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} + + - id: linux-amd64 + binary: "{{ .ProjectName }}" + goos: + - linux + goarch: + - amd64 + env: + - CGO_ENABLED=1 + - CC=$ZIG_EXEC cc -target x86_64-linux-gnu + - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu + flags: + - -trimpath + - -buildmode=pie + ldflags: + - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} + - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} + +# See https://goreleaser.com/customization/docker/ +dockers: + - id: root-linux-amd64 + dockerfile: core/chainlink.goreleaser.Dockerfile + use: buildx + goos: linux + goarch: amd64 + extra_files: + - tmp/linux_amd64/libs + build_flag_templates: + - "--platform=linux/amd64" + - "--pull" + - "--build-arg=COMMIT_SHA={{ .FullCommit }}" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" + - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" + - "--label=org.opencontainers.image.title={{ .ProjectName }}" + - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" + - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-amd64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-amd64" + - id: root-linux-arm64 + dockerfile: core/chainlink.goreleaser.Dockerfile + use: buildx + goos: linux + goarch: arm64 + extra_files: + - tmp/linux_arm64/libs + build_flag_templates: + - "--platform=linux/arm64" + - "--pull" + - "--build-arg=COMMIT_SHA={{ .FullCommit }}" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" + - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" + - "--label=org.opencontainers.image.title={{ .ProjectName }}" + - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" + - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-arm64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-arm64" + - id: linux-amd64 + dockerfile: core/chainlink.goreleaser.Dockerfile + use: buildx + goos: linux + goarch: amd64 + extra_files: + - tmp/linux_amd64/libs + build_flag_templates: + - "--platform=linux/amd64" + - "--pull" + - "--build-arg=CHAINLINK_USER=chainlink" + - "--build-arg=COMMIT_SHA={{ .FullCommit }}" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" + - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" + - "--label=org.opencontainers.image.title={{ .ProjectName }}" + - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" + - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-amd64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-amd64" + + - id: linux-arm64 + dockerfile: core/chainlink.goreleaser.Dockerfile + use: buildx + goos: linux + goarch: arm64 + extra_files: + - tmp/linux_arm64/libs + build_flag_templates: + - "--platform=linux/arm64" + - "--pull" + - "--build-arg=CHAINLINK_USER=chainlink" + - "--build-arg=COMMIT_SHA={{ .FullCommit }}" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" + - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" + - "--label=org.opencontainers.image.title={{ .ProjectName }}" + - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" + - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-arm64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-arm64" + +# See https://goreleaser.com/customization/docker_manifest/ +docker_manifests: + - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-amd64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-arm64" + - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-amd64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-arm64" + - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-amd64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-arm64" + - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}" + image_templates: + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-amd64" + - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-arm64" + +# See https://goreleaser.com/customization/docker_sign/ +docker_signs: + - artifacts: all + stdin: "{{ .Env.COSIGN_PASSWORD }}" + +checksum: + name_template: "checksums.txt" + +snapshot: + name_template: "{{ .Env.CHAINLINK_VERSION }}-{{ .ShortCommit }}" + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" +# modelines, feel free to remove those if you don't want/use them: +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj From 8f66085015187895119a03ff636d0d020315c8fb Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Wed, 24 Jan 2024 17:02:20 -0600 Subject: [PATCH 06/40] add back pre/post hooks and updated goreleaser Dockerfile to include LOOP plugins --- .goreleaser.develop.ci.yaml | 18 ++++++++++++++++++ .goreleaser.develop.local.yaml | 18 ++++++++++++++++++ core/chainlink.goreleaser.Dockerfile | 3 +++ tools/bin/goreleaser_utils | 24 ++++++++++++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/.goreleaser.develop.ci.yaml b/.goreleaser.develop.ci.yaml index 162b0339c41..6b19483db5d 100644 --- a/.goreleaser.develop.ci.yaml +++ b/.goreleaser.develop.ci.yaml @@ -8,6 +8,10 @@ env: - IMAGE_LABEL_LICENSES="MIT" - IMAGE_LABEL_SOURCE="https://github.com/smartcontractkit/{{ .ProjectName }}" +before: + hooks: + - ./tools/bin/goreleaser_utils before_hook + # See https://goreleaser.com/customization/build/ builds: - id: linux-arm64 @@ -16,6 +20,8 @@ builds: - linux goarch: - arm64 + hooks: + post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target aarch64-linux-gnu @@ -33,6 +39,8 @@ builds: - linux goarch: - amd64 + hooks: + post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target x86_64-linux-gnu @@ -53,6 +61,8 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs + - tmp/linux_amd64/chainlink-feeds + - tmp/linux_amd64/chainlink-solana build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -68,6 +78,7 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-amd64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-amd64" + - id: root-linux-arm64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -75,6 +86,8 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs + - tmp/linux_arm64/chainlink-feeds + - tmp/linux_arm64/chainlink-solana build_flag_templates: - "--platform=linux/arm64" - "--pull" @@ -90,6 +103,7 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-arm64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-arm64" + - id: linux-amd64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -97,6 +111,8 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs + - tmp/linux_amd64/chainlink-feeds + - tmp/linux_amd64/chainlink-solana build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -121,6 +137,8 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs + - tmp/linux_arm64/chainlink-feeds + - tmp/linux_arm64/chainlink-solana build_flag_templates: - "--platform=linux/arm64" - "--pull" diff --git a/.goreleaser.develop.local.yaml b/.goreleaser.develop.local.yaml index 85d81002c12..f0bc3e3994f 100644 --- a/.goreleaser.develop.local.yaml +++ b/.goreleaser.develop.local.yaml @@ -7,6 +7,10 @@ env: - IMAGE_LABEL_LICENSES="MIT" - IMAGE_LABEL_SOURCE="https://github.com/smartcontractkit/{{ .ProjectName }}" +before: + hooks: + - ./tools/bin/goreleaser_utils before_hook + # See https://goreleaser.com/customization/build/ builds: - id: linux-arm64 @@ -15,6 +19,8 @@ builds: - linux goarch: - arm64 + hooks: + post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=zig cc -target aarch64-linux-gnu @@ -32,6 +38,8 @@ builds: - linux goarch: - amd64 + hooks: + post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=zig cc -target x86_64-linux-gnu @@ -52,6 +60,8 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs + - tmp/linux_amd64/chainlink-feeds + - tmp/linux_amd64/chainlink-solana build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -67,6 +77,7 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-amd64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-amd64" + - id: root-linux-arm64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -74,6 +85,8 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs + - tmp/linux_arm64/chainlink-feeds + - tmp/linux_arm64/chainlink-solana build_flag_templates: - "--platform=linux/arm64" - "--pull" @@ -89,6 +102,7 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-arm64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-arm64" + - id: linux-amd64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -96,6 +110,8 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs + - tmp/linux_amd64/chainlink-feeds + - tmp/linux_amd64/chainlink-solana build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -120,6 +136,8 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs + - tmp/linux_arm64/chainlink-feeds + - tmp/linux_arm64/chainlink-solana build_flag_templates: - "--platform=linux/arm64" - "--pull" diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index 26335a85bf1..cd9717e7f72 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -17,6 +17,9 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ COPY . /usr/local/bin/ # Copy native libs if cgo is enabled COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs +# Copy LOOP plugins +COPY ./tmp/linux_${TARGETARCH}/chainlink-feeds /usr/local/bin/ +COPY ./tmp/linux_${TARGETARCH}/chainlink-solana /usr/local/bin/ RUN if [ ${CHAINLINK_USER} != root ]; then \ useradd --uid 14933 --create-home ${CHAINLINK_USER}; \ diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index 4eb8e1acd07..35fb335ec17 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -41,6 +41,17 @@ _get_wasmvm_lib_path() { echo "$shared_lib_dir/${lib_name}.$lib_extension" } +# install LOOP plugins +_install_plugins() { + go_path=$(go env GOPATH) + go mod download + make install-chainlink + go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-feeds | xargs -I % ln -s % ./chainlink-feeds + go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-solana | xargs -I % ln -s % ./chainlink-solana + cd chainlink-feeds && go install ./cmd/chainlink-feeds && cd .. + cd chainlink-solana && go install ./pkg/solana/cmd/chainlink-solana && cd .. +} + # global goreleaser before hook # moves native libraries to temp directories used by docker images / archives before_hook() { @@ -50,14 +61,25 @@ before_hook() { local -r wasmvm_lib_path_linux_arm64=$(_get_wasmvm_lib_path "linux" "arm64") local -r wasmvm_lib_path_darwin_amd64=$(_get_wasmvm_lib_path "darwin" "amd64") local -r wasmvm_lib_path_darwin_arm64=$(_get_wasmvm_lib_path "darwin" "arm64") + + _install_plugins + mkdir -p "$lib_path/linux_amd64/libs" cp -f "$wasmvm_lib_path_linux_amd64" "$lib_path/linux_amd64/libs" + cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" + cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" mkdir -p "$lib_path/linux_arm64/libs" cp -f "$wasmvm_lib_path_linux_arm64" "$lib_path/linux_arm64/libs" + cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" + cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" mkdir -p "$lib_path/darwin_amd64/libs" cp -f "$wasmvm_lib_path_darwin_amd64" "$lib_path/darwin_amd64/libs" + cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" + cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" mkdir -p "$lib_path/darwin_arm64/libs" cp -f "$wasmvm_lib_path_darwin_arm64" "$lib_path/darwin_arm64/libs" + cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" + cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" } # binary build post hook @@ -71,6 +93,8 @@ build_post_hook() { local -r wasmvm_lib_path=$(_get_wasmvm_lib_path "$platform" "$arch") mkdir -p "$lib_path" cp "$wasmvm_lib_path" "$lib_path" + cp "tmp/${platform}_${arch}/chainlink-feeds" "$dist_path" + cp "tmp/${platform}_${arch}/chainlink-solana" "$dist_path" } "$@" From 87c92263e6915e704820b1f57ad523f5fadbb16a Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 10:24:16 -0600 Subject: [PATCH 07/40] comment out integration-tests --- .../goreleaser-build-publish-develop.yml | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index b5d158ab43e..33f97c552c2 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -43,44 +43,44 @@ jobs: hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} this-job-name: push-chainlink-develop-goreleaser continue-on-error: true - mercury-e2e-tests: - needs: [push-chainlink-develop-goreleaser] - runs-on: - labels: ubuntu-latest - environment: build-develop - permissions: - id-token: write - contents: read - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Configure aws credentials - uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN_GATI }} - role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }} - aws-region: ${{ secrets.AWS_REGION }} - - name: Get Github Token - id: get-gh-token - uses: smartcontractkit/chainlink-github-actions/github-app-token-issuer@main - with: - url: ${{ secrets.GATI_LAMBDA_FUNCTION_URL }} - - name: 'Dispatch Workflow: E2E Functional Tests' - id: dispatch-workflow-e2e-functional-tests - shell: bash - run: | - image_build_metadata=$(jq -n \ - --arg commit_sha "$GITHUB_SHA" \ - --arg run_url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ - '{ - commit_sha: $commit_sha, - originating_run_url: $run_url - }') - gh workflow run "e2e-functional-tests.yml" \ - --repo ${{ secrets.MERCURY_SERVER_REPO }} \ - --ref "main" \ - --field chainlink-ecr-repo-account="sdlc" \ - --field chainlink-image-build-metadata="${image_build_metadata}" \ - --field chainlink-image-tag="develop" - env: - GH_TOKEN: ${{ steps.get-gh-token.outputs.access-token }} + # mercury-e2e-tests: + # needs: [push-chainlink-develop-goreleaser] + # runs-on: + # labels: ubuntu-latest + # environment: build-develop + # permissions: + # id-token: write + # contents: read + # steps: + # - name: Checkout repository + # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + # - name: Configure aws credentials + # uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 + # with: + # role-to-assume: ${{ secrets.AWS_ROLE_ARN_GATI }} + # role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }} + # aws-region: ${{ secrets.AWS_REGION }} + # - name: Get Github Token + # id: get-gh-token + # uses: smartcontractkit/chainlink-github-actions/github-app-token-issuer@main + # with: + # url: ${{ secrets.GATI_LAMBDA_FUNCTION_URL }} + # - name: 'Dispatch Workflow: E2E Functional Tests' + # id: dispatch-workflow-e2e-functional-tests + # shell: bash + # run: | + # image_build_metadata=$(jq -n \ + # --arg commit_sha "$GITHUB_SHA" \ + # --arg run_url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + # '{ + # commit_sha: $commit_sha, + # originating_run_url: $run_url + # }') + # gh workflow run "e2e-functional-tests.yml" \ + # --repo ${{ secrets.MERCURY_SERVER_REPO }} \ + # --ref "main" \ + # --field chainlink-ecr-repo-account="sdlc" \ + # --field chainlink-image-build-metadata="${image_build_metadata}" \ + # --field chainlink-image-tag="develop" + # env: + # GH_TOKEN: ${{ steps.get-gh-token.outputs.access-token }} From 6cab8d6bff5119e7e9165309f0e722c462e373c5 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 10:44:52 -0600 Subject: [PATCH 08/40] add back goreleaser_wrapper --- .github/workflows/goreleaser-build-publish-develop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 33f97c552c2..83f0e522165 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -32,6 +32,7 @@ jobs: enable-docker-publish: "true" docker-registry: ${{ secrets.AWS_DEVELOP_ECR_HOSTNAME }} enable-goreleaser-snapshot: "true" + goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.ci.yaml zig-version: 0.11.0 - name: Collect Metrics From 3b8154df17ccd923021e451b3d6db43eba764c6f Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 11:00:24 -0600 Subject: [PATCH 09/40] fix path in goreleaser_utils --- tools/bin/goreleaser_utils | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index 35fb335ec17..012590446e3 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -70,16 +70,16 @@ before_hook() { cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" mkdir -p "$lib_path/linux_arm64/libs" cp -f "$wasmvm_lib_path_linux_arm64" "$lib_path/linux_arm64/libs" - cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" - cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" + cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_arm64/chainlink-feeds" + cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_arm64/chainlink-solana" mkdir -p "$lib_path/darwin_amd64/libs" cp -f "$wasmvm_lib_path_darwin_amd64" "$lib_path/darwin_amd64/libs" - cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" - cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" + cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_amd64/chainlink-feeds" + cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_amd64/chainlink-solana" mkdir -p "$lib_path/darwin_arm64/libs" cp -f "$wasmvm_lib_path_darwin_arm64" "$lib_path/darwin_arm64/libs" - cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" - cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" + cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_arm64/chainlink-feeds" + cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_arm64/chainlink-solana" } # binary build post hook From 21edc15603a878d158e0929a52ff94e3ed36ee81 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 11:45:31 -0600 Subject: [PATCH 10/40] add multi-line json output support --- .github/actions/goreleaser-build-sign-publish/action_utils | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/goreleaser-build-sign-publish/action_utils b/.github/actions/goreleaser-build-sign-publish/action_utils index bf33d0cb4c6..4089a294dc2 100755 --- a/.github/actions/goreleaser-build-sign-publish/action_utils +++ b/.github/actions/goreleaser-build-sign-publish/action_utils @@ -71,8 +71,13 @@ goreleaser_release() { rm -rf cosign.key fi + delimiter="$(openssl rand -hex 8)" + echo "metadata<<${delimiter}" >> "$GITHUB_OUTPUT" echo "metadata=$(cat dist/metadata.json)" >> "$GITHUB_OUTPUT" + echo "${delimiter}" >> "$GITHUB_OUTPUT" + echo "artifacts<<${delimiter}" >> "$GITHUB_OUTPUT" echo "artifacts=$(cat dist/artifacts.json)" >> "$GITHUB_OUTPUT" + echo "${delimiter}" >> "$GITHUB_OUTPUT" } "$@" From 43d13a9c0d2fef96aa1848c8b673fdcf26f533c5 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 15:51:11 -0600 Subject: [PATCH 11/40] save --- .../goreleaser-build-sign-publish/action.yml | 3 +-- .goreleaser.develop.ci.yaml | 3 +++ .goreleaser.develop.local.yaml | 3 +++ core/chainlink.Dockerfile | 3 ++- core/chainlink.goreleaser.Dockerfile | 5 +++-- tools/bin/goreleaser_utils | 22 +++++++++---------- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/actions/goreleaser-build-sign-publish/action.yml b/.github/actions/goreleaser-build-sign-publish/action.yml index faf7aa01ceb..8079af39a82 100644 --- a/.github/actions/goreleaser-build-sign-publish/action.yml +++ b/.github/actions/goreleaser-build-sign-publish/action.yml @@ -11,8 +11,7 @@ inputs: required: false cosign-version: description: The cosign version - default: v1.13.1 - # TODO update to v2.2.2 + default: v2.2.2 required: false macos-sdk-dir: description: The macos sdk directory diff --git a/.goreleaser.develop.ci.yaml b/.goreleaser.develop.ci.yaml index 6b19483db5d..bddaace34ef 100644 --- a/.goreleaser.develop.ci.yaml +++ b/.goreleaser.develop.ci.yaml @@ -10,6 +10,7 @@ env: before: hooks: + - go mod tidy - ./tools/bin/goreleaser_utils before_hook # See https://goreleaser.com/customization/build/ @@ -30,6 +31,7 @@ builds: - -trimpath - -buildmode=pie ldflags: + - -s -w -r=$ORIGIN/libs - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} @@ -49,6 +51,7 @@ builds: - -trimpath - -buildmode=pie ldflags: + - -s -w -r=$ORIGIN/libs - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} diff --git a/.goreleaser.develop.local.yaml b/.goreleaser.develop.local.yaml index f0bc3e3994f..1cbe568b9ad 100644 --- a/.goreleaser.develop.local.yaml +++ b/.goreleaser.develop.local.yaml @@ -9,6 +9,7 @@ env: before: hooks: + - go mod tidy - ./tools/bin/goreleaser_utils before_hook # See https://goreleaser.com/customization/build/ @@ -29,6 +30,7 @@ builds: - -trimpath - -buildmode=pie ldflags: + - -s -w -r=$ORIGIN/libs - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} @@ -48,6 +50,7 @@ builds: - -trimpath - -buildmode=pie ldflags: + - -s -w -r=$ORIGIN/libs - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} diff --git a/core/chainlink.Dockerfile b/core/chainlink.Dockerfile index 22e65c0aa7a..f992ee76166 100644 --- a/core/chainlink.Dockerfile +++ b/core/chainlink.Dockerfile @@ -44,7 +44,8 @@ RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |tee /etc/apt/sources.list.d/pgdg.list \ && apt-get update && apt-get install -y postgresql-client-15 \ - && apt-get clean all + && apt-get clean all \ + && rm -rf /var/lib/apt/lists/* COPY --from=buildgo /go/bin/chainlink /usr/local/bin/ diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index cd9717e7f72..f3e883c9d8d 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -12,9 +12,10 @@ RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |tee /etc/apt/sources.list.d/pgdg.list \ && apt-get update && apt-get install -y postgresql-client-15 \ - && apt-get clean all + && apt-get clean all \ + && rm -rf /var/lib/apt/lists/* -COPY . /usr/local/bin/ +COPY ./chainlink /usr/local/bin/ # Copy native libs if cgo is enabled COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs # Copy LOOP plugins diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index 012590446e3..e3dfef9bb47 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -62,24 +62,24 @@ before_hook() { local -r wasmvm_lib_path_darwin_amd64=$(_get_wasmvm_lib_path "darwin" "amd64") local -r wasmvm_lib_path_darwin_arm64=$(_get_wasmvm_lib_path "darwin" "arm64") - _install_plugins + # _install_plugins mkdir -p "$lib_path/linux_amd64/libs" cp -f "$wasmvm_lib_path_linux_amd64" "$lib_path/linux_amd64/libs" - cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" - cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" + # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" + # cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" mkdir -p "$lib_path/linux_arm64/libs" cp -f "$wasmvm_lib_path_linux_arm64" "$lib_path/linux_arm64/libs" - cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_arm64/chainlink-feeds" - cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_arm64/chainlink-solana" + # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_arm64/chainlink-feeds" + # cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_arm64/chainlink-solana" mkdir -p "$lib_path/darwin_amd64/libs" cp -f "$wasmvm_lib_path_darwin_amd64" "$lib_path/darwin_amd64/libs" - cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_amd64/chainlink-feeds" - cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_amd64/chainlink-solana" + # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_amd64/chainlink-feeds" + # cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_amd64/chainlink-solana" mkdir -p "$lib_path/darwin_arm64/libs" cp -f "$wasmvm_lib_path_darwin_arm64" "$lib_path/darwin_arm64/libs" - cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_arm64/chainlink-feeds" - cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_arm64/chainlink-solana" + # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_arm64/chainlink-feeds" + # cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_arm64/chainlink-solana" } # binary build post hook @@ -93,8 +93,8 @@ build_post_hook() { local -r wasmvm_lib_path=$(_get_wasmvm_lib_path "$platform" "$arch") mkdir -p "$lib_path" cp "$wasmvm_lib_path" "$lib_path" - cp "tmp/${platform}_${arch}/chainlink-feeds" "$dist_path" - cp "tmp/${platform}_${arch}/chainlink-solana" "$dist_path" + # cp "tmp/${platform}_${arch}/chainlink-feeds" "$dist_path" + # cp "tmp/${platform}_${arch}/chainlink-solana" "$dist_path" } "$@" From 8dc6294de8ca522b241a2580ceabe9addf8f501b Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 16:34:32 -0600 Subject: [PATCH 12/40] revert everthing and add go mod tidy --- .goreleaser.develop.local.yaml | 199 ------------------ ...evelop.ci.yaml => .goreleaser.develop.yaml | 31 ++- .tool-versions | 2 +- core/chainlink.goreleaser.Dockerfile | 3 - tools/bin/goreleaser_utils | 21 -- 5 files changed, 14 insertions(+), 242 deletions(-) delete mode 100644 .goreleaser.develop.local.yaml rename .goreleaser.develop.ci.yaml => .goreleaser.develop.yaml (93%) diff --git a/.goreleaser.develop.local.yaml b/.goreleaser.develop.local.yaml deleted file mode 100644 index 1cbe568b9ad..00000000000 --- a/.goreleaser.develop.local.yaml +++ /dev/null @@ -1,199 +0,0 @@ -# For building binaries locally -project_name: chainlink - -env: - - IMAGE_PREFIX={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }} - - IMAGE_LABEL_DESCRIPTION="node of the decentralized oracle network, bridging on and off-chain computation" - - IMAGE_LABEL_LICENSES="MIT" - - IMAGE_LABEL_SOURCE="https://github.com/smartcontractkit/{{ .ProjectName }}" - -before: - hooks: - - go mod tidy - - ./tools/bin/goreleaser_utils before_hook - -# See https://goreleaser.com/customization/build/ -builds: - - id: linux-arm64 - binary: "{{ .ProjectName }}" - goos: - - linux - goarch: - - arm64 - hooks: - post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} - env: - - CGO_ENABLED=1 - - CC=zig cc -target aarch64-linux-gnu - - CCX=zig c++ -target aarch64-linux-gnu - flags: - - -trimpath - - -buildmode=pie - ldflags: - - -s -w -r=$ORIGIN/libs - - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} - - - id: linux-amd64 - binary: "{{ .ProjectName }}" - goos: - - linux - goarch: - - amd64 - hooks: - post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} - env: - - CGO_ENABLED=1 - - CC=zig cc -target x86_64-linux-gnu - - CCX=zig c++ -target x86_64-linux-gnu - flags: - - -trimpath - - -buildmode=pie - ldflags: - - -s -w -r=$ORIGIN/libs - - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} - -# See https://goreleaser.com/customization/docker/ -dockers: - - id: root-linux-amd64 - dockerfile: core/chainlink.goreleaser.Dockerfile - use: buildx - goos: linux - goarch: amd64 - extra_files: - - tmp/linux_amd64/libs - - tmp/linux_amd64/chainlink-feeds - - tmp/linux_amd64/chainlink-solana - build_flag_templates: - - "--platform=linux/amd64" - - "--pull" - - "--build-arg=COMMIT_SHA={{ .FullCommit }}" - - "--label=org.opencontainers.image.created={{ .Date }}" - - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" - - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" - - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" - - "--label=org.opencontainers.image.title={{ .ProjectName }}" - - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" - - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-amd64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-amd64" - - - id: root-linux-arm64 - dockerfile: core/chainlink.goreleaser.Dockerfile - use: buildx - goos: linux - goarch: arm64 - extra_files: - - tmp/linux_arm64/libs - - tmp/linux_arm64/chainlink-feeds - - tmp/linux_arm64/chainlink-solana - build_flag_templates: - - "--platform=linux/arm64" - - "--pull" - - "--build-arg=COMMIT_SHA={{ .FullCommit }}" - - "--label=org.opencontainers.image.created={{ .Date }}" - - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" - - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" - - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" - - "--label=org.opencontainers.image.title={{ .ProjectName }}" - - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" - - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-arm64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-arm64" - - - id: linux-amd64 - dockerfile: core/chainlink.goreleaser.Dockerfile - use: buildx - goos: linux - goarch: amd64 - extra_files: - - tmp/linux_amd64/libs - - tmp/linux_amd64/chainlink-feeds - - tmp/linux_amd64/chainlink-solana - build_flag_templates: - - "--platform=linux/amd64" - - "--pull" - - "--build-arg=CHAINLINK_USER=chainlink" - - "--build-arg=COMMIT_SHA={{ .FullCommit }}" - - "--label=org.opencontainers.image.created={{ .Date }}" - - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" - - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" - - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" - - "--label=org.opencontainers.image.title={{ .ProjectName }}" - - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" - - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-amd64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-amd64" - - - id: linux-arm64 - dockerfile: core/chainlink.goreleaser.Dockerfile - use: buildx - goos: linux - goarch: arm64 - extra_files: - - tmp/linux_arm64/libs - - tmp/linux_arm64/chainlink-feeds - - tmp/linux_arm64/chainlink-solana - build_flag_templates: - - "--platform=linux/arm64" - - "--pull" - - "--build-arg=CHAINLINK_USER=chainlink" - - "--build-arg=COMMIT_SHA={{ .FullCommit }}" - - "--label=org.opencontainers.image.created={{ .Date }}" - - "--label=org.opencontainers.image.description={{ .Env.IMAGE_LABEL_DESCRIPTION }}" - - "--label=org.opencontainers.image.licenses={{ .Env.IMAGE_LABEL_LICENSES }}" - - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - - "--label=org.opencontainers.image.source={{ .Env.IMAGE_LABEL_SOURCE }}" - - "--label=org.opencontainers.image.title={{ .ProjectName }}" - - "--label=org.opencontainers.image.version={{ .Env.CHAINLINK_VERSION }}" - - "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-arm64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-arm64" - -# See https://goreleaser.com/customization/docker_manifest/ -docker_manifests: - - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-amd64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-arm64" - - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-amd64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-arm64" - - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-amd64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-arm64" - - name_template: "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}" - image_templates: - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-amd64" - - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-arm64" - -# See https://goreleaser.com/customization/docker_sign/ -docker_signs: - - artifacts: all - stdin: "{{ .Env.COSIGN_PASSWORD }}" - -checksum: - name_template: "checksums.txt" - -snapshot: - name_template: "{{ .Env.CHAINLINK_VERSION }}-{{ .ShortCommit }}" - -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" -# modelines, feel free to remove those if you don't want/use them: -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/.goreleaser.develop.ci.yaml b/.goreleaser.develop.yaml similarity index 93% rename from .goreleaser.develop.ci.yaml rename to .goreleaser.develop.yaml index bddaace34ef..50d3b2123e6 100644 --- a/.goreleaser.develop.ci.yaml +++ b/.goreleaser.develop.yaml @@ -1,8 +1,8 @@ -# For building binaries in github actions CI +## goreleaser <1.14.0 project_name: chainlink env: - - ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }} + - ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ end }} - IMAGE_PREFIX={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }} - IMAGE_LABEL_DESCRIPTION="node of the decentralized oracle network, bridging on and off-chain computation" - IMAGE_LABEL_LICENSES="MIT" @@ -15,8 +15,8 @@ before: # See https://goreleaser.com/customization/build/ builds: - - id: linux-arm64 - binary: "{{ .ProjectName }}" + - binary: chainlink + id: linux-arm64 goos: - linux goarch: @@ -34,9 +34,8 @@ builds: - -s -w -r=$ORIGIN/libs - -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.CHAINLINK_VERSION }} - -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }} - - - id: linux-amd64 - binary: "{{ .ProjectName }}" + - binary: chainlink + id: linux-amd64 goos: - linux goarch: @@ -64,8 +63,6 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs - - tmp/linux_amd64/chainlink-feeds - - tmp/linux_amd64/chainlink-solana build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -81,7 +78,6 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-amd64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-amd64" - - id: root-linux-arm64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -89,8 +85,6 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs - - tmp/linux_arm64/chainlink-feeds - - tmp/linux_arm64/chainlink-solana build_flag_templates: - "--platform=linux/arm64" - "--pull" @@ -106,7 +100,6 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-root-arm64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-root-arm64" - - id: linux-amd64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -114,8 +107,6 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs - - tmp/linux_amd64/chainlink-feeds - - tmp/linux_amd64/chainlink-solana build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -132,7 +123,6 @@ dockers: image_templates: - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:develop-amd64" - "{{ .Env.IMAGE_PREFIX }}/{{ .ProjectName }}-develop:sha-{{ .ShortCommit }}-amd64" - - id: linux-arm64 dockerfile: core/chainlink.goreleaser.Dockerfile use: buildx @@ -140,8 +130,6 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs - - tmp/linux_arm64/chainlink-feeds - - tmp/linux_arm64/chainlink-solana build_flag_templates: - "--platform=linux/arm64" - "--pull" @@ -183,6 +171,13 @@ docker_signs: - artifacts: all stdin: "{{ .Env.COSIGN_PASSWORD }}" +archives: + - rlcp: true + files: + - src: tmp/{{ .Os }}_{{ .Arch }}/libs/* + dst: libs + strip_parent: true + checksum: name_template: "checksums.txt" diff --git a/.tool-versions b/.tool-versions index 2ec4cde8ad1..d8f0afd901d 100644 --- a/.tool-versions +++ b/.tool-versions @@ -3,5 +3,5 @@ mockery 2.38.0 nodejs 16.16.0 postgres 13.3 helm 3.10.3 -zig 0.11.0 +zig 0.10.1 golangci-lint 1.55.2 diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index f3e883c9d8d..9e208b1907b 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -18,9 +18,6 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ COPY ./chainlink /usr/local/bin/ # Copy native libs if cgo is enabled COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs -# Copy LOOP plugins -COPY ./tmp/linux_${TARGETARCH}/chainlink-feeds /usr/local/bin/ -COPY ./tmp/linux_${TARGETARCH}/chainlink-solana /usr/local/bin/ RUN if [ ${CHAINLINK_USER} != root ]; then \ useradd --uid 14933 --create-home ${CHAINLINK_USER}; \ diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index e3dfef9bb47..e6804250ea6 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -41,17 +41,6 @@ _get_wasmvm_lib_path() { echo "$shared_lib_dir/${lib_name}.$lib_extension" } -# install LOOP plugins -_install_plugins() { - go_path=$(go env GOPATH) - go mod download - make install-chainlink - go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-feeds | xargs -I % ln -s % ./chainlink-feeds - go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-solana | xargs -I % ln -s % ./chainlink-solana - cd chainlink-feeds && go install ./cmd/chainlink-feeds && cd .. - cd chainlink-solana && go install ./pkg/solana/cmd/chainlink-solana && cd .. -} - # global goreleaser before hook # moves native libraries to temp directories used by docker images / archives before_hook() { @@ -66,20 +55,12 @@ before_hook() { mkdir -p "$lib_path/linux_amd64/libs" cp -f "$wasmvm_lib_path_linux_amd64" "$lib_path/linux_amd64/libs" - # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_amd64/chainlink-feeds" - # cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_amd64/chainlink-solana" mkdir -p "$lib_path/linux_arm64/libs" cp -f "$wasmvm_lib_path_linux_arm64" "$lib_path/linux_arm64/libs" - # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/linux_arm64/chainlink-feeds" - # cp -f "$go_path/bin/chainlink-solana" "$lib_path/linux_arm64/chainlink-solana" mkdir -p "$lib_path/darwin_amd64/libs" cp -f "$wasmvm_lib_path_darwin_amd64" "$lib_path/darwin_amd64/libs" - # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_amd64/chainlink-feeds" - # cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_amd64/chainlink-solana" mkdir -p "$lib_path/darwin_arm64/libs" cp -f "$wasmvm_lib_path_darwin_arm64" "$lib_path/darwin_arm64/libs" - # cp -f "$go_path/bin/chainlink-feeds" "$lib_path/darwin_arm64/chainlink-feeds" - # cp -f "$go_path/bin/chainlink-solana" "$lib_path/darwin_arm64/chainlink-solana" } # binary build post hook @@ -93,8 +74,6 @@ build_post_hook() { local -r wasmvm_lib_path=$(_get_wasmvm_lib_path "$platform" "$arch") mkdir -p "$lib_path" cp "$wasmvm_lib_path" "$lib_path" - # cp "tmp/${platform}_${arch}/chainlink-feeds" "$dist_path" - # cp "tmp/${platform}_${arch}/chainlink-solana" "$dist_path" } "$@" From 9e01db749617037cc9776d7904738cfd5bb5dcde Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 16:39:40 -0600 Subject: [PATCH 13/40] revert zig and goreleaser config --- .github/actions/goreleaser-build-sign-publish/action.yml | 2 +- .github/workflows/goreleaser-build-publish-develop.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/goreleaser-build-sign-publish/action.yml b/.github/actions/goreleaser-build-sign-publish/action.yml index 8079af39a82..12a04b03f78 100644 --- a/.github/actions/goreleaser-build-sign-publish/action.yml +++ b/.github/actions/goreleaser-build-sign-publish/action.yml @@ -7,7 +7,7 @@ inputs: required: false zig-version: description: The zig version - default: 0.11.0 + default: 0.10.1 required: false cosign-version: description: The cosign version diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 83f0e522165..6b0f6374981 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -33,8 +33,8 @@ jobs: docker-registry: ${{ secrets.AWS_DEVELOP_ECR_HOSTNAME }} enable-goreleaser-snapshot: "true" goreleaser-exec: ./tools/bin/goreleaser_wrapper - goreleaser-config: .goreleaser.develop.ci.yaml - zig-version: 0.11.0 + goreleaser-config: .goreleaser.develop.yaml + zig-version: 0.10.1 - name: Collect Metrics if: always() id: collect-gha-metrics From 3862bc918cef7b6264309c949fbbb2d63523c33f Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 16:49:12 -0600 Subject: [PATCH 14/40] update --- .github/actions/goreleaser-build-sign-publish/action.yml | 5 +++++ .github/workflows/goreleaser-build-publish-develop.yml | 3 ++- .goreleaser.develop.yaml | 7 ------- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/actions/goreleaser-build-sign-publish/action.yml b/.github/actions/goreleaser-build-sign-publish/action.yml index 12a04b03f78..b26af74ef5e 100644 --- a/.github/actions/goreleaser-build-sign-publish/action.yml +++ b/.github/actions/goreleaser-build-sign-publish/action.yml @@ -5,6 +5,9 @@ inputs: description: The goreleaser version default: 1.23.0 required: false + goreleaser-key: + description: The goreleaser key + required: false zig-version: description: The zig version default: 0.10.1 @@ -78,6 +81,8 @@ runs: distribution: goreleaser-pro install-only: true version: ${{ inputs.goreleaser-version }} + env: + GORELEASER_KEY: ${{ inputs.goreleaser-key }} - name: Setup zig uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 with: diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 6b0f6374981..f0145e351ba 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -34,7 +34,8 @@ jobs: enable-goreleaser-snapshot: "true" goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml - zig-version: 0.10.1 + goreleaser-key: ${{ secrets.GORELEASER_KEY }} + zig-version: 0.11.0 - name: Collect Metrics if: always() id: collect-gha-metrics diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 50d3b2123e6..28d0d14f0f9 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -171,13 +171,6 @@ docker_signs: - artifacts: all stdin: "{{ .Env.COSIGN_PASSWORD }}" -archives: - - rlcp: true - files: - - src: tmp/{{ .Os }}_{{ .Arch }}/libs/* - dst: libs - strip_parent: true - checksum: name_template: "checksums.txt" From ccffe983141bed958e3cc7b6d2b6b3c9fb14863b Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 17:02:51 -0600 Subject: [PATCH 15/40] zig 0.10.1 --- .github/workflows/goreleaser-build-publish-develop.yml | 2 +- core/chainlink.goreleaser.Dockerfile | 2 +- tools/bin/goreleaser_utils | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index f0145e351ba..72c07a0eeb3 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - zig-version: 0.11.0 + zig-version: 0.10.1 - name: Collect Metrics if: always() id: collect-gha-metrics diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index 9e208b1907b..edb65b4590f 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -15,7 +15,7 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && apt-get clean all \ && rm -rf /var/lib/apt/lists/* -COPY ./chainlink /usr/local/bin/ +COPY . /usr/local/bin/ # Copy native libs if cgo is enabled COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index e6804250ea6..b79811ce1c9 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -51,8 +51,6 @@ before_hook() { local -r wasmvm_lib_path_darwin_amd64=$(_get_wasmvm_lib_path "darwin" "amd64") local -r wasmvm_lib_path_darwin_arm64=$(_get_wasmvm_lib_path "darwin" "arm64") - # _install_plugins - mkdir -p "$lib_path/linux_amd64/libs" cp -f "$wasmvm_lib_path_linux_amd64" "$lib_path/linux_amd64/libs" mkdir -p "$lib_path/linux_arm64/libs" From 742772635801aa6c25c81cb949d9c9917cbf1049 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 17:09:37 -0600 Subject: [PATCH 16/40] update go.mod go version --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index cbcad20919f..e0e7f5144a0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/v2 -go 1.21.3 +go 1.21.5 require ( github.com/Depado/ginprom v1.8.0 From a465bd29d015a85d4e9991d1536a07176e053806 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 17:56:15 -0600 Subject: [PATCH 17/40] add -shared in goreleaser --- .goreleaser.develop.yaml | 4 ++-- go.mod | 2 +- tools/bin/goreleaser_utils | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 28d0d14f0f9..243419b1367 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -26,7 +26,7 @@ builds: env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target aarch64-linux-gnu - - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu + - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu -shared -o libwasmvm.so wasmvm.so flags: - -trimpath - -buildmode=pie @@ -45,7 +45,7 @@ builds: env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target x86_64-linux-gnu - - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu + - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -shared -o libwasmvm.so wasmvm.so flags: - -trimpath - -buildmode=pie diff --git a/go.mod b/go.mod index e0e7f5144a0..cbcad20919f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/v2 -go 1.21.5 +go 1.21.3 require ( github.com/Depado/ginprom v1.8.0 diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index b79811ce1c9..4eb8e1acd07 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -50,7 +50,6 @@ before_hook() { local -r wasmvm_lib_path_linux_arm64=$(_get_wasmvm_lib_path "linux" "arm64") local -r wasmvm_lib_path_darwin_amd64=$(_get_wasmvm_lib_path "darwin" "amd64") local -r wasmvm_lib_path_darwin_arm64=$(_get_wasmvm_lib_path "darwin" "arm64") - mkdir -p "$lib_path/linux_amd64/libs" cp -f "$wasmvm_lib_path_linux_amd64" "$lib_path/linux_amd64/libs" mkdir -p "$lib_path/linux_arm64/libs" From 6b2fc08555ab213339d91e5a475a1c8e8f5b3383 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 18:01:26 -0600 Subject: [PATCH 18/40] use zig 0.11.0 and update bash fail --- .github/actions/goreleaser-build-sign-publish/action_utils | 1 + .github/workflows/goreleaser-build-publish-develop.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/goreleaser-build-sign-publish/action_utils b/.github/actions/goreleaser-build-sign-publish/action_utils index 4089a294dc2..4f8d609a6a0 100755 --- a/.github/actions/goreleaser-build-sign-publish/action_utils +++ b/.github/actions/goreleaser-build-sign-publish/action_utils @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -x +set -euo pipefail ENABLE_COSIGN=${ENABLE_COSIGN:-false} ENABLE_GORELEASER_SNAPSHOT=${ENABLE_GORELEASER_SNAPSHOT:-false} diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 72c07a0eeb3..f0145e351ba 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - zig-version: 0.10.1 + zig-version: 0.11.0 - name: Collect Metrics if: always() id: collect-gha-metrics From 91dc6019134f38aefc09e1742b8937dac9d143ca Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 18:15:42 -0600 Subject: [PATCH 19/40] add to cc --- .goreleaser.develop.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 243419b1367..84783fd4ed5 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -25,7 +25,7 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target aarch64-linux-gnu + - CC=$ZIG_EXEC cc -target aarch64-linux-gnu -shared -o libwasmvm.so wasmvm.so - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu -shared -o libwasmvm.so wasmvm.so flags: - -trimpath @@ -44,7 +44,7 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target x86_64-linux-gnu + - CC=$ZIG_EXEC cc -target x86_64-linux-gnu -shared -o libwasmvm.so wasmvm.so - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -shared -o libwasmvm.so wasmvm.so flags: - -trimpath From 279124c6834b0ed7067b9b80d7a52ff713b3756c Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 18:43:24 -0600 Subject: [PATCH 20/40] update name --- .goreleaser.develop.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 84783fd4ed5..c947608a22f 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -25,8 +25,8 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target aarch64-linux-gnu -shared -o libwasmvm.so wasmvm.so - - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu -shared -o libwasmvm.so wasmvm.so + - CC=$ZIG_EXEC cc -target aarch64-linux-gnu -shared -o libwasmvm.aarch64.so + - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu -shared -o libwasmvm.aarch64.so flags: - -trimpath - -buildmode=pie @@ -44,8 +44,8 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target x86_64-linux-gnu -shared -o libwasmvm.so wasmvm.so - - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -shared -o libwasmvm.so wasmvm.so + - CC=$ZIG_EXEC cc -target x86_64-linux-gnu -shared -o libwasmvm.x86_64.so + - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -shared -o libwasmvm.x86_64.so flags: - -trimpath - -buildmode=pie From 8455ff169fe27f623d48835b41fadf7dd490f9dd Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 18:51:53 -0600 Subject: [PATCH 21/40] test --- .goreleaser.develop.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index c947608a22f..ace2b717e41 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -11,7 +11,7 @@ env: before: hooks: - go mod tidy - - ./tools/bin/goreleaser_utils before_hook + # - ./tools/bin/goreleaser_utils before_hook # See https://goreleaser.com/customization/build/ builds: @@ -25,8 +25,8 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target aarch64-linux-gnu -shared -o libwasmvm.aarch64.so - - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu -shared -o libwasmvm.aarch64.so + - CC=$ZIG_EXEC cc -target aarch64-linux-gnu -shared wasmvm.o -o libwasmvm.aarch64.so + - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu -shared wasmvm.o -o libwasmvm.aarch64.so flags: - -trimpath - -buildmode=pie @@ -44,8 +44,8 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target x86_64-linux-gnu -shared -o libwasmvm.x86_64.so - - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -shared -o libwasmvm.x86_64.so + - CC=$ZIG_EXEC cc -target x86_64-linux-gnu -shared wasmvm.o -o libwasmvm.x86_64.so + - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -shared wasmvm.o -o libwasmvm.x86_64.so flags: - -trimpath - -buildmode=pie From 3666188693bba92d201a90ac0fa46f3f7dc4b8bb Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 19:32:52 -0600 Subject: [PATCH 22/40] test --- .goreleaser.develop.yaml | 10 +++++----- core/chainlink.goreleaser.Dockerfile | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index ace2b717e41..28d0d14f0f9 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -11,7 +11,7 @@ env: before: hooks: - go mod tidy - # - ./tools/bin/goreleaser_utils before_hook + - ./tools/bin/goreleaser_utils before_hook # See https://goreleaser.com/customization/build/ builds: @@ -25,8 +25,8 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target aarch64-linux-gnu -shared wasmvm.o -o libwasmvm.aarch64.so - - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu -shared wasmvm.o -o libwasmvm.aarch64.so + - CC=$ZIG_EXEC cc -target aarch64-linux-gnu + - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu flags: - -trimpath - -buildmode=pie @@ -44,8 +44,8 @@ builds: post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target x86_64-linux-gnu -shared wasmvm.o -o libwasmvm.x86_64.so - - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -shared wasmvm.o -o libwasmvm.x86_64.so + - CC=$ZIG_EXEC cc -target x86_64-linux-gnu + - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu flags: - -trimpath - -buildmode=pie diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index edb65b4590f..9e208b1907b 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -15,7 +15,7 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && apt-get clean all \ && rm -rf /var/lib/apt/lists/* -COPY . /usr/local/bin/ +COPY ./chainlink /usr/local/bin/ # Copy native libs if cgo is enabled COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs From a37ae174ce2955e7d71dddec350918872efdfdae Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 19:57:19 -0600 Subject: [PATCH 23/40] add LD_LIBRARY_PATH in dockerfile --- core/chainlink.goreleaser.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index 9e208b1907b..32a1094717e 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -6,6 +6,7 @@ FROM ubuntu:20.04 ARG CHAINLINK_USER=root ARG TARGETARCH ENV DEBIAN_FRONTEND noninteractive +ENV LD_LIBRARY_PATH /usr/local/bin/libs:$LD_LIBRARY_PATH RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl # Install Postgres for CLI tools, needed specifically for DB backups From 129d49790f5ee159b9857a68bdab2da87b6a0f9e Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 23:15:27 -0600 Subject: [PATCH 24/40] add _transform_path func --- tools/bin/goreleaser_utils | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index 4eb8e1acd07..23c5f1b4b7a 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -19,12 +19,19 @@ _get_arch() { esac } +_transform_path() { + local input_path="$1" + # Extract the part after 'pkg/mod/' and prepend with '/go/pkg/mod/' + local transformed_path=$(echo "$input_path" | sed -E 's|.*/pkg/mod/|/go/pkg/mod/|') + echo "$transformed_path" +} + # get lib wasmvm path _get_wasmvm_lib_path() { local -r platform="$1" local -r arch="$2" wasmvm_dir=$(go list -json -m all | jq -r '. | select(.Path == "github.com/CosmWasm/wasmvm") | .Dir') - shared_lib_dir="$wasmvm_dir/internal/api" + shared_lib_dir=$(_transform_path "$wasmvm_dir/internal/api") lib_name="libwasmvm" if [ "$platform" == "darwin" ]; then lib_extension="dylib" From 33b4845ce601e404e96c71121b887c8ffaf053ae Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 23:38:49 -0600 Subject: [PATCH 25/40] fix post-hook cp --- tools/bin/goreleaser_utils | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index 23c5f1b4b7a..255ca8083a3 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -19,19 +19,12 @@ _get_arch() { esac } -_transform_path() { - local input_path="$1" - # Extract the part after 'pkg/mod/' and prepend with '/go/pkg/mod/' - local transformed_path=$(echo "$input_path" | sed -E 's|.*/pkg/mod/|/go/pkg/mod/|') - echo "$transformed_path" -} - # get lib wasmvm path _get_wasmvm_lib_path() { local -r platform="$1" local -r arch="$2" wasmvm_dir=$(go list -json -m all | jq -r '. | select(.Path == "github.com/CosmWasm/wasmvm") | .Dir') - shared_lib_dir=$(_transform_path "$wasmvm_dir/internal/api") + shared_lib_dir="$wasmvm_dir/internal/api" lib_name="libwasmvm" if [ "$platform" == "darwin" ]; then lib_extension="dylib" @@ -77,7 +70,7 @@ build_post_hook() { # COPY NATIVE LIBRARIES HERE local -r wasmvm_lib_path=$(_get_wasmvm_lib_path "$platform" "$arch") mkdir -p "$lib_path" - cp "$wasmvm_lib_path" "$lib_path" + cp -r "tmp/${platform}_${arch}/"* "$lib_path/" } "$@" From 39710d44498e9c1f81469615b2bc7101160b0498 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 26 Jan 2024 23:48:26 -0600 Subject: [PATCH 26/40] remove post hooks --- .goreleaser.develop.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 28d0d14f0f9..188375ff813 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -21,8 +21,6 @@ builds: - linux goarch: - arm64 - hooks: - post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target aarch64-linux-gnu @@ -40,8 +38,6 @@ builds: - linux goarch: - amd64 - hooks: - post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target x86_64-linux-gnu From 6d38b56ab9b8030657de73b44b0f52a357c943c0 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Sat, 27 Jan 2024 00:00:57 -0600 Subject: [PATCH 27/40] use zig --- .goreleaser.develop.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 188375ff813..35efc363f4e 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -23,8 +23,8 @@ builds: - arm64 env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target aarch64-linux-gnu - - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu + - CC=zig cc -target aarch64-linux-gnu + - CCX=zig c++ -target aarch64-linux-gnu flags: - -trimpath - -buildmode=pie @@ -40,8 +40,8 @@ builds: - amd64 env: - CGO_ENABLED=1 - - CC=$ZIG_EXEC cc -target x86_64-linux-gnu - - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu + - CC=zig cc -target x86_64-linux-gnu + - CCX=zig c++ -target x86_64-linux-gnu flags: - -trimpath - -buildmode=pie From 89af873ca12bf6261c82a431f01ed7e3362ed1ad Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Sat, 27 Jan 2024 10:20:09 -0600 Subject: [PATCH 28/40] use older zig version --- .github/workflows/goreleaser-build-publish-develop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index f0145e351ba..6c31268d57a 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - zig-version: 0.11.0 + # zig-version: 0.11.0 - name: Collect Metrics if: always() id: collect-gha-metrics From d881f0654c466cd81f8ec579a9bcfff41736b9b6 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Tue, 6 Feb 2024 17:05:01 -0600 Subject: [PATCH 29/40] try zig 0.12.0-dev --- .github/workflows/goreleaser-build-publish-develop.yml | 2 +- .goreleaser.develop.yaml | 8 ++++---- .tool-versions | 2 +- core/chainlink.goreleaser.Dockerfile | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 6c31268d57a..a49501fdcb3 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - # zig-version: 0.11.0 + zig-version: 0.12.0-dev.2619+5cf138e51 - name: Collect Metrics if: always() id: collect-gha-metrics diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 35efc363f4e..188375ff813 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -23,8 +23,8 @@ builds: - arm64 env: - CGO_ENABLED=1 - - CC=zig cc -target aarch64-linux-gnu - - CCX=zig c++ -target aarch64-linux-gnu + - CC=$ZIG_EXEC cc -target aarch64-linux-gnu + - CCX=$ZIG_EXEC c++ -target aarch64-linux-gnu flags: - -trimpath - -buildmode=pie @@ -40,8 +40,8 @@ builds: - amd64 env: - CGO_ENABLED=1 - - CC=zig cc -target x86_64-linux-gnu - - CCX=zig c++ -target x86_64-linux-gnu + - CC=$ZIG_EXEC cc -target x86_64-linux-gnu + - CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu flags: - -trimpath - -buildmode=pie diff --git a/.tool-versions b/.tool-versions index d8f0afd901d..4408c18e7d5 100644 --- a/.tool-versions +++ b/.tool-versions @@ -3,5 +3,5 @@ mockery 2.38.0 nodejs 16.16.0 postgres 13.3 helm 3.10.3 -zig 0.10.1 +zig 0.12.0-dev.2619+5cf138e51 golangci-lint 1.55.2 diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index 32a1094717e..9e208b1907b 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -6,7 +6,6 @@ FROM ubuntu:20.04 ARG CHAINLINK_USER=root ARG TARGETARCH ENV DEBIAN_FRONTEND noninteractive -ENV LD_LIBRARY_PATH /usr/local/bin/libs:$LD_LIBRARY_PATH RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl # Install Postgres for CLI tools, needed specifically for DB backups From 918b48ff974a61f84aa8dc3b2f0e0db62d717f41 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Wed, 7 Feb 2024 14:49:47 -0600 Subject: [PATCH 30/40] add back posthook --- .goreleaser.develop.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 188375ff813..28d0d14f0f9 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -21,6 +21,8 @@ builds: - linux goarch: - arm64 + hooks: + post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target aarch64-linux-gnu @@ -38,6 +40,8 @@ builds: - linux goarch: - amd64 + hooks: + post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }} env: - CGO_ENABLED=1 - CC=$ZIG_EXEC cc -target x86_64-linux-gnu From c401f3870e9844c37d85f3767d4968872f898e3f Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Tue, 13 Feb 2024 13:41:36 -0600 Subject: [PATCH 31/40] use zig 0.10.1 again --- .github/workflows/goreleaser-build-publish-develop.yml | 2 +- .tool-versions | 3 ++- tools/bin/goreleaser_utils | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index a49501fdcb3..72c07a0eeb3 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - zig-version: 0.12.0-dev.2619+5cf138e51 + zig-version: 0.10.1 - name: Collect Metrics if: always() id: collect-gha-metrics diff --git a/.tool-versions b/.tool-versions index 4408c18e7d5..d8230564de3 100644 --- a/.tool-versions +++ b/.tool-versions @@ -3,5 +3,6 @@ mockery 2.38.0 nodejs 16.16.0 postgres 13.3 helm 3.10.3 -zig 0.12.0-dev.2619+5cf138e51 +# zig 0.12.0-dev.2619+5cf138e51 +zig 0.10.1 golangci-lint 1.55.2 diff --git a/tools/bin/goreleaser_utils b/tools/bin/goreleaser_utils index 255ca8083a3..4eb8e1acd07 100755 --- a/tools/bin/goreleaser_utils +++ b/tools/bin/goreleaser_utils @@ -70,7 +70,7 @@ build_post_hook() { # COPY NATIVE LIBRARIES HERE local -r wasmvm_lib_path=$(_get_wasmvm_lib_path "$platform" "$arch") mkdir -p "$lib_path" - cp -r "tmp/${platform}_${arch}/"* "$lib_path/" + cp "$wasmvm_lib_path" "$lib_path" } "$@" From 43007fc3c0e190b45ec5ecd7901b3d6773104b4e Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Tue, 13 Feb 2024 13:53:44 -0600 Subject: [PATCH 32/40] update go.mod to 1.21.5 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index cbcad20919f..e0e7f5144a0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/v2 -go 1.21.3 +go 1.21.5 require ( github.com/Depado/ginprom v1.8.0 From 87c7affe6f90075fff25d0b2d07a7c192c071987 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Tue, 13 Feb 2024 15:17:07 -0600 Subject: [PATCH 33/40] try older zig version --- .github/actions/goreleaser-build-sign-publish/action.yml | 2 +- .github/workflows/goreleaser-build-publish-develop.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/goreleaser-build-sign-publish/action.yml b/.github/actions/goreleaser-build-sign-publish/action.yml index b26af74ef5e..b8760e34dc1 100644 --- a/.github/actions/goreleaser-build-sign-publish/action.yml +++ b/.github/actions/goreleaser-build-sign-publish/action.yml @@ -20,7 +20,7 @@ inputs: description: The macos sdk directory default: MacOSX12.3.sdk required: false - # publising inputs + # publishing inputs enable-docker-publish: description: Enable publishing of docker images / manifests default: "true" diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 72c07a0eeb3..fd9d8b0ac40 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - zig-version: 0.10.1 + zig-version: 0.9.1 - name: Collect Metrics if: always() id: collect-gha-metrics From e5d286d1863e562ad8b5988b465d8fde9d7fd6a5 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Tue, 13 Feb 2024 15:25:02 -0600 Subject: [PATCH 34/40] another older zig version --- .github/workflows/goreleaser-build-publish-develop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index fd9d8b0ac40..2d9cb1a9cb6 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - zig-version: 0.9.1 + zig-version: 0.8.1 - name: Collect Metrics if: always() id: collect-gha-metrics From 1547a6cb8636aef10d9cda003a95737d2919befc Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Thu, 15 Feb 2024 13:54:32 -0600 Subject: [PATCH 35/40] add ldd_fix script with patchelf --- .../goreleaser-build-publish-develop.yml | 2 +- .goreleaser.develop.yaml | 4 ++++ .tool-versions | 3 +-- core/chainlink.Dockerfile | 2 +- core/chainlink.devspace.Dockerfile | 2 +- core/chainlink.goreleaser.Dockerfile | 5 +++- tools/bin/ldd_fix | 24 +++++++++++++++++++ 7 files changed, 36 insertions(+), 6 deletions(-) create mode 100755 tools/bin/ldd_fix diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index 2d9cb1a9cb6..f0145e351ba 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -35,7 +35,7 @@ jobs: goreleaser-exec: ./tools/bin/goreleaser_wrapper goreleaser-config: .goreleaser.develop.yaml goreleaser-key: ${{ secrets.GORELEASER_KEY }} - zig-version: 0.8.1 + zig-version: 0.11.0 - name: Collect Metrics if: always() id: collect-gha-metrics diff --git a/.goreleaser.develop.yaml b/.goreleaser.develop.yaml index 28d0d14f0f9..60949eee72e 100644 --- a/.goreleaser.develop.yaml +++ b/.goreleaser.develop.yaml @@ -63,6 +63,7 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs + - tools/bin/ldd_fix build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -85,6 +86,7 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs + - tools/bin/ldd_fix build_flag_templates: - "--platform=linux/arm64" - "--pull" @@ -107,6 +109,7 @@ dockers: goarch: amd64 extra_files: - tmp/linux_amd64/libs + - tools/bin/ldd_fix build_flag_templates: - "--platform=linux/amd64" - "--pull" @@ -130,6 +133,7 @@ dockers: goarch: arm64 extra_files: - tmp/linux_arm64/libs + - tools/bin/ldd_fix build_flag_templates: - "--platform=linux/arm64" - "--pull" diff --git a/.tool-versions b/.tool-versions index d8230564de3..2ec4cde8ad1 100644 --- a/.tool-versions +++ b/.tool-versions @@ -3,6 +3,5 @@ mockery 2.38.0 nodejs 16.16.0 postgres 13.3 helm 3.10.3 -# zig 0.12.0-dev.2619+5cf138e51 -zig 0.10.1 +zig 0.11.0 golangci-lint 1.55.2 diff --git a/core/chainlink.Dockerfile b/core/chainlink.Dockerfile index f992ee76166..c3b2b20c446 100644 --- a/core/chainlink.Dockerfile +++ b/core/chainlink.Dockerfile @@ -38,7 +38,7 @@ FROM ubuntu:20.04 ARG CHAINLINK_USER=root ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl +RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl patchelf # Install Postgres for CLI tools, needed specifically for DB backups RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ diff --git a/core/chainlink.devspace.Dockerfile b/core/chainlink.devspace.Dockerfile index c639190a80f..c3b9fad6b28 100644 --- a/core/chainlink.devspace.Dockerfile +++ b/core/chainlink.devspace.Dockerfile @@ -38,7 +38,7 @@ FROM golang:1.21-bullseye ARG CHAINLINK_USER=chainlink ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl +RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl patchelf # Install Postgres for CLI tools, needed specifically for DB backups RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index 9e208b1907b..364b7c81765 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -6,7 +6,7 @@ FROM ubuntu:20.04 ARG CHAINLINK_USER=root ARG TARGETARCH ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl +RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl patchelf # Install Postgres for CLI tools, needed specifically for DB backups RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ @@ -18,6 +18,9 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ COPY ./chainlink /usr/local/bin/ # Copy native libs if cgo is enabled COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs +COPY ./tools/bin/ldd_fix /usr/local/bin/ldd_fix +RUN chmod +x /usr/local/bin/ldd_fix +RUN /usr/local/bin/ldd_fix RUN if [ ${CHAINLINK_USER} != root ]; then \ useradd --uid 14933 --create-home ${CHAINLINK_USER}; \ diff --git a/tools/bin/ldd_fix b/tools/bin/ldd_fix new file mode 100755 index 00000000000..59e159997a1 --- /dev/null +++ b/tools/bin/ldd_fix @@ -0,0 +1,24 @@ +#!/bin/bash + +chainlink_path="/usr/local/bin/chainlink" +libs_path="/usr/local/bin/libs" + +line=$(ldd ${chainlink_path} | grep "github.com/!cosm!wasm/wasmvm") + +if [ -z "$line" ]; then + echo "Error: Path containing 'github.com/!cosm!wasm/wasmvm' not found in the ldd output." + exit 1 +fi + +path=$(echo "$line" | awk '{print $1}') + +if [ -z "$path" ]; then + echo "Error: Failed to extract the path from the line." + exit 1 +fi + +trimmed_path=${path%.so*}.so +cosm_file=$(ls ${libs_path} | grep "\.so$" | head -n 1) + +patchelf --remove-needed "${trimmed_path}" "$chainlink_path" +patchelf --add-needed "$cosm_file" "$chainlink_path" From d620ce5267c66e6b3a9cb636bb2b55bf1bfaea64 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Thu, 15 Feb 2024 14:14:24 -0600 Subject: [PATCH 36/40] uncomment --- .../goreleaser-build-publish-develop.yml | 87 ++++++++++--------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/.github/workflows/goreleaser-build-publish-develop.yml b/.github/workflows/goreleaser-build-publish-develop.yml index f0145e351ba..ce4d8fa773c 100644 --- a/.github/workflows/goreleaser-build-publish-develop.yml +++ b/.github/workflows/goreleaser-build-publish-develop.yml @@ -2,8 +2,8 @@ name: "Build publish Chainlink develop on private ECR" on: push: - # branches: - # - develop + branches: + - develop jobs: push-chainlink-develop-goreleaser: @@ -45,44 +45,45 @@ jobs: hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} this-job-name: push-chainlink-develop-goreleaser continue-on-error: true - # mercury-e2e-tests: - # needs: [push-chainlink-develop-goreleaser] - # runs-on: - # labels: ubuntu-latest - # environment: build-develop - # permissions: - # id-token: write - # contents: read - # steps: - # - name: Checkout repository - # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - # - name: Configure aws credentials - # uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 - # with: - # role-to-assume: ${{ secrets.AWS_ROLE_ARN_GATI }} - # role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }} - # aws-region: ${{ secrets.AWS_REGION }} - # - name: Get Github Token - # id: get-gh-token - # uses: smartcontractkit/chainlink-github-actions/github-app-token-issuer@main - # with: - # url: ${{ secrets.GATI_LAMBDA_FUNCTION_URL }} - # - name: 'Dispatch Workflow: E2E Functional Tests' - # id: dispatch-workflow-e2e-functional-tests - # shell: bash - # run: | - # image_build_metadata=$(jq -n \ - # --arg commit_sha "$GITHUB_SHA" \ - # --arg run_url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ - # '{ - # commit_sha: $commit_sha, - # originating_run_url: $run_url - # }') - # gh workflow run "e2e-functional-tests.yml" \ - # --repo ${{ secrets.MERCURY_SERVER_REPO }} \ - # --ref "main" \ - # --field chainlink-ecr-repo-account="sdlc" \ - # --field chainlink-image-build-metadata="${image_build_metadata}" \ - # --field chainlink-image-tag="develop" - # env: - # GH_TOKEN: ${{ steps.get-gh-token.outputs.access-token }} + + mercury-e2e-tests: + needs: [push-chainlink-develop-goreleaser] + runs-on: + labels: ubuntu-latest + environment: build-develop + permissions: + id-token: write + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Configure aws credentials + uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN_GATI }} + role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Get Github Token + id: get-gh-token + uses: smartcontractkit/chainlink-github-actions/github-app-token-issuer@main + with: + url: ${{ secrets.GATI_LAMBDA_FUNCTION_URL }} + - name: 'Dispatch Workflow: E2E Functional Tests' + id: dispatch-workflow-e2e-functional-tests + shell: bash + run: | + image_build_metadata=$(jq -n \ + --arg commit_sha "$GITHUB_SHA" \ + --arg run_url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + '{ + commit_sha: $commit_sha, + originating_run_url: $run_url + }') + gh workflow run "e2e-functional-tests.yml" \ + --repo ${{ secrets.MERCURY_SERVER_REPO }} \ + --ref "main" \ + --field chainlink-ecr-repo-account="sdlc" \ + --field chainlink-image-build-metadata="${image_build_metadata}" \ + --field chainlink-image-tag="develop" + env: + GH_TOKEN: ${{ steps.get-gh-token.outputs.access-token }} From ba18508e463732056e8d1792c553d02e6a6d74fb Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Thu, 15 Feb 2024 14:29:33 -0600 Subject: [PATCH 37/40] add comments and remove unnecessary --- core/chainlink.Dockerfile | 2 +- core/chainlink.devspace.Dockerfile | 2 +- core/chainlink.goreleaser.Dockerfile | 3 +++ tools/bin/ldd_fix | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/chainlink.Dockerfile b/core/chainlink.Dockerfile index c3b2b20c446..f992ee76166 100644 --- a/core/chainlink.Dockerfile +++ b/core/chainlink.Dockerfile @@ -38,7 +38,7 @@ FROM ubuntu:20.04 ARG CHAINLINK_USER=root ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl patchelf +RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl # Install Postgres for CLI tools, needed specifically for DB backups RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ diff --git a/core/chainlink.devspace.Dockerfile b/core/chainlink.devspace.Dockerfile index c3b9fad6b28..c639190a80f 100644 --- a/core/chainlink.devspace.Dockerfile +++ b/core/chainlink.devspace.Dockerfile @@ -38,7 +38,7 @@ FROM golang:1.21-bullseye ARG CHAINLINK_USER=chainlink ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl patchelf +RUN apt-get update && apt-get install -y ca-certificates gnupg lsb-release curl # Install Postgres for CLI tools, needed specifically for DB backups RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ diff --git a/core/chainlink.goreleaser.Dockerfile b/core/chainlink.goreleaser.Dockerfile index 364b7c81765..7774c416f0e 100644 --- a/core/chainlink.goreleaser.Dockerfile +++ b/core/chainlink.goreleaser.Dockerfile @@ -18,9 +18,12 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ COPY ./chainlink /usr/local/bin/ # Copy native libs if cgo is enabled COPY ./tmp/linux_${TARGETARCH}/libs /usr/local/bin/libs + +# Temp fix to patch correctly link the libwasmvm.so COPY ./tools/bin/ldd_fix /usr/local/bin/ldd_fix RUN chmod +x /usr/local/bin/ldd_fix RUN /usr/local/bin/ldd_fix +RUN apt-get remove -y patchelf RUN if [ ${CHAINLINK_USER} != root ]; then \ useradd --uid 14933 --create-home ${CHAINLINK_USER}; \ diff --git a/tools/bin/ldd_fix b/tools/bin/ldd_fix index 59e159997a1..6a5ee176748 100755 --- a/tools/bin/ldd_fix +++ b/tools/bin/ldd_fix @@ -1,4 +1,7 @@ #!/bin/bash +# This script is used as a temp fix the ldd linking of cosm lib for binary +# Currently there is an issue with the go linker not working with zig +# https://github.com/ziglang/zig/issues/18922 chainlink_path="/usr/local/bin/chainlink" libs_path="/usr/local/bin/libs" From 22561766281784c7b4d8312689caa14e2b67988d Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Thu, 15 Feb 2024 19:49:38 -0600 Subject: [PATCH 38/40] update go.mod version --- core/scripts/go.mod | 2 +- integration-tests/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index b09e87a7624..f42b766fdf8 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/core/scripts -go 1.21.3 +go 1.21.5 // Make sure we're working with the latest chainlink libs replace github.com/smartcontractkit/chainlink/v2 => ../../ diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 366594098ec..fbb1bebff79 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/integration-tests -go 1.21.4 +go 1.21.5 // Make sure we're working with the latest chainlink libs replace github.com/smartcontractkit/chainlink/v2 => ../ From 5045eee0cd136725bfadb7694ad72081a50cbaf5 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 16 Feb 2024 07:58:31 -0600 Subject: [PATCH 39/40] update go.mod to 1.21.7 for core/scripts --- core/scripts/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 8f460ddb783..39d7b1e6aee 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/core/scripts -go 1.21.5 +go 1.21.7 // Make sure we're working with the latest chainlink libs replace github.com/smartcontractkit/chainlink/v2 => ../../ From eece142bb11e5362b2174d32f95cdaea6f6c8fc0 Mon Sep 17 00:00:00 2001 From: Frank Zhu Date: Fri, 16 Feb 2024 14:09:59 -0600 Subject: [PATCH 40/40] update all go.mod to 1.21.7 and remove artifact outputs --- .../actions/goreleaser-build-sign-publish/action_utils | 8 -------- .tool-versions | 2 +- go.mod | 2 +- integration-tests/.tool-versions | 2 +- integration-tests/go.mod | 2 +- tools/bin/ldd_fix | 2 +- 6 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/actions/goreleaser-build-sign-publish/action_utils b/.github/actions/goreleaser-build-sign-publish/action_utils index 4f8d609a6a0..4aac78d6fcc 100755 --- a/.github/actions/goreleaser-build-sign-publish/action_utils +++ b/.github/actions/goreleaser-build-sign-publish/action_utils @@ -71,14 +71,6 @@ goreleaser_release() { rm -rf cosign.pub rm -rf cosign.key fi - - delimiter="$(openssl rand -hex 8)" - echo "metadata<<${delimiter}" >> "$GITHUB_OUTPUT" - echo "metadata=$(cat dist/metadata.json)" >> "$GITHUB_OUTPUT" - echo "${delimiter}" >> "$GITHUB_OUTPUT" - echo "artifacts<<${delimiter}" >> "$GITHUB_OUTPUT" - echo "artifacts=$(cat dist/artifacts.json)" >> "$GITHUB_OUTPUT" - echo "${delimiter}" >> "$GITHUB_OUTPUT" } "$@" diff --git a/.tool-versions b/.tool-versions index dc5f761daf3..b3c9c6c56da 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ -golang 1.21.5 +golang 1.21.7 mockery 2.38.0 nodejs 16.16.0 postgres 13.3 diff --git a/go.mod b/go.mod index 3b99faa8b10..aeb15959c31 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/v2 -go 1.21.5 +go 1.21.7 require ( github.com/Depado/ginprom v1.8.0 diff --git a/integration-tests/.tool-versions b/integration-tests/.tool-versions index ac6300f9797..7f84d58b918 100644 --- a/integration-tests/.tool-versions +++ b/integration-tests/.tool-versions @@ -1,4 +1,4 @@ -golang 1.21.5 +golang 1.21.7 k3d 5.4.6 kubectl 1.25.5 nodejs 18.13.0 diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 6f089bb4f5d..0284c3d4ee1 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -1,6 +1,6 @@ module github.com/smartcontractkit/chainlink/integration-tests -go 1.21.5 +go 1.21.7 // Make sure we're working with the latest chainlink libs replace github.com/smartcontractkit/chainlink/v2 => ../ diff --git a/tools/bin/ldd_fix b/tools/bin/ldd_fix index 6a5ee176748..dd48e9c3b30 100755 --- a/tools/bin/ldd_fix +++ b/tools/bin/ldd_fix @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script is used as a temp fix the ldd linking of cosm lib for binary # Currently there is an issue with the go linker not working with zig # https://github.com/ziglang/zig/issues/18922