From d563d3ab8dadcecc36f7826b712447cd7f9fb505 Mon Sep 17 00:00:00 2001 From: Shishir Kushwaha <138311586+shishir-11@users.noreply.github.com> Date: Wed, 10 Jul 2024 22:23:01 +0530 Subject: [PATCH] docs: add function to be included when using buildkit.SolveToDocker (#698) Signed-off-by: Shishir Kushwaha --- website/docs/development-tips.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/website/docs/development-tips.md b/website/docs/development-tips.md index 6aa7c37a..47acd5dd 100644 --- a/website/docs/development-tips.md +++ b/website/docs/development-tips.md @@ -26,6 +26,15 @@ The folder specified defaults to the system temp folder unless the `--working-fo It's often useful to be able to inspect what the output of an intermediate LLB stage would look like after it has executed, and you can perform an analog to `printf` debugging by solving the LLB stage to a Docker image and then inspecting the resulting image: +```go +// Add this to pkg/buildkit/buildkit.go to use +func SolveToDocker(ctx context.Context, c *client.Client, st *llb.State, configData []byte, tag string) error { + def, err := st.Marshal(ctx) + if err != nil { + log.Errorf("st.Marshal failed with %s", err) + return err +``` + ```go // DEBUG: Solve the LLB stage to a Docker image. if err := buildkit.SolveToDocker(ctx, dm.config.Client, &, dm.config.ConfigData, dm.config.ImageName+"-"); err != nil {