Skip to content

Commit 3061c91

Browse files
committed
skip BuildKit image pre-pulls for explicit endpoints
Signed-off-by: CrazyMax <[email protected]>
1 parent 594f3bf commit 3061c91

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ jobs:
182182
183183
endpoint:
184184
runs-on: ubuntu-latest
185+
strategy:
186+
fail-fast: false
187+
matrix:
188+
endpoint:
189+
- mycontext
190+
- tcp://127.0.0.1:2375
191+
env:
192+
# only the explicit endpoint should provide access to a daemon.
193+
DOCKER_HOST: unix:///tmp/nonexistent-docker.sock
185194
services:
186195
dind:
187196
image: docker:29.3-dind@sha256:4d90f1f6c400315c2dba96d3ec93c01e64198395cbba04f79d12adce4f737029
@@ -209,11 +218,19 @@ jobs:
209218
docker --context mycontext info
210219
-
211220
name: Set up Docker Buildx
221+
id: buildx
212222
uses: ./
213223
with:
214-
endpoint: mycontext
224+
endpoint: ${{ matrix.endpoint }}
225+
-
226+
name: Build
215227
env:
216-
DOCKER_CONTEXT: mycontext
228+
BUILDER: ${{ steps.buildx.outputs.name }}
229+
run: |
230+
docker buildx build --builder "$BUILDER" - <<'EOF'
231+
FROM scratch
232+
LABEL test=endpoint
233+
EOF
217234
218235
buildkitd-config:
219236
runs-on: ubuntu-latest

‎src/main.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@ actionsToolkit.run(
133133

134134
if (!standalone && inputs.driver == 'docker-container') {
135135
const buildkitImages = new Set<string>();
136-
if (!builderExists) {
136+
if (!builderExists && !inputs.endpoint) {
137137
buildkitImages.add(resolveBuildKitImage(inputs.driverOpts));
138138
}
139139
for (const node of appendNodes) {
140-
buildkitImages.add(resolveBuildKitImage(node['driver-opts']));
140+
if (!node.endpoint) {
141+
buildkitImages.add(resolveBuildKitImage(node['driver-opts']));
142+
}
141143
}
142144
if (buildkitImages.size > 0) {
143145
await core.group(`Pulling BuildKit image(s)`, async () => {

0 commit comments

Comments
 (0)