Skip to content

Allow breakpoints on cached instructions#33

Merged
ktock merged 1 commit intomainfrom
cache-breakpoints
May 31, 2022
Merged

Allow breakpoints on cached instructions#33
ktock merged 1 commit intomainfrom
cache-breakpoints

Conversation

@ktock
Copy link
Copy Markdown
Owner

@ktock ktock commented May 31, 2022

Following-up: #24
Depends-on: ktock/buildkit@3307632

This commit allows breakpoints on cached instructions.

example:

FROM busybox
RUN echo foo > /foo
RUN echo bar > /bar
RUN echo fail > /
$ buildg.sh debug --cache-reuse /tmp/ctx
INFO[2022-05-31T11:44:56Z] storing the build data to "/home/ktock/.local/share/buildg/data". to prune the data, remove that directory manually. 
WARN[2022-05-31T11:44:56Z] using host network as the default            
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 108B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/busybox:latest
INFO[2022-05-31T11:44:58Z] CACHED [1/4] FROM docker.io/library/busybox@sha256:ebadf81a7f2146e95f8c850ad7af8cf9755d31cdba380a8ffd5930fba5996095 
INFO[2022-05-31T11:44:58Z] debug session started. type "help" for command reference. 
Filename: "Dockerfile"
 =>   1| FROM busybox
      2| RUN echo foo > /foo
      3| RUN echo bar > /bar
      4| RUN echo fail > /
(buildg) n
#3 DONE 1.9s

#4 [1/4] FROM docker.io/library/busybox@sha256:ebadf81a7f2146e95f8c850ad7af8cf9755d31cdba380a8ffd5930fba5996095
#4 resolve docker.io/library/busybox@sha256:ebadf81a7f2146e95f8c850ad7af8cf9755d31cdba380a8ffd5930fba5996095 0.0s done
#4 DONE 0.0s
INFO[2022-05-31T11:45:02Z] CACHED [2/4] RUN echo foo > /foo             
Filename: "Dockerfile"
      1| FROM busybox
 =>   2| RUN echo foo > /foo
      3| RUN echo bar > /bar
      4| RUN echo fail > /
(buildg) exec cat /foo
foo
(buildg) b 3
(buildg) c
INFO[2022-05-31T11:45:08Z] CACHED [3/4] RUN echo bar > /bar             
Breakpoint[0]: reached line: Dockerfile:3
Filename: "Dockerfile"
      1| FROM busybox
      2| RUN echo foo > /foo
*=>   3| RUN echo bar > /bar
      4| RUN echo fail > /
(buildg) exec cat /foo /bar
foo
bar
(buildg) n

#5 [2/4] RUN echo foo > /foo
#5 CACHED

#6 [3/4] RUN echo bar > /bar
#6 CACHED

#7 [4/4] RUN echo fail > /
Breakpoint[on-fail]: caught error process "/bin/sh -c echo fail > /" did not complete successfully: exit code: 1
Filename: "Dockerfile"
      1| FROM busybox
      2| RUN echo foo > /foo
*     3| RUN echo bar > /bar
 =>   4| RUN echo fail > /
(buildg) q
#7 0.065 /bin/sh: can't create /: Is a directory
#7 CANCELED

@ktock ktock force-pushed the cache-breakpoints branch from cf7bc89 to a877726 Compare May 31, 2022 11:45
@ktock ktock merged commit 63f02ed into main May 31, 2022
@ktock ktock deleted the cache-breakpoints branch May 31, 2022 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant