From 2e13052935d3da3c39e9f41ecc5cbc5e1fb7908d Mon Sep 17 00:00:00 2001 From: Kristijan Rebernisak Date: Wed, 9 Oct 2024 11:40:26 +0200 Subject: [PATCH] Add ARG MODE to plugins/chainlink.Dockerfile to enable Beholder in dev/test (#14560) * Add ARG MODE to plugins/chainlink.Dockerfile to enable Beholder in dev/test * Adjusting make scripts to accept build tags with TAG var * Testing out new build args --------- Co-authored-by: Sergei Drugalev Co-authored-by: Damjan Smickovski --- .github/actions/build-chainlink-image/action.yml | 6 +++++- .github/workflows/integration-tests.yml | 2 ++ GNUmakefile | 12 ++++++++---- plugins/chainlink.Dockerfile | 7 ++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/actions/build-chainlink-image/action.yml b/.github/actions/build-chainlink-image/action.yml index 0e457560bf0..fc541590cb5 100644 --- a/.github/actions/build-chainlink-image/action.yml +++ b/.github/actions/build-chainlink-image/action.yml @@ -22,6 +22,9 @@ inputs: description: "Check if the image exists in ECR before building" required: false default: 'false' + build_args: + required: false + description: Additional build arguments for the image runs: using: composite @@ -37,7 +40,7 @@ runs: AWS_ROLE_TO_ASSUME: ${{ inputs.AWS_ROLE_TO_ASSUME }} - name: Build Image if: steps.check-image.outputs.exists != 'true' - uses: smartcontractkit/.github/actions/ctf-build-image@1a26fe378d7ebdc34ab1fe31ec4a6d1c376199f8 # ctf-build-image@0.0.0 + uses: smartcontractkit/.github/actions/ctf-build-image@f1078918a926c0a75eeebbad8ffc3f98b8502ba9 # ctf-build-image@0.0.0 with: cl_repo: smartcontractkit/chainlink cl_ref: ${{ inputs.git_commit_sha }} @@ -47,6 +50,7 @@ runs: QA_AWS_ROLE_TO_ASSUME: ${{ inputs.AWS_ROLE_TO_ASSUME }} GO_COVER_FLAG: true dep_evm_sha: ${{ inputs.dep_evm_sha }} + build_args: ${{ inputs.build_args }} - name: Print Chainlink Image Built shell: sh run: | diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 1933ec520fb..fec31a72c21 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -231,6 +231,8 @@ jobs: AWS_REGION: ${{ secrets.QA_AWS_REGION }} AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} dep_evm_sha: ${{ inputs.evm-ref }} + build_args: | + TAGS=dev run-core-e2e-tests-for-pr: name: Run Core E2E Tests For PR diff --git a/GNUmakefile b/GNUmakefile index 4080f87b734..3759b2ab91d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -38,7 +38,11 @@ docs: ## Install and run pkgsite to view Go docs .PHONY: install-chainlink install-chainlink: operator-ui ## Install the chainlink binary. - go install $(GOFLAGS) . + go install $(GOFLAGS) $(if $(TAGS),-tags $(TAGS)) . + +.PHONY: install-chainlink-dev +install-chainlink-dev: operator-ui ## Install a dev build of the chainlink binary. + $(MAKE) install-chainlink TAGS="dev $(TAGS)" .PHONY: install-chainlink-cover install-chainlink-cover: operator-ui ## Install the chainlink binary with cover flag. @@ -46,15 +50,15 @@ install-chainlink-cover: operator-ui ## Install the chainlink binary with cover .PHONY: chainlink chainlink: ## Build the chainlink binary. - go build $(GOFLAGS) . + go build $(GOFLAGS) $(if $(TAGS),-tags $(TAGS)) . .PHONY: chainlink-dev chainlink-dev: ## Build a dev build of chainlink binary. - go build -tags dev $(GOFLAGS) . + $(MAKE) chainlink TAGS="dev $(TAGS)" .PHONY: chainlink-test chainlink-test: ## Build a test build of chainlink binary. - go build $(GOFLAGS) . + $(MAKE) chainlink .PHONY: install-medianpoc install-medianpoc: ## Build & install the chainlink-medianpoc binary. diff --git a/plugins/chainlink.Dockerfile b/plugins/chainlink.Dockerfile index 6d42567c745..77e8ce4c9f4 100644 --- a/plugins/chainlink.Dockerfile +++ b/plugins/chainlink.Dockerfile @@ -9,15 +9,16 @@ COPY tools/bin/ldflags ./tools/bin/ ADD go.mod go.sum ./ RUN go mod download -# Env vars needed for chainlink build +# Chainlink build args ARG COMMIT_SHA +ARG TAGS COPY . . RUN apt-get update && apt-get install -y jq -# Build the golang binaries -RUN make install-chainlink +# Build the golang binaries (use dev mode if specified) +RUN bash -c "make install-chainlink TAGS=\"$TAGS\"" # Install medianpoc binary RUN make install-medianpoc