Skip to content

Commit 87da481

Browse files
aledbfclaude
andcommitted
fix(docker): default the base-image ARG in updateUID.Dockerfile (#1242)
`ARG BASE_IMAGE` used by `FROM $BASE_IMAGE` without a default triggers BuildKit's InvalidDefaultArgInFrom lint warning. Give it `=placeholder` (the real base image is always supplied via --build-arg). Regression test added. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4a02ef0 commit 87da481

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

internal/docker/updateUID.Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Licensed under the Apache License, Version 2.0. See LICENSE.txt in the project root for license information.
2-
ARG BASE_IMAGE
2+
# Default value avoids BuildKit's InvalidDefaultArgInFrom lint warning; the real
3+
# base image is always supplied via --build-arg BASE_IMAGE (docker.UpdateRemoteUserUID).
4+
ARG BASE_IMAGE=placeholder
35
FROM $BASE_IMAGE
46

57
USER root

internal/docker/updateuid_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package docker
2+
3+
import "strings"
4+
5+
import "testing"
6+
7+
// TestUpdateUIDDockerfileArgHasDefault guards against reintroducing the
8+
// InvalidDefaultArgInFrom BuildKit warning: the ARG used by the FROM must carry
9+
// a default value (the real base image is passed via --build-arg). Upstream #1242.
10+
func TestUpdateUIDDockerfileArgHasDefault(t *testing.T) {
11+
if !strings.Contains(updateUIDDockerfile, "ARG BASE_IMAGE=") {
12+
t.Errorf("updateUID.Dockerfile must give ARG BASE_IMAGE a default to avoid InvalidDefaultArgInFrom")
13+
}
14+
if !strings.Contains(updateUIDDockerfile, "FROM $BASE_IMAGE") {
15+
t.Errorf("updateUID.Dockerfile should still FROM $BASE_IMAGE")
16+
}
17+
}

0 commit comments

Comments
 (0)