Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions examples/simple-artifact-dependency/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
ARG BASE
FROM golang:1.18 as builder

FROM golang:1.18 AS builder
WORKDIR /code
COPY main.go .
COPY go.mod .
# `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations
ARG SKAFFOLD_GO_GCFLAGS
RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -trimpath -o /app .

FROM $BASE
FROM $BASE AS base

FROM scratch
# Define GOTRACEBACK to mark this container as using the Go language runtime
# for `skaffold debug` (https://skaffold.dev/docs/workflows/debug/).
ENV GOTRACEBACK=single
CMD ["./app"]
COPY --from=builder /app .
COPY --from=base hello.txt .

2 changes: 2 additions & 0 deletions examples/simple-artifact-dependency/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ build:
alias: BASE
- image: base
context: base
tagPolicy:
inputDigest: {}
manifests:
rawYaml:
- app/k8s-pod.yaml
Expand Down
6 changes: 4 additions & 2 deletions pkg/skaffold/docker/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import (
"github.com/GoogleContainerTools/skaffold/v2/proto/v1"
)

const buildkitUnresolvedImagePlaceholder = "image:latest"

type FromTo struct {
// From is the relative path (wrt. the skaffold root directory) of the dependency on the host system.
From string
Expand Down Expand Up @@ -267,7 +269,7 @@ func extractCopyCommands(ctx context.Context, nodes []*parser.Node, onlyLastImag
stages[strings.ToLower(from.as)] = true
}

if from.image == "" {
if from.image == "" || from.image == buildkitUnresolvedImagePlaceholder {
// some build args like artifact dependencies are not available until the first build sequence has completed.
// skip check if there are unavailable images
continue
Expand Down Expand Up @@ -386,7 +388,7 @@ func expandOnbuildInstructions(ctx context.Context, nodes []*parser.Node, cfg Co
var onbuildNodes []*parser.Node
if ons, found := onbuildNodesCache[strings.ToLower(from.image)]; found {
onbuildNodes = ons
} else if from.image == "" {
} else if from.image == "" || from.image == buildkitUnresolvedImagePlaceholder {
// some build args like artifact dependencies are not available until the first build sequence has completed.
// skip check if there are unavailable images
onbuildNodes = []*parser.Node{}
Expand Down
Loading