github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/Makefile (about) 1 # The short Git commit hash 2 SHORT_COMMIT := $(shell git rev-parse --short HEAD) 3 BRANCH_NAME:=$(shell git rev-parse --abbrev-ref HEAD | tr '/' '-') 4 # The Git commit hash 5 COMMIT := $(shell git rev-parse HEAD) 6 # The tag of the current commit, otherwise empty 7 VERSION := $(shell git describe --tags --abbrev=2 --match "v*" --match "secure-cadence*" 2>/dev/null) 8 9 # By default, this will run all tests in all packages, but we have a way to override this in CI so that we can 10 # dynamically split up CI jobs into smaller jobs that can be run in parallel 11 GO_TEST_PACKAGES := ./... 12 13 # Image tag: if image tag is not set, set it with version (or short commit if empty) 14 ifeq (${IMAGE_TAG},) 15 IMAGE_TAG := ${VERSION} 16 endif 17 18 ifeq (${IMAGE_TAG},) 19 IMAGE_TAG := ${SHORT_COMMIT} 20 endif 21 22 IMAGE_TAG_NO_ADX := $(IMAGE_TAG)-without-adx 23 IMAGE_TAG_NO_NETGO_NO_ADX := $(IMAGE_TAG)-without-netgo-without-adx 24 IMAGE_TAG_ARM := $(IMAGE_TAG)-arm 25 26 # Name of the cover profile 27 COVER_PROFILE := coverage.txt 28 # Disable go sum database lookup for private repos 29 GOPRIVATE=github.com/dapperlabs/* 30 # OS 31 UNAME := $(shell uname) 32 33 # Used when building within docker 34 GOARCH := $(shell go env GOARCH) 35 36 # The location of the k8s YAML files 37 K8S_YAMLS_LOCATION_STAGING=./k8s/staging 38 39 40 # docker container registry 41 export CONTAINER_REGISTRY := gcr.io/flow-container-registry 42 export DOCKER_BUILDKIT := 1 43 44 # set `CRYPTO_FLAG` when building natively (not cross-compiling) 45 include crypto_adx_flag.mk 46 47 # needed for CI 48 .PHONY: noop 49 noop: 50 @echo "This is a no-op target" 51 52 cmd/collection/collection: 53 CGO_CFLAGS=$(CRYPTO_FLAG) go build -o cmd/collection/collection cmd/collection/main.go 54 55 cmd/util/util: 56 CGO_CFLAGS=$(CRYPTO_FLAG) go build -o cmd/util/util cmd/util/main.go 57 58 .PHONY: update-core-contracts-version 59 update-core-contracts-version: 60 # updates the core-contracts version in all of the go.mod files 61 # usage example: CC_VERSION=0.16.0 make update-core-contracts-version 62 ./scripts/update-core-contracts.sh $(CC_VERSION) 63 make tidy 64 65 .PHONY: update-cadence-version 66 update-cadence-version: 67 # updates the cadence version in all of the go.mod files 68 # usage example: CC_VERSION=0.16.0 make update-cadence-version 69 ./scripts/update-cadence.sh $(CC_VERSION) 70 make tidy 71 72 .PHONY: unittest-main 73 unittest-main: 74 # test all packages 75 CGO_CFLAGS=$(CRYPTO_FLAG) go test $(if $(VERBOSE),-v,) -coverprofile=$(COVER_PROFILE) -covermode=atomic $(if $(RACE_DETECTOR),-race,) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) $(GO_TEST_PACKAGES) 76 77 .PHONY: install-mock-generators 78 install-mock-generators: 79 cd ${GOPATH}; \ 80 go install github.com/vektra/mockery/v2@v2.21.4; \ 81 go install github.com/golang/mock/mockgen@v1.6.0; 82 83 .PHONY: install-tools 84 install-tools: check-go-version install-mock-generators 85 cd ${GOPATH}; \ 86 go install github.com/golang/protobuf/protoc-gen-go@v1.3.2; \ 87 go install github.com/uber/prototool/cmd/prototool@v1.9.0; \ 88 go install github.com/gogo/protobuf/protoc-gen-gofast@latest; \ 89 go install golang.org/x/tools/cmd/stringer@master; 90 91 .PHONY: verify-mocks 92 verify-mocks: tidy generate-mocks 93 git diff --exit-code 94 95 .SILENT: go-math-rand-check 96 go-math-rand-check: 97 # check that the insecure math/rand Go package isn't used by production code. 98 # `exclude` should only specify non production code (test, bench..). 99 # If this check fails, try updating your code by using: 100 # - "crypto/rand" or "flow-go/utils/rand" for non-deterministic randomness 101 # - "onflow/crypto/random" for deterministic randomness 102 grep --include=\*.go \ 103 --exclude=*test* --exclude=*helper* --exclude=*example* --exclude=*fixture* --exclude=*benchmark* --exclude=*profiler* \ 104 --exclude-dir=*test* --exclude-dir=*helper* --exclude-dir=*example* --exclude-dir=*fixture* --exclude-dir=*benchmark* --exclude-dir=*profiler* -rnw '"math/rand"'; \ 105 if [ $$? -ne 1 ]; then \ 106 echo "[Error] Go production code should not use math/rand package"; exit 1; \ 107 fi 108 109 .PHONY: code-sanity-check 110 code-sanity-check: go-math-rand-check 111 112 .PHONY: fuzz-fvm 113 fuzz-fvm: 114 # run fuzz tests in the fvm package 115 cd ./fvm && CGO_CFLAGS=$(CRYPTO_FLAG) go test -fuzz=Fuzz -run ^$$ 116 117 .PHONY: test 118 test: verify-mocks unittest-main 119 120 .PHONY: integration-test 121 integration-test: docker-native-build-flow 122 $(MAKE) -C integration integration-test 123 124 .PHONY: benchmark 125 benchmark: docker-native-build-flow 126 $(MAKE) -C integration benchmark 127 128 .PHONY: coverage 129 coverage: 130 ifeq ($(COVER), true) 131 # Cover summary has to produce cover.json 132 COVER_PROFILE=$(COVER_PROFILE) ./cover-summary.sh 133 # file has to be called index.html 134 gocov-html cover.json > index.html 135 # coverage.zip will automatically be picked up by teamcity 136 zip coverage.zip index.html 137 endif 138 139 .PHONY: generate-openapi 140 generate-openapi: 141 swagger-codegen generate -l go -i https://raw.githubusercontent.com/onflow/flow/master/openapi/access.yaml -D packageName=models,modelDocs=false,models -o engine/access/rest/models; 142 go fmt ./engine/access/rest/models 143 144 .PHONY: generate 145 generate: generate-proto generate-mocks generate-fvm-env-wrappers 146 147 .PHONY: generate-proto 148 generate-proto: 149 prototool generate protobuf 150 151 .PHONY: generate-fvm-env-wrappers 152 generate-fvm-env-wrappers: 153 CGO_CFLAGS=$(CRYPTO_FLAG) go run ./fvm/environment/generate-wrappers fvm/environment/parse_restricted_checker.go 154 155 .PHONY: generate-mocks 156 generate-mocks: install-mock-generators 157 mockery --name '(Connector|PingInfoProvider)' --dir=network/p2p --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork" 158 CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=storage/mocks/storage.go -package=mocks github.com/onflow/flow-go/storage Blocks,Headers,Payloads,Collections,Commits,Events,ServiceEvents,TransactionResults 159 CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=network/mocknetwork/mock_network.go -package=mocknetwork github.com/onflow/flow-go/network EngineRegistry 160 mockery --name=ExecutionDataStore --dir=module/executiondatasync/execution_data --case=underscore --output="./module/executiondatasync/execution_data/mock" --outpkg="mock" 161 mockery --name=Downloader --dir=module/executiondatasync/execution_data --case=underscore --output="./module/executiondatasync/execution_data/mock" --outpkg="mock" 162 mockery --name='.*' --dir=integration/benchmark/mocksiface --case=underscore --output="integration/benchmark/mock" --outpkg="mock" 163 mockery --name '(ExecutionDataRequester|IndexReporter)' --dir=module/state_synchronization --case=underscore --output="./module/state_synchronization/mock" --outpkg="state_synchronization" 164 mockery --name 'ExecutionState' --dir=engine/execution/state --case=underscore --output="engine/execution/state/mock" --outpkg="mock" 165 mockery --name 'BlockComputer' --dir=engine/execution/computation/computer --case=underscore --output="engine/execution/computation/computer/mock" --outpkg="mock" 166 mockery --name 'ComputationManager' --dir=engine/execution/computation --case=underscore --output="engine/execution/computation/mock" --outpkg="mock" 167 mockery --name '.*' --dir=engine/execution/computation/query --case=underscore --output="engine/execution/computation/query/mock" --outpkg="mock" 168 mockery --name 'EpochComponentsFactory' --dir=engine/collection/epochmgr --case=underscore --output="engine/collection/epochmgr/mock" --outpkg="mock" 169 mockery --name '.*' --dir=engine/execution/ --case=underscore --output="engine/execution/mock" --outpkg="mock" 170 mockery --name 'Backend' --dir=engine/collection/rpc --case=underscore --output="engine/collection/rpc/mock" --outpkg="mock" 171 mockery --name 'ProviderEngine' --dir=engine/execution/provider --case=underscore --output="engine/execution/provider/mock" --outpkg="mock" 172 mockery --name '.*' --dir=state/cluster --case=underscore --output="state/cluster/mock" --outpkg="mock" 173 mockery --name '.*' --dir=module --case=underscore --output="./module/mock" --outpkg="mock" 174 mockery --name '.*' --dir=module/mempool --case=underscore --output="./module/mempool/mock" --outpkg="mempool" 175 mockery --name '.*' --dir=module/component --case=underscore --output="./module/component/mock" --outpkg="component" 176 mockery --name '.*' --dir=network --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork" 177 mockery --name '.*' --dir=storage --case=underscore --output="./storage/mock" --outpkg="mock" 178 mockery --name 'DeferredDBUpdate' --dir=storage/badger/transaction --case=underscore --output="storage/mock" --outpkg="mock" 179 mockery --name '.*' --dir="state/protocol" --case=underscore --output="state/protocol/mock" --outpkg="mock" 180 mockery --name '.*' --dir="state/protocol/events" --case=underscore --output="./state/protocol/events/mock" --outpkg="mock" 181 mockery --name '.*' --dir="state/protocol/protocol_state" --case=underscore --output="state/protocol/protocol_state/mock" --outpkg="mock" 182 mockery --name '.*' --dir="state/protocol/protocol_state/epochs" --case=underscore --output="state/protocol/protocol_state/epochs/mock" --outpkg="mock" 183 mockery --name '.*' --dir=engine/execution/computation/computer --case=underscore --output="./engine/execution/computation/computer/mock" --outpkg="mock" 184 mockery --name '.*' --dir=engine/execution/state --case=underscore --output="./engine/execution/state/mock" --outpkg="mock" 185 mockery --name '.*' --dir=engine/collection --case=underscore --output="./engine/collection/mock" --outpkg="mock" 186 mockery --name 'complianceCore' --dir=engine/common/follower --exported --case=underscore --output="./engine/common/follower/mock" --outpkg="mock" 187 mockery --name '.*' --dir=engine/common/follower/cache --case=underscore --output="./engine/common/follower/cache/mock" --outpkg="mock" 188 mockery --name '.*' --dir=engine/consensus --case=underscore --output="./engine/consensus/mock" --outpkg="mock" 189 mockery --name '.*' --dir=engine/consensus/approvals --case=underscore --output="./engine/consensus/approvals/mock" --outpkg="mock" 190 rm -rf ./fvm/mock 191 mockery --name '.*' --dir=fvm --case=underscore --output="./fvm/mock" --outpkg="mock" 192 rm -rf ./fvm/environment/mock 193 mockery --name '.*' --dir=fvm/environment --case=underscore --output="./fvm/environment/mock" --outpkg="mock" 194 mockery --name '.*' --dir=ledger --case=underscore --output="./ledger/mock" --outpkg="mock" 195 mockery --name 'ViolationsConsumer' --dir=network --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork" 196 mockery --name '.*' --dir=network/p2p/ --case=underscore --output="./network/p2p/mock" --outpkg="mockp2p" 197 mockery --name '.*' --dir=network/alsp --case=underscore --output="./network/alsp/mock" --outpkg="mockalsp" 198 mockery --name 'Vertex' --dir="./module/forest" --case=underscore --output="./module/forest/mock" --outpkg="mock" 199 mockery --name '.*' --dir="./consensus/hotstuff" --case=underscore --output="./consensus/hotstuff/mocks" --outpkg="mocks" 200 mockery --name '.*' --dir="./engine/access/wrapper" --case=underscore --output="./engine/access/mock" --outpkg="mock" 201 mockery --name 'API' --dir="./access" --case=underscore --output="./access/mock" --outpkg="mock" 202 mockery --name 'API' --dir="./engine/protocol" --case=underscore --output="./engine/protocol/mock" --outpkg="mock" 203 mockery --name '.*' --dir="./engine/access/state_stream" --case=underscore --output="./engine/access/state_stream/mock" --outpkg="mock" 204 mockery --name 'BlockTracker' --dir="./engine/access/subscription" --case=underscore --output="./engine/access/subscription/mock" --outpkg="mock" 205 mockery --name 'ExecutionDataTracker' --dir="./engine/access/subscription" --case=underscore --output="./engine/access/subscription/mock" --outpkg="mock" 206 mockery --name 'ConnectionFactory' --dir="./engine/access/rpc/connection" --case=underscore --output="./engine/access/rpc/connection/mock" --outpkg="mock" 207 mockery --name 'Communicator' --dir="./engine/access/rpc/backend" --case=underscore --output="./engine/access/rpc/backend/mock" --outpkg="mock" 208 209 mockery --name '.*' --dir=model/fingerprint --case=underscore --output="./model/fingerprint/mock" --outpkg="mock" 210 mockery --name 'ExecForkActor' --structname 'ExecForkActorMock' --dir=module/mempool/consensus/mock/ --case=underscore --output="./module/mempool/consensus/mock/" --outpkg="mock" 211 mockery --name '.*' --dir=engine/verification/fetcher/ --case=underscore --output="./engine/verification/fetcher/mock" --outpkg="mockfetcher" 212 mockery --name '.*' --dir=./cmd/util/ledger/reporters --case=underscore --output="./cmd/util/ledger/reporters/mock" --outpkg="mock" 213 mockery --name 'Storage' --dir=module/executiondatasync/tracker --case=underscore --output="module/executiondatasync/tracker/mock" --outpkg="mocktracker" 214 mockery --name 'ScriptExecutor' --dir=module/execution --case=underscore --output="module/execution/mock" --outpkg="mock" 215 mockery --name 'StorageSnapshot' --dir=fvm/storage/snapshot --case=underscore --output="fvm/storage/snapshot/mock" --outpkg="mock" 216 217 #temporarily make insecure/ a non-module to allow mockery to create mocks 218 mv insecure/go.mod insecure/go2.mod 219 if [ -f go.work ]; then mv go.work go2.work; fi 220 mockery --name '.*' --dir=insecure/ --case=underscore --output="./insecure/mock" --outpkg="mockinsecure" 221 mv insecure/go2.mod insecure/go.mod 222 if [ -f go2.work ]; then mv go2.work go.work; fi 223 224 # this ensures there is no unused dependency being added by accident 225 .PHONY: tidy 226 tidy: 227 go mod tidy -v 228 cd integration; go mod tidy -v 229 cd crypto; go mod tidy -v 230 cd cmd/testclient; go mod tidy -v 231 cd insecure; go mod tidy -v 232 git diff --exit-code 233 234 .PHONY: lint 235 lint: tidy 236 # revive -config revive.toml -exclude storage/ledger/trie ./... 237 golangci-lint run -v ./... 238 239 .PHONY: fix-lint 240 fix-lint: 241 # revive -config revive.toml -exclude storage/ledger/trie ./... 242 golangci-lint run -v --fix ./... 243 244 # Runs unit tests with different list of packages as passed by CI so they run in parallel 245 .PHONY: ci 246 ci: install-tools test 247 248 # Runs integration tests 249 .PHONY: ci-integration 250 ci-integration: 251 $(MAKE) -C integration integration-test 252 253 # Runs benchmark tests 254 # NOTE: we do not need `docker-native-build-flow` as this is run as a separate step 255 # on Teamcity 256 .PHONY: ci-benchmark 257 ci-benchmark: install-tools 258 $(MAKE) -C integration ci-benchmark 259 260 # Runs unit tests, test coverage, lint in Docker (for mac) 261 .PHONY: docker-ci 262 docker-ci: 263 docker run --env RACE_DETECTOR=$(RACE_DETECTOR) --env COVER=$(COVER) --env JSON_OUTPUT=$(JSON_OUTPUT) \ 264 -v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" \ 265 -v "$(CURDIR)":/go/flow -v "/tmp/.cache":"/root/.cache" -v "/tmp/pkg":"/go/pkg" \ 266 -w "/go/flow" "$(CONTAINER_REGISTRY)/golang-cmake:v0.0.7" \ 267 make ci 268 269 # Runs integration tests in Docker (for mac) 270 .PHONY: docker-ci-integration 271 docker-ci-integration: 272 docker run \ 273 --env DOCKER_API_VERSION='1.39' \ 274 --network host \ 275 -v "$(CURDIR)":/go/flow -v "/tmp/.cache":"/root/.cache" -v "/tmp/pkg":"/go/pkg" \ 276 -v /tmp:/tmp \ 277 -v /var/run/docker.sock:/var/run/docker.sock \ 278 -v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" \ 279 -w "/go/flow" "$(CONTAINER_REGISTRY)/golang-cmake:v0.0.7" \ 280 make ci-integration 281 282 # only works on Debian 283 .SILENT: install-cross-build-tools 284 install-cross-build-tools: 285 if [ "$(UNAME)" = "Debian" ] ; then \ 286 apt-get update && apt-get -y install apt-utils gcc-aarch64-linux-gnu ; \ 287 elif [ "$(UNAME)" = "Linux" ] ; then \ 288 apt-get update && apt-get -y install apt-utils gcc-aarch64-linux-gnu ; \ 289 else \ 290 echo "this target only works on Debian or Linux, host runs on" $(UNAME) ; \ 291 fi 292 293 .PHONY: docker-native-build-collection 294 docker-native-build-collection: 295 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/collection --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 296 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 297 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 298 -t "$(CONTAINER_REGISTRY)/collection:latest" \ 299 -t "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG)" . 300 301 .PHONY: docker-build-collection-with-adx 302 docker-build-collection-with-adx: 303 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/collection --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=amd64 --target production \ 304 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 305 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG)" \ 306 -t "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG)" . 307 308 .PHONY: docker-build-collection-without-adx 309 docker-build-collection-without-adx: 310 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/collection --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_ADX) --build-arg GOARCH=amd64 --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 311 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 312 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_ADX)" \ 313 -t "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG_NO_ADX)" . 314 315 .PHONY: docker-build-collection-without-netgo-without-adx 316 docker-build-collection-without-netgo-without-adx: 317 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/collection --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_NETGO_NO_ADX) --build-arg GOARCH=amd64 --build-arg TAGS="" --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 318 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 319 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_NETGO_NO_ADX)" \ 320 -t "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG_NO_NETGO_NO_ADX)" . 321 322 .PHONY: docker-cross-build-collection-arm 323 docker-cross-build-collection-arm: 324 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/collection --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_ARM) --build-arg CC=aarch64-linux-gnu-gcc --build-arg GOARCH=arm64 --target production \ 325 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 326 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_ARM)" \ 327 -t "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG_ARM)" . 328 329 .PHONY: docker-native-build-collection-debug 330 docker-native-build-collection-debug: 331 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/collection --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target debug \ 332 -t "$(CONTAINER_REGISTRY)/collection-debug:latest" \ 333 -t "$(CONTAINER_REGISTRY)/collection-debug:$(IMAGE_TAG)" . 334 335 .PHONY: docker-native-build-consensus 336 docker-native-build-consensus: 337 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/consensus --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 338 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 339 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 340 -t "$(CONTAINER_REGISTRY)/consensus:latest" \ 341 -t "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG)" . 342 343 .PHONY: docker-build-consensus-with-adx 344 docker-build-consensus-with-adx: 345 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/consensus --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=amd64 --target production \ 346 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 347 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG)" \ 348 -t "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG)" . 349 350 .PHONY: docker-build-consensus-without-adx 351 docker-build-consensus-without-adx: 352 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/consensus --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_ADX) --build-arg GOARCH=amd64 --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 353 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 354 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_ADX)" \ 355 -t "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG_NO_ADX)" . 356 357 .PHONY: docker-build-consensus-without-netgo-without-adx 358 docker-build-consensus-without-netgo-without-adx: 359 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/consensus --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_NETGO_NO_ADX) --build-arg GOARCH=amd64 --build-arg TAGS="" --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 360 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 361 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_NETGO_NO_ADX)" \ 362 -t "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG_NO_NETGO_NO_ADX)" . 363 364 .PHONY: docker-cross-build-consensus-arm 365 docker-cross-build-consensus-arm: 366 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/consensus --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_ARM) --build-arg GOARCH=arm64 --build-arg CC=aarch64-linux-gnu-gcc --target production \ 367 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 368 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG_ARM}" \ 369 -t "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG_ARM)" . 370 371 372 .PHONY: docker-native-build-consensus-debug 373 docker-build-native-consensus-debug: 374 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/consensus --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target debug \ 375 -t "$(CONTAINER_REGISTRY)/consensus-debug:latest" \ 376 -t "$(CONTAINER_REGISTRY)/consensus-debug:$(IMAGE_TAG)" . 377 378 .PHONY: docker-native-build-execution 379 docker-native-build-execution: 380 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/execution --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 381 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 382 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 383 -t "$(CONTAINER_REGISTRY)/execution:latest" \ 384 -t "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG)" . 385 386 .PHONY: docker-build-execution-with-adx 387 docker-build-execution-with-adx: 388 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/execution --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=amd64 --target production \ 389 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 390 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG)" \ 391 -t "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG)" . 392 393 .PHONY: docker-build-execution-without-adx 394 docker-build-execution-without-adx: 395 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/execution --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_ADX) --build-arg GOARCH=amd64 --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 396 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 397 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_ADX)" \ 398 -t "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG_NO_ADX)" . 399 400 .PHONY: docker-build-execution-without-netgo-without-adx 401 docker-build-execution-without-netgo-without-adx: 402 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/execution --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_NETGO_NO_ADX) --build-arg GOARCH=amd64 --build-arg TAGS="" --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 403 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 404 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_NETGO_NO_ADX)" \ 405 -t "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG_NO_NETGO_NO_ADX)" . 406 407 .PHONY: docker-cross-build-execution-arm 408 docker-cross-build-execution-arm: 409 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/execution --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_ARM) --build-arg GOARCH=arm64 --build-arg CC=aarch64-linux-gnu-gcc --target production \ 410 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 411 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG_ARM}" \ 412 -t "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG_ARM)" . 413 414 .PHONY: docker-native-build-execution-debug 415 docker-native-build-execution-debug: 416 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/execution --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target debug \ 417 -t "$(CONTAINER_REGISTRY)/execution-debug:latest" \ 418 -t "$(CONTAINER_REGISTRY)/execution-debug:$(IMAGE_TAG)" . 419 420 # build corrupt execution node for BFT testing 421 .PHONY: docker-native-build-execution-corrupt 422 docker-native-build-execution-corrupt: 423 # temporarily make insecure/ a non-module to allow Docker to use corrupt builders there 424 ./insecure/cmd/mods_override.sh 425 docker build -f cmd/Dockerfile --build-arg TARGET=./insecure/cmd/execution --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 426 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 427 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 428 -t "$(CONTAINER_REGISTRY)/execution-corrupted:latest" \ 429 -t "$(CONTAINER_REGISTRY)/execution-corrupted:$(IMAGE_TAG)" . 430 ./insecure/cmd/mods_restore.sh 431 432 .PHONY: docker-native-build-verification 433 docker-native-build-verification: 434 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/verification --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 435 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 436 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 437 -t "$(CONTAINER_REGISTRY)/verification:latest" \ 438 -t "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG)" . 439 440 .PHONY: docker-build-verification-with-adx 441 docker-build-verification-with-adx: 442 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/verification --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=amd64 --target production \ 443 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 444 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG)" \ 445 -t "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG)" . 446 447 .PHONY: docker-build-verification-without-adx 448 docker-build-verification-without-adx: 449 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/verification --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_ADX) --build-arg GOARCH=amd64 --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 450 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 451 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_ADX)" \ 452 -t "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG_NO_ADX)" . 453 454 .PHONY: docker-build-verification-without-netgo-without-adx 455 docker-build-verification-without-netgo-without-adx: 456 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/verification --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_NETGO_NO_ADX) --build-arg GOARCH=amd64 --build-arg TAGS="" --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 457 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 458 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_NETGO_NO_ADX)" \ 459 -t "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG_NO_NETGO_NO_ADX)" . 460 461 .PHONY: docker-cross-build-verification-arm 462 docker-cross-build-verification-arm: 463 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/verification --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_ARM) --build-arg GOARCH=arm64 --build-arg CC=aarch64-linux-gnu-gcc --target production \ 464 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 465 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG_ARM}" \ 466 -t "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG_ARM)" . 467 468 .PHONY: docker-native-build-verification-debug 469 docker-native-build-verification-debug: 470 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/verification --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target debug \ 471 -t "$(CONTAINER_REGISTRY)/verification-debug:latest" \ 472 -t "$(CONTAINER_REGISTRY)/verification-debug:$(IMAGE_TAG)" . 473 474 # build corrupt verification node for BFT testing 475 .PHONY: docker-native-build-verification-corrupt 476 docker-native-build-verification-corrupt: 477 # temporarily make insecure/ a non-module to allow Docker to use corrupt builders there 478 ./insecure/cmd/mods_override.sh 479 docker build -f cmd/Dockerfile --build-arg TARGET=./insecure/cmd/verification --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 480 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 481 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 482 -t "$(CONTAINER_REGISTRY)/verification-corrupted:latest" \ 483 -t "$(CONTAINER_REGISTRY)/verification-corrupted:$(IMAGE_TAG)" . 484 ./insecure/cmd/mods_restore.sh 485 486 .PHONY: docker-native-build-access 487 docker-native-build-access: 488 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/access --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 489 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 490 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 491 -t "$(CONTAINER_REGISTRY)/access:latest" \ 492 -t "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG)" . 493 494 .PHONY: docker-build-access-with-adx 495 docker-build-access-with-adx: 496 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/access --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=amd64 --target production \ 497 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 498 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG)" \ 499 -t "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG)" . 500 501 .PHONY: docker-build-access-without-adx 502 docker-build-access-without-adx: 503 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/access --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_ADX) --build-arg GOARCH=amd64 --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 504 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 505 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_ADX)" \ 506 -t "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG_NO_ADX)" . 507 508 .PHONY: docker-build-access-without-netgo-without-adx 509 docker-build-access-without-netgo-without-adx: 510 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/access --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_NETGO_NO_ADX) --build-arg GOARCH=amd64 --build-arg TAGS="" --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 511 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 512 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_NETGO_NO_ADX)" \ 513 -t "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG_NO_NETGO_NO_ADX)" . 514 515 .PHONY: docker-cross-build-access-arm 516 docker-cross-build-access-arm: 517 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/access --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_ARM) --build-arg GOARCH=arm64 --build-arg CC=aarch64-linux-gnu-gcc --target production \ 518 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 519 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG_ARM}" \ 520 -t "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG_ARM)" . 521 522 523 .PHONY: docker-native-build-access-debug 524 docker-native-build-access-debug: 525 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/access --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target debug \ 526 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 527 -t "$(CONTAINER_REGISTRY)/access-debug:latest" \ 528 -t "$(CONTAINER_REGISTRY)/access-debug:$(IMAGE_TAG)" . 529 530 # build corrupt access node for BFT testing 531 .PHONY: docker-native-build-access-corrupt 532 docker-native-build-access-corrupt: 533 #temporarily make insecure/ a non-module to allow Docker to use corrupt builders there 534 ./insecure/cmd/mods_override.sh 535 docker build -f cmd/Dockerfile --build-arg TARGET=./insecure/cmd/access --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 536 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 537 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 538 -t "$(CONTAINER_REGISTRY)/access-corrupted:latest" \ 539 -t "$(CONTAINER_REGISTRY)/access-corrupted:$(IMAGE_TAG)" . 540 ./insecure/cmd/mods_restore.sh 541 542 .PHONY: docker-native-build-observer 543 docker-native-build-observer: 544 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/observer --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 545 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 546 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 547 -t "$(CONTAINER_REGISTRY)/observer:latest" \ 548 -t "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG)" . 549 550 .PHONY: docker-build-observer-with-adx 551 docker-build-observer-with-adx: 552 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/observer --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=amd64 --target production \ 553 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 554 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG)" \ 555 -t "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG)" . 556 557 .PHONY: docker-build-observer-without-adx 558 docker-build-observer-without-adx: 559 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/observer --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_ADX) --build-arg GOARCH=amd64 --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 560 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 561 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_ADX)" \ 562 -t "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG_NO_ADX)" . 563 564 .PHONY: docker-build-observer-without-netgo-without-adx 565 docker-build-observer-without-netgo-without-adx: 566 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/observer --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_NO_NETGO_NO_ADX) --build-arg GOARCH=amd64 --build-arg TAGS="" --build-arg CGO_FLAG=$(DISABLE_ADX) --target production \ 567 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 568 --label "git_commit=${COMMIT}" --label "git_tag=$(IMAGE_TAG_NO_NETGO_NO_ADX)" \ 569 -t "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG_NO_NETGO_NO_ADX)" . 570 571 .PHONY: docker-cross-build-observer-arm 572 docker-cross-build-observer-arm: 573 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/observer --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG_ARM) --build-arg GOARCH=arm64 --build-arg CC=aarch64-linux-gnu-gcc --target production \ 574 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 575 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG_ARM}" \ 576 -t "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG_ARM)" . 577 578 579 .PHONY: docker-native-build-ghost 580 docker-native-build-ghost: 581 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/ghost --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 582 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 583 --secret id=cadence_deploy_key,env=CADENCE_DEPLOY_KEY --build-arg GOPRIVATE=$(GOPRIVATE) \ 584 -t "$(CONTAINER_REGISTRY)/ghost:latest" \ 585 -t "$(CONTAINER_REGISTRY)/ghost:$(IMAGE_TAG)" . 586 587 .PHONY: docker-native-build-ghost-debug 588 docker-native-build-ghost-debug: 589 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/ghost --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(IMAGE_TAG) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target debug \ 590 -t "$(CONTAINER_REGISTRY)/ghost-debug:latest" \ 591 -t "$(CONTAINER_REGISTRY)/ghost-debug:$(IMAGE_TAG)" . 592 593 PHONY: docker-build-bootstrap 594 docker-build-bootstrap: 595 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/bootstrap --build-arg GOARCH=$(GOARCH) --build-arg VERSION=$(IMAGE_TAG) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 596 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 597 -t "$(CONTAINER_REGISTRY)/bootstrap:latest" \ 598 -t "$(CONTAINER_REGISTRY)/bootstrap:$(IMAGE_TAG)" . 599 600 PHONY: tool-bootstrap 601 tool-bootstrap: docker-build-bootstrap 602 docker container create --name bootstrap $(CONTAINER_REGISTRY)/bootstrap:latest;docker container cp bootstrap:/bin/app ./bootstrap;docker container rm bootstrap 603 604 .PHONY: docker-build-bootstrap-transit 605 docker-build-bootstrap-transit: 606 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/bootstrap/transit --build-arg COMMIT=$(COMMIT) --build-arg VERSION=$(VERSION) --build-arg GOARCH=$(GOARCH) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --no-cache \ 607 --target production \ 608 -t "$(CONTAINER_REGISTRY)/bootstrap-transit:latest" \ 609 -t "$(CONTAINER_REGISTRY)/bootstrap-transit:$(IMAGE_TAG)" . 610 611 PHONY: tool-transit 612 tool-transit: docker-build-bootstrap-transit 613 docker container create --name transit $(CONTAINER_REGISTRY)/bootstrap-transit:latest;docker container cp transit:/bin/app ./transit;docker container rm transit 614 615 .PHONY: docker-native-build-loader 616 docker-native-build-loader: 617 docker build -f ./integration/benchmark/cmd/manual/Dockerfile --build-arg TARGET=./benchmark/cmd/manual --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 618 --label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \ 619 -t "$(CONTAINER_REGISTRY)/loader:latest" \ 620 -t "$(CONTAINER_REGISTRY)/loader:$(IMAGE_TAG)" . 621 622 .PHONY: docker-native-build-flow 623 docker-native-build-flow: docker-native-build-collection docker-native-build-consensus docker-native-build-execution docker-native-build-verification docker-native-build-access docker-native-build-observer docker-native-build-ghost 624 625 .PHONY: docker-build-flow-with-adx 626 docker-build-flow-with-adx: docker-build-collection-with-adx docker-build-consensus-with-adx docker-build-execution-with-adx docker-build-verification-with-adx docker-build-access-with-adx docker-build-observer-with-adx 627 628 .PHONY: docker-build-flow-without-adx 629 docker-build-flow-without-adx: docker-build-collection-without-adx docker-build-consensus-without-adx docker-build-execution-without-adx docker-build-verification-without-adx docker-build-access-without-adx docker-build-observer-without-adx 630 631 .PHONY: docker-build-flow-without-netgo-without-adx 632 docker-build-flow-without-netgo-without-adx: docker-build-collection-without-netgo-without-adx docker-build-consensus-without-netgo-without-adx docker-build-execution-without-netgo-without-adx docker-build-verification-without-netgo-without-adx docker-build-access-without-netgo-without-adx docker-build-observer-without-netgo-without-adx 633 634 # in this target, images are arm64 (aarch64), are build with `netgo` and with `adx`. 635 # other arm64 images can be built without `netgo` or without `adx` 636 .PHONY: docker-cross-build-flow-arm 637 docker-cross-build-flow-arm: docker-cross-build-collection-arm docker-cross-build-consensus-arm docker-cross-build-execution-arm docker-cross-build-verification-arm docker-cross-build-access-arm docker-cross-build-observer-arm 638 639 .PHONY: docker-native-build-flow-corrupt 640 docker-native-build-flow-corrupt: docker-native-build-execution-corrupt docker-native-build-verification-corrupt docker-native-build-access-corrupt 641 642 .PHONY: docker-native-build-benchnet 643 docker-native-build-benchnet: docker-native-build-flow docker-native-build-loader 644 645 .PHONY: docker-push-collection-with-adx 646 docker-push-collection-with-adx: 647 docker push "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG)" 648 649 .PHONY: docker-push-collection-without-adx 650 docker-push-collection-without-adx: 651 docker push "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG_NO_ADX)" 652 653 .PHONY: docker-push-collection-without-netgo-without-adx 654 docker-push-collection-without-netgo-without-adx: 655 docker push "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG_NO_NETGO_NO_ADX)" 656 657 .PHONY: docker-push-collection-arm 658 docker-push-collection-arm: 659 docker push "$(CONTAINER_REGISTRY)/collection:$(IMAGE_TAG_ARM)" 660 661 .PHONY: docker-push-collection-latest 662 docker-push-collection-latest: docker-push-collection 663 docker push "$(CONTAINER_REGISTRY)/collection:latest" 664 665 .PHONY: docker-push-consensus-with-adx 666 docker-push-consensus-with-adx: 667 docker push "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG)" 668 669 .PHONY: docker-push-consensus-without-adx 670 docker-push-consensus-without-adx: 671 docker push "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG_NO_ADX)" 672 673 .PHONY: docker-push-consensus-without-netgo-without-adx 674 docker-push-consensus-without-netgo-without-adx: 675 docker push "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG_NO_NETGO_NO_ADX)" 676 677 .PHONY: docker-push-consensus-arm 678 docker-push-consensus-arm: 679 docker push "$(CONTAINER_REGISTRY)/consensus:$(IMAGE_TAG_ARM)" 680 681 .PHONY: docker-push-consensus-latest 682 docker-push-consensus-latest: docker-push-consensus 683 docker push "$(CONTAINER_REGISTRY)/consensus:latest" 684 685 .PHONY: docker-push-execution-with-adx 686 docker-push-execution-with-adx: 687 docker push "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG)" 688 689 .PHONY: docker-push-execution-corrupt 690 docker-push-execution-corrupt: 691 docker push "$(CONTAINER_REGISTRY)/execution-corrupted:$(IMAGE_TAG)" 692 693 .PHONY: docker-push-execution-without-adx 694 docker-push-execution-without-adx: 695 docker push "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG_NO_ADX)" 696 697 .PHONY: docker-push-execution-without-netgo-without-adx 698 docker-push-execution-without-netgo-without-adx: 699 docker push "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG_NO_NETGO_NO_ADX)" 700 701 .PHONY: docker-push-execution-arm 702 docker-push-execution-arm: 703 docker push "$(CONTAINER_REGISTRY)/execution:$(IMAGE_TAG_ARM)" 704 705 .PHONY: docker-push-execution-latest 706 docker-push-execution-latest: docker-push-execution 707 docker push "$(CONTAINER_REGISTRY)/execution:latest" 708 709 .PHONY: docker-push-verification-with-adx 710 docker-push-verification-with-adx: 711 docker push "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG)" 712 713 .PHONY: docker-push-verification-without-adx 714 docker-push-verification-without-adx: 715 docker push "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG_NO_ADX)" 716 717 .PHONY: docker-push-verification-corrupt 718 docker-push-verification-corrupt: 719 docker push "$(CONTAINER_REGISTRY)/verification-corrupted:$(IMAGE_TAG)" 720 721 .PHONY: docker-push-verification-without-netgo-without-adx 722 docker-push-verification-without-netgo-without-adx: 723 docker push "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG_NO_NETGO_NO_ADX)" 724 725 .PHONY: docker-push-verification-arm 726 docker-push-verification-arm: 727 docker push "$(CONTAINER_REGISTRY)/verification:$(IMAGE_TAG_ARM)" 728 729 .PHONY: docker-push-verification-latest 730 docker-push-verification-latest: docker-push-verification 731 docker push "$(CONTAINER_REGISTRY)/verification:latest" 732 733 .PHONY: docker-push-access-with-adx 734 docker-push-access-with-adx: 735 docker push "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG)" 736 737 .PHONY: docker-push-access-without-adx 738 docker-push-access-without-adx: 739 docker push "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG_NO_ADX)" 740 741 .PHONY: docker-push-access-corrupt 742 docker-push-access-corrupt: 743 docker push "$(CONTAINER_REGISTRY)/access-corrupted:$(IMAGE_TAG)" 744 745 .PHONY: docker-push-access-without-netgo-without-adx 746 docker-push-access-without-netgo-without-adx: 747 docker push "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG_NO_NETGO_NO_ADX)" 748 749 .PHONY: docker-push-access-arm 750 docker-push-access-arm: 751 docker push "$(CONTAINER_REGISTRY)/access:$(IMAGE_TAG_ARM)" 752 753 .PHONY: docker-push-access-latest 754 docker-push-access-latest: docker-push-access 755 docker push "$(CONTAINER_REGISTRY)/access:latest" 756 757 758 .PHONY: docker-push-observer-with-adx 759 docker-push-observer-with-adx: 760 docker push "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG)" 761 762 .PHONY: docker-push-observer-without-adx 763 docker-push-observer-without-adx: 764 docker push "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG_NO_ADX)" 765 766 .PHONY: docker-push-observer-without-netgo-without-adx 767 docker-push-observer-without-netgo-without-adx: 768 docker push "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG_NO_NETGO_NO_ADX)" 769 770 .PHONY: docker-push-observer-arm 771 docker-push-observer-arm: 772 docker push "$(CONTAINER_REGISTRY)/observer:$(IMAGE_TAG_ARM)" 773 774 .PHONY: docker-push-observer-latest 775 docker-push-observer-latest: docker-push-observer 776 docker push "$(CONTAINER_REGISTRY)/observer:latest" 777 778 .PHONY: docker-push-ghost 779 docker-push-ghost: 780 docker push "$(CONTAINER_REGISTRY)/ghost:$(IMAGE_TAG)" 781 782 .PHONY: docker-push-ghost-latest 783 docker-push-ghost-latest: docker-push-ghost 784 docker push "$(CONTAINER_REGISTRY)/ghost:latest" 785 786 .PHONY: docker-push-loader 787 docker-push-loader: 788 docker push "$(CONTAINER_REGISTRY)/loader:$(IMAGE_TAG)" 789 790 .PHONY: docker-push-loader-latest 791 docker-push-loader-latest: docker-push-loader 792 docker push "$(CONTAINER_REGISTRY)/loader:latest" 793 794 .PHONY: docker-push-flow-with-adx 795 docker-push-flow-with-adx: docker-push-collection-with-adx docker-push-consensus-with-adx docker-push-execution-with-adx docker-push-verification-with-adx docker-push-access-with-adx docker-push-observer-with-adx 796 797 .PHONY: docker-push-flow-without-adx 798 docker-push-flow-without-adx: docker-push-collection-without-adx docker-push-consensus-without-adx docker-push-execution-without-adx docker-push-verification-without-adx docker-push-access-without-adx docker-push-observer-without-adx 799 800 .PHONY: docker-push-flow-without-netgo-without-adx 801 docker-push-flow-without-netgo-without-adx: docker-push-collection-without-netgo-without-adx docker-push-consensus-without-netgo-without-adx docker-push-execution-without-netgo-without-adx docker-push-verification-without-netgo-without-adx docker-push-access-without-netgo-without-adx docker-push-observer-without-netgo-without-adx 802 803 .PHONY: docker-push-flow-arm 804 docker-push-flow-arm: docker-push-collection-arm docker-push-consensus-arm docker-push-execution-arm docker-push-verification-arm docker-push-access-arm docker-push-observer-arm 805 806 .PHONY: docker-push-flow-latest 807 docker-push-flow-latest: docker-push-collection-latest docker-push-consensus-latest docker-push-execution-latest docker-push-verification-latest docker-push-access-latest docker-push-observer-latest 808 809 .PHONY: docker-push-flow-corrupt 810 docker-push-flow-corrupt: docker-push-access-corrupt docker-push-execution-corrupt docker-push-verification-corrupt 811 812 .PHONY: docker-push-benchnet 813 docker-push-benchnet: docker-push-flow docker-push-loader 814 815 .PHONY: docker-push-benchnet-latest 816 docker-push-benchnet-latest: docker-push-flow-latest docker-push-loader-latest 817 818 .PHONY: docker-run-collection 819 docker-run-collection: 820 docker run -p 8080:8080 -p 3569:3569 "$(CONTAINER_REGISTRY)/collection:latest" --nodeid 1234567890123456789012345678901234567890123456789012345678901234 --entries collection-1234567890123456789012345678901234567890123456789012345678901234@localhost:3569=1000 821 822 .PHONY: docker-run-consensus 823 docker-run-consensus: 824 docker run -p 8080:8080 -p 3569:3569 "$(CONTAINER_REGISTRY)/consensus:latest" --nodeid 1234567890123456789012345678901234567890123456789012345678901234 --entries consensus-1234567890123456789012345678901234567890123456789012345678901234@localhost:3569=1000 825 826 .PHONY: docker-run-execution 827 docker-run-execution: 828 docker run -p 8080:8080 -p 3569:3569 "$(CONTAINER_REGISTRY)/execution:latest" --nodeid 1234567890123456789012345678901234567890123456789012345678901234 --entries execution-1234567890123456789012345678901234567890123456789012345678901234@localhost:3569=1000 829 830 .PHONY: docker-run-verification 831 docker-run-verification: 832 docker run -p 8080:8080 -p 3569:3569 "$(CONTAINER_REGISTRY)/verification:latest" --nodeid 1234567890123456789012345678901234567890123456789012345678901234 --entries verification-1234567890123456789012345678901234567890123456789012345678901234@localhost:3569=1000 833 834 .PHONY: docker-run-access 835 docker-run-access: 836 docker run -p 9000:9000 -p 3569:3569 -p 8080:8080 -p 8000:8000 "$(CONTAINER_REGISTRY)/access:latest" --nodeid 1234567890123456789012345678901234567890123456789012345678901234 --entries access-1234567890123456789012345678901234567890123456789012345678901234@localhost:3569=1000 837 838 .PHONY: docker-run-observer 839 docker-run-observer: 840 docker run -p 9000:9000 -p 3569:3569 -p 8080:8080 -p 8000:8000 "$(CONTAINER_REGISTRY)/observer:latest" --nodeid 1234567890123456789012345678901234567890123456789012345678901234 --entries observer-1234567890123456789012345678901234567890123456789012345678901234@localhost:3569=1000 841 842 .PHONY: docker-run-ghost 843 docker-run-ghost: 844 docker run -p 9000:9000 -p 3569:3569 "$(CONTAINER_REGISTRY)/ghost:latest" --nodeid 1234567890123456789012345678901234567890123456789012345678901234 --entries ghost-1234567890123456789012345678901234567890123456789012345678901234@localhost:3569=1000 845 846 PHONY: docker-all-tools 847 docker-all-tools: tool-util tool-remove-execution-fork 848 849 PHONY: docker-build-util 850 docker-build-util: 851 docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/util --build-arg GOARCH=$(GOARCH) --build-arg VERSION=$(IMAGE_TAG) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 852 -t "$(CONTAINER_REGISTRY)/util:latest" \ 853 -t "$(CONTAINER_REGISTRY)/util:$(IMAGE_TAG)" . 854 855 PHONY: tool-util 856 tool-util: docker-build-util 857 docker container create --name util $(CONTAINER_REGISTRY)/util:latest;docker container cp util:/bin/app ./util;docker container rm util 858 859 PHONY: docker-build-remove-execution-fork 860 docker-build-remove-execution-fork: 861 docker build -f cmd/Dockerfile --ssh default --build-arg TARGET=./cmd/util/cmd/remove-execution-fork --build-arg GOARCH=$(GOARCH) --build-arg VERSION=$(IMAGE_TAG) --build-arg CGO_FLAG=$(CRYPTO_FLAG) --target production \ 862 -t "$(CONTAINER_REGISTRY)/remove-execution-fork:latest" \ 863 -t "$(CONTAINER_REGISTRY)/remove-execution-fork:$(IMAGE_TAG)" . 864 865 PHONY: tool-remove-execution-fork 866 tool-remove-execution-fork: docker-build-remove-execution-fork 867 docker container create --name remove-execution-fork $(CONTAINER_REGISTRY)/remove-execution-fork:latest;docker container cp remove-execution-fork:/bin/app ./remove-execution-fork;docker container rm remove-execution-fork 868 869 .PHONY: check-go-version 870 check-go-version: 871 @bash -c '\ 872 MINGOVERSION=1.18; \ 873 function ver { printf "%d%03d%03d%03d" $$(echo "$$1" | tr . " "); }; \ 874 GOVER=$$(go version | sed -rne "s/.* go([0-9.]+).*/\1/p" ); \ 875 if [ "$$(ver $$GOVER)" -lt "$$(ver $$MINGOVERSION)" ]; then \ 876 echo "go $$GOVER is too old. flow-go only supports go $$MINGOVERSION and up."; \ 877 exit 1; \ 878 fi; \ 879 ' 880 881 #---------------------------------------------------------------------- 882 # CD COMMANDS 883 #---------------------------------------------------------------------- 884 885 .PHONY: deploy-staging 886 deploy-staging: update-deployment-image-name-staging apply-staging-files monitor-rollout 887 888 # Staging YAMLs must have 'staging' in their name. 889 .PHONY: apply-staging-files 890 apply-staging-files: 891 kconfig=$$(uuidgen); \ 892 echo "$$KUBECONFIG_STAGING" > $$kconfig; \ 893 files=$$(find ${K8S_YAMLS_LOCATION_STAGING} -type f \( --name "*.yml" -or --name "*.yaml" \)); \ 894 echo "$$files" | xargs -I {} kubectl --kubeconfig=$$kconfig apply -f {} 895 896 # Deployment YAMLs must have 'deployment' in their name. 897 .PHONY: update-deployment-image-name-staging 898 update-deployment-image-name-staging: CONTAINER=flow-test-net 899 update-deployment-image-name-staging: 900 @files=$$(find ${K8S_YAMLS_LOCATION_STAGING} -type f \( --name "*.yml" -or --name "*.yaml" \) | grep deployment); \ 901 for file in $$files; do \ 902 patched=`openssl rand -hex 8`; \ 903 node=`echo "$$file" | grep -oP 'flow-\K\w+(?=-node-deployment.yml)'`; \ 904 kubectl patch -f $$file -p '{"spec":{"template":{"spec":{"containers":[{"name":"${CONTAINER}","image":"$(CONTAINER_REGISTRY)/'"$$node"':${IMAGE_TAG}"}]}}}}`' --local -o yaml > $$patched; \ 905 mv -f $$patched $$file; \ 906 done 907 908 .PHONY: monitor-rollout 909 monitor-rollout: 910 kconfig=$$(uuidgen); \ 911 echo "$$KUBECONFIG_STAGING" > $$kconfig; \ 912 kubectl --kubeconfig=$$kconfig rollout status statefulsets.apps flow-collection-node-v1; \ 913 kubectl --kubeconfig=$$kconfig rollout status statefulsets.apps flow-consensus-node-v1; \ 914 kubectl --kubeconfig=$$kconfig rollout status statefulsets.apps flow-execution-node-v1; \ 915 kubectl --kubeconfig=$$kconfig rollout status statefulsets.apps flow-verification-node-v1