Skip to content
Closed
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
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RUN go mod download
RUN apt-get update && apt-get install -y curl
RUN curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-${TARGETARCH} && \
chmod +x ./kind
RUN curl -Lo ./k3d https://github.com/k3d-io/k3d/releases/download/v5.9.0/k3d-linux-${TARGETARCH} && \
chmod +x ./k3d

# Copy source code - only what's needed
COPY cmd/ ./cmd/
Expand All @@ -38,6 +40,7 @@ FROM gcr.io/distroless/static-debian12 AS final

# Copy necessary binaries from the build stage
COPY --from=build /argocd-diff-preview/kind /usr/local/bin/kind
COPY --from=build /argocd-diff-preview/k3d /usr/local/bin/k3d
COPY --from=build /argocd-diff-preview/argocd-diff-preview .

# Copy docker from the docker image
Expand Down
1 change: 1 addition & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ run-with-docker: pull-repository docker-build
-e DIFF_IGNORE="$(diff_ignore)" \
-e TIMEOUT=$(timeout) \
-e SELECTOR="$(selector)" \
-e CLUSTER="$(cluster_type)" \
-e FILES_CHANGED="$(files_changed)" \
-e ARGOCD_CHART_NAME="$(argocd_chart_name)" \
-e ARGOCD_CHART_URL="$(argocd_chart_url)" \
Expand Down
8 changes: 8 additions & 0 deletions pkg/k3d/k3d.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ func CreateCluster(clusterName, k3dOptions string, wait time.Duration) (time.Dur
log.Error().Msgf("❌ Failed to create cluster with options: %s", k3dOptions)
}
return time.Since(startTime), fmt.Errorf("failed to create cluster: %s", output)
} else {
log.Debug().Msgf("k3d cluster create output: %s", output)
}

// k3d's end-of-create kubeconfig merge is best-effort: on failure it only
// logs a warning and still exits 0. Merge explicitly so a failure surfaces.
if output, err := runCommand("k3d", "kubeconfig", "merge", clusterName, "--kubeconfig-merge-default"); err != nil {
return time.Since(startTime), fmt.Errorf("failed to write kubeconfig: %s", output)
}

duration := time.Since(startTime)
Expand Down