Skip to content

Commit

Permalink
CRIB 462 update go releaser dev space to work with latest changes (#1…
Browse files Browse the repository at this point in the history
…4645)

* Generate devspace config

* Use goreleaser pro in nix

* Regenerate devspace file

* Support m1 macos -> linux_arm64 cross compilation

* Codify documentation requirements

* Sink grep output

* Cleanup nix flake

* Generate devspace config

* Use goreleaser pro in nix

* Regenerate devspace file

* Support m1 macos -> linux_arm64 cross compilation

* Codify documentation requirements

* Sink grep output

* Cleanup nix flake

* Patch ELFs for chainlink LOOPPs

* Explicitly enable CGO

* Set CGO_ENABLED globally

* Add patchelf to nix shell for crib

* Address feedback

* Fix brew prefix

---------

Co-authored-by: chainchad <[email protected]>
  • Loading branch information
HenryNguyen5 and chainchad authored Oct 11, 2024
1 parent 770d2bc commit 4fb06b4
Show file tree
Hide file tree
Showing 10 changed files with 295 additions and 122 deletions.
20 changes: 11 additions & 9 deletions .goreleaser.develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project_name: chainlink
env:
- IMG_PRE={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }}
- IMG_TAG={{ if index .Env "IMAGE_TAG" }}{{ .Env.IMAGE_TAG }}{{ else }}develop{{ end }}
- CGO_ENABLED=1
- VERSION={{ if index .Env "CHAINLINK_VERSION" }}{{ .Env.CHAINLINK_VERSION }}{{ else }}v0.0.0-local{{ end }}
release:
disable: "true"
Expand All @@ -16,8 +17,9 @@ builds:
no_unique_dist_dir: "true"
ldflags:
- -s -w -r=$ORIGIN/libs
- -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.VERSION }}
- -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }}
- -extldflags "-Wl,--dynamic-linker=/lib{{ if contains .Runtime.Goarch "amd64" }}64{{end}}/ld-linux-{{ if contains .Runtime.Goarch "arm64" }}aarch64{{ else }}x86-64{{end}}.so.1"
- -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.VERSION }}
flags:
- -trimpath
- -buildmode=pie
Expand Down Expand Up @@ -49,8 +51,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-amd64-chainlink-plugins
goos: linux
Expand Down Expand Up @@ -78,8 +80,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-chainlink
goos: linux
Expand All @@ -101,8 +103,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-chainlink-plugins
goos: linux
Expand All @@ -129,8 +131,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-amd64-ccip
goos: linux
Expand All @@ -155,8 +157,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-amd64-ccip-plugins
goos: linux
Expand Down Expand Up @@ -186,8 +188,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-ccip
goos: linux
Expand All @@ -211,8 +213,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-ccip-plugins
goos: linux
Expand Down Expand Up @@ -241,8 +243,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
docker_manifests:
- id: tagged-chainlink
Expand Down
174 changes: 91 additions & 83 deletions .goreleaser.devspace.yaml
Original file line number Diff line number Diff line change
@@ -1,89 +1,97 @@
project_name: chainlink-devspace

version: 2

project_name: chainlink
env:
- ZIG_EXEC={{ if index .Env "ZIG_EXEC" }}{{ .Env.ZIG_EXEC }}{{ else }}zig{{ 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/
- IMG_PRE={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }}
- IMG_TAG={{ if index .Env "IMAGE_TAG" }}{{ .Env.IMAGE_TAG }}{{ else }}develop{{ end }}
- CGO_ENABLED=1
release:
disable: "true"
builds:
- binary: chainlink
id: linux-amd64
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 -Wno-error=unused-command-line-argument
- CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -Wno-error=unused-command-line-argument
flags:
- -trimpath
- -buildmode=pie
ldflags:
- -s -w -r=$ORIGIN/libs
- -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Version }}
- -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }}

# See https://goreleaser.com/customization/docker/
- targets:
- go_first_class
binary: chainlink
hooks:
post:
- cmd: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }}
no_unique_dist_dir: "true"
ldflags:
- -s -w -r=$ORIGIN/libs
- -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }}
- -extldflags "-Wl,--dynamic-linker=/lib{{ if contains .Runtime.Goarch "amd64" }}64{{end}}/ld-linux-{{ if contains .Runtime.Goarch "arm64" }}aarch64{{ else }}x86-64{{end}}.so.1"
- -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Version }}
flags:
- -trimpath
- -buildmode=pie
archives:
- format: binary
snapshot:
version_template: v0.0.0-{{ .Runtime.Goarch }}-{{ .Now.Format "2006-01-02-15-04-05Z" }}
checksum:
name_template: checksums.txt
dockers:
- id: linux-amd64
dockerfile: core/chainlink.goreleaser.Dockerfile
use: buildx
goos: linux
goarch: amd64
extra_files:
- tmp/linux_amd64/libs
- tmp/linux_amd64/plugins
- tools/bin/ldd_fix
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
- "--build-arg=CHAINLINK_USER=chainlink"
- "--build-arg=COMMIT_SHA={{ .FullCommit }}"
- "--build-arg=CL_MEDIAN_CMD=chainlink-feeds"
- "--build-arg=CL_MERCURY_CMD=chainlink-mercury"
- "--build-arg=CL_SOLANA_CMD=chainlink-solana"
- "--build-arg=CL_STARKNET_CMD=chainlink-starknet"
- "--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={{ .Version }}"
- "--label=org.opencontainers.image.url={{ .Env.IMAGE_LABEL_SOURCE }}"
image_templates:
- "{{ .Env.IMAGE }}"

# See https://goreleaser.com/customization/docker_manifest/
- id: linux-amd64
goos: linux
goarch: amd64
dockerfile: core/chainlink.goreleaser.Dockerfile
image_templates:
- '{{ .Env.IMAGE }}'
extra_files:
- tmp/libs
- tmp/plugins
build_flag_templates:
- --platform=linux/amd64
- --pull
- --build-arg=CHAINLINK_USER=chainlink
- --build-arg=COMMIT_SHA={{ .FullCommit }}
- --build-arg=CL_MEDIAN_CMD=chainlink-feeds
- --build-arg=CL_MERCURY_CMD=chainlink-mercury
- --build-arg=CL_SOLANA_CMD=chainlink-solana
- --build-arg=CL_STARKNET_CMD=chainlink-starknet
- --label=org.opencontainers.image.created={{ .Date }}
- --label=org.opencontainers.image.description="node of the decentralized oracle network, bridging on and off-chain computation"
- --label=org.opencontainers.image.licenses=MIT
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
use: buildx
- id: linux-arm64
goos: linux
goarch: arm64
dockerfile: core/chainlink.goreleaser.Dockerfile
image_templates:
- '{{ .Env.IMAGE }}'
extra_files:
- tmp/libs
- tmp/plugins
build_flag_templates:
- --platform=linux/arm64
- --pull
- --build-arg=CHAINLINK_USER=chainlink
- --build-arg=COMMIT_SHA={{ .FullCommit }}
- --build-arg=CL_MEDIAN_CMD=chainlink-feeds
- --build-arg=CL_MERCURY_CMD=chainlink-mercury
- --build-arg=CL_SOLANA_CMD=chainlink-solana
- --build-arg=CL_STARKNET_CMD=chainlink-starknet
- --label=org.opencontainers.image.created={{ .Date }}
- --label=org.opencontainers.image.description="node of the decentralized oracle network, bridging on and off-chain computation"
- --label=org.opencontainers.image.licenses=MIT
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
use: buildx
docker_manifests:
- name_template: "{{ .Env.IMAGE }}"
image_templates:
- "{{ .Env.IMAGE }}"

checksum:
name_template: "checksums.txt"

snapshot:
version_template: '{{ .Env.CHAINLINK_VERSION }}-{{ .Runtime.Goarch }}-{{ .Now.Format "2006-01-02-15-04-05Z" }}'

- name_template: '{{ .Env.IMAGE }}'
image_templates:
- '{{ .Env.IMAGE }}'
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
disable: "true"
before:
hooks:
- cmd: go mod tidy
- cmd: ./tools/bin/goreleaser_utils before_hook
partial:
by: target
nightly:
version_template: v0.0.0-{{ .Runtime.Goarch }}-{{ .Now.Format "2006-01-02-15-04-05Z" }}
20 changes: 11 additions & 9 deletions .goreleaser.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project_name: chainlink
env:
- IMG_PRE={{ if index .Env "IMAGE_PREFIX" }}{{ .Env.IMAGE_PREFIX }}{{ else }}localhost:5001{{ end }}
- IMG_TAG={{ if index .Env "IMAGE_TAG" }}{{ .Env.IMAGE_TAG }}{{ else }}develop{{ end }}
- CGO_ENABLED=1
- VERSION={{ if index .Env "CHAINLINK_VERSION" }}{{ .Env.CHAINLINK_VERSION }}{{ else }}v0.0.0-local{{ end }}
release:
disable: "true"
Expand All @@ -16,8 +17,9 @@ builds:
no_unique_dist_dir: "true"
ldflags:
- -s -w -r=$ORIGIN/libs
- -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.VERSION }}
- -X github.com/smartcontractkit/chainlink/v2/core/static.Sha={{ .FullCommit }}
- -extldflags "-Wl,--dynamic-linker=/lib{{ if contains .Runtime.Goarch "amd64" }}64{{end}}/ld-linux-{{ if contains .Runtime.Goarch "arm64" }}aarch64{{ else }}x86-64{{end}}.so.1"
- -X github.com/smartcontractkit/chainlink/v2/core/static.Version={{ .Env.VERSION }}
flags:
- -trimpath
- -buildmode=pie
Expand Down Expand Up @@ -50,8 +52,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-amd64-chainlink-plugins
goos: linux
Expand Down Expand Up @@ -80,8 +82,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-chainlink
goos: linux
Expand All @@ -104,8 +106,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-chainlink-plugins
goos: linux
Expand Down Expand Up @@ -133,8 +135,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-amd64-ccip
goos: linux
Expand All @@ -160,8 +162,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-amd64-ccip-plugins
goos: linux
Expand Down Expand Up @@ -192,8 +194,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-ccip
goos: linux
Expand All @@ -218,8 +220,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
- id: linux-arm64-ccip-plugins
goos: linux
Expand Down Expand Up @@ -249,8 +251,8 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.title=chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
- --label=org.opencontainers.image.url=https://github.com/smartcontractkit/chainlink
- --label=org.opencontainers.image.version={{ .Env.VERSION }}
use: buildx
docker_manifests:
- id: tagged-chainlink-chainlink-experimental-goreleaser
Expand Down
Loading

0 comments on commit 4fb06b4

Please sign in to comment.