Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add-render-event-in-runner #7781

Merged
Merged
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
5 changes: 5 additions & 0 deletions pkg/skaffold/runner/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker"
eventV2 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/event/v2"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/instrumentation"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/manifest"
Expand All @@ -39,13 +40,15 @@ func (r *SkaffoldRunner) Render(ctx context.Context, out io.Writer, builds []gra
}
defer postRenderFn()

eventV2.TaskInProgress(constants.Render, "")
if r.runCtx.RenderOnly() {
// Fetch the digest and append it to the tag with the format of "tag@digest"
if r.runCtx.DigestSource() == constants.RemoteDigestSource {
for i, a := range builds {
// remote digest to platform dependant build not supported
digest, err := docker.RemoteDigest(a.Tag, r.runCtx, nil)
if err != nil {
eventV2.TaskFailed(constants.Render, err)
return manifest.ManifestListByConfig{}, fmt.Errorf("failed to resolve the digest of %s: does the image exist remotely?", a.Tag)
}
builds[i].Tag = build.TagWithDigest(a.Tag, digest)
Expand All @@ -59,10 +62,12 @@ func (r *SkaffoldRunner) Render(ctx context.Context, out io.Writer, builds []gra
ctx, endTrace := instrumentation.StartTrace(ctx, "Render")
manifestList, err := r.renderer.Render(ctx, renderOut, builds, offline)
if err != nil {
eventV2.TaskFailed(constants.Render, err)
endTrace(instrumentation.TraceEndError(err))
return manifest.ManifestListByConfig{}, err
}

endTrace()
eventV2.TaskSucceeded(constants.Render)
return manifestList, nil
}