@@ -108,6 +108,21 @@ inputs:
108108 go get github.com/smartcontractkit/chainlink-solana@abc123
109109 go get github.com/smartcontractkit/chainlink-evm@def456
110110
111+ cache-scope :
112+ required : false
113+ description : |
114+ Custom scope for Docker build cache. Separates caches when multiple
115+ Dockerfiles build on the same architecture (e.g. "core" vs "plugins").
116+ If not set, defaults to runner OS and architecture.
117+ default : " "
118+
119+ free-disk-space :
120+ required : false
121+ description : |
122+ Whether to run the free-disk-space step before building. Set to "false"
123+ on runners with sufficient disk (e.g. RunsOn with 100GB+) to save ~30-60s.
124+ default : " true"
125+
111126outputs :
112127 docker-image-sha-digest-amd64 :
113128 description : " Docker image SHA digest for platform: amd64"
@@ -119,12 +134,6 @@ outputs:
119134runs :
120135 using : composite
121136 steps :
122- - uses : actions/setup-go@v6
123- with :
124- go-version-file : " go.mod"
125- check-latest : true
126- cache : false
127-
128137 - name : Setup GitHub token using GATI
129138 if : inputs.gati-role-arn != '' && inputs.gati-lambda-url != ''
130139 id : github-token
@@ -136,13 +145,6 @@ runs:
136145 aws-role-duration-seconds : " 1800"
137146 set-git-config : " true"
138147
139- - name : Process go get overrides
140- shell : bash
141- env :
142- GO_OVERRIDES : ${{ inputs.go-get-overrides }}
143- ACTIONS_PATH : ${{ github.action_path }}
144- run : ${ACTIONS_PATH}/scripts/go-get-overrides.sh
145-
146148 - name : Process plugin manifest overrides (public)
147149 shell : bash
148150 env :
@@ -152,18 +154,32 @@ runs:
152154 ACTIONS_PATH : ${{ github.action_path }}
153155 run : ${ACTIONS_PATH}/scripts/plugin-overrides.sh
154156
155- - name : Tidy and Output go.mod
157+ - name : Setup Go for dependency overrides
158+ if : inputs.go-get-overrides != ''
159+ uses : actions/setup-go@v6
160+ with :
161+ go-version-file : go.mod
162+ cache : false
163+
164+ - name : Apply go-get dependency overrides
165+ if : inputs.go-get-overrides != ''
156166 shell : bash
167+ env :
168+ GO_OVERRIDES : ${{ inputs.go-get-overrides }}
157169 run : |
158- echo "::group::Tidy go.mod"
170+ set -e
171+ while IFS= read -r line; do
172+ [ -z "$line" ] && continue
173+ dep="${line%%=*}"
174+ sha="${line#*=}"
175+ [ -z "$dep" ] || [ -z "$sha" ] && continue
176+ echo "Overriding: github.com/smartcontractkit/${dep}@${sha}"
177+ go get "github.com/smartcontractkit/${dep}@${sha}"
178+ done <<< "$GO_OVERRIDES"
159179 go mod tidy
160- echo "::endgroup::"
161-
162- echo "::group::cat go.mod"
163- cat go.mod
164- echo "::endgroup::"
165180
166181 - name : Free up disk space (to avoid 'no space left on device' errors)
182+ if : inputs.free-disk-space == 'true'
167183 uses : smartcontractkit/.github/actions/free-disk-space@free-disk-space/v1
168184
169185 - name : Build push docker image
@@ -182,18 +198,18 @@ runs:
182198 docker-registry-url : ${{ inputs.docker-registry-url }}
183199 docker-repository-name : ${{ inputs.docker-repository-name }}
184200 # only save on events which are expected to be from the default branch
185- docker-save-cache :
186- ${{ github.event_name == 'schedule ' || github.event_name == 'push ' }}
201+ docker-save-cache : ${{ github.event_name == 'schedule' ||
202+ github.event_name == 'push ' || github.event_name == 'pull_request ' }} # TODO: Remove pull_request after testing
187203 # dont use cache on events which are expected to be from the default branch
188204 # this is to create a fresh cache/snapshot unpolluted by previous cache entries
189205 docker-restore-cache :
190206 ${{ github.event_name != 'schedule' && github.event_name != 'push' }}
191207 docker-build-cache-to :
192- " type=gha,timeout=10m,mode=min ,ignore-error=true,scope=ctf-build-image-${{
193- runner.os }}-${{ runner.arch }}"
208+ " type=gha,timeout=10m,mode=max ,ignore-error=true,compression=zstd,compression-level=3 ,scope=ctf-build-image-${{
209+ inputs.cache-scope || format('{0}-{1}', runner.os, runner. arch) }}"
194210 docker-build-cache-from :
195- " type=gha,timeout=10m,scope=ctf-build-image-${{ runner.os }}-${{
196- runner.arch }}"
211+ " type=gha,timeout=10m,scope=ctf-build-image-${{ inputs.cache-scope ||
212+ format('{0}-{1}', runner.os, runner. arch) }}"
197213
198214 tags : type=raw,value=${{ inputs.image-tag }}
199215 aws-account-number : ${{ inputs.aws-account-number }}
0 commit comments