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

PoC: Build a tool to validate file hashes against layer caches #186

Closed
mafredri opened this issue May 14, 2024 · 1 comment · Fixed by #213
Closed

PoC: Build a tool to validate file hashes against layer caches #186

mafredri opened this issue May 14, 2024 · 1 comment · Fixed by #213
Assignees
Labels
enhancement New feature or request spike Investigation to prove feasibility or validate an idea

Comments

@mafredri
Copy link
Member

This issue tracks the implementation of a PoC to validate the path forward for #128.

To support #185, we must be able to figure out if a cached layer image is valid, given the state of files relevant to building the container (think contents of Dockerfile, devcontainer.json, and hashes of any files pulled in via COPY-directive).

In this PoC, we will implement this logic (files -> layer) as a subcommand of envbulider. This will require parsing and understanding of Dockerfile to understand if a change modifies the outcome, and which layers remain intact.

@mafredri
Copy link
Member Author

mafredri commented Jun 1, 2024

The conclusion from this PoC is that:

  1. It is possible to repeatedly produce the same final image hash without actually extracting cache layers and executing commands
  2. With a few changes, Kaniko can report the hash for directives in the Dockerfile
    • Example: A directive like COPY ./file /file consists of two hashes, the actual directive (COPY ./file /file) and the hash of the ./file. The hash we're referring to is a combination of these two.

The 1. solution is fairly straight forward and has been demonstrated in #213.

The 2. solution can be more flexible (doesn't require reproducible builds), but would need to develop a way to map hash + hash + hash -> final image. This would means tagging the image with a custom tag (perhaps a combination of all build layer hashes).

@mafredri mafredri closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request spike Investigation to prove feasibility or validate an idea
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant