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

twoliter: use Twoliter.toml for cache layers #179

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

bcressey
Copy link
Contributor

Issue number:
N/A

Description of changes:
Twoliter.toml should always exist, while .gitignore might not.

Testing done:
Built the main repo with a custom Twoliter build.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Twoliter.toml should always exist, while .gitignore might not.

Signed-off-by: Ben Cressey <[email protected]>
@@ -31,7 +31,7 @@ ARG TOKEN
# We can't create directories via RUN in a scratch container, so take an existing one.
COPY --chown=1000:1000 --from=sdk /tmp /cache
# Ensure the ARG variables are used in the layer to prevent reuse by other builds.
COPY --chown=1000:1000 .gitignore /cache/.${PACKAGE}.${ARCH}.${TOKEN}
COPY --chown=1000:1000 Twoliter.toml /cache/.${PACKAGE}.${ARCH}.${TOKEN}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks fine to me, but for my educational purposes is there some sort of corelation between .gitignore and Twoliter.toml (duplicate data being stored)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No relationship really, they are both standing in for "a file we're sure will exist". Except with Twoliter.toml we are now guaranteed it will exist.

Scratch containers are kind of hard to work with - there's no shell, so you can only copy files from the build context or other images.

Strictly speaking the cache layer also doesn't have to be a totally empty layer; we could use the SDK itself and just add a file. But I liked the idea that the cache layer would only have files that some later stage added, so that you could find /home/builder/.cache and not get back a giant list of files.

@webern
Copy link
Contributor

webern commented Mar 26, 2024

.gitignore is, to some extent, required in order to ignore build, .cargo and such. But this makes sense anyway since Twoliter.toml really is constrained to exist in the root.

@bcressey bcressey merged commit 7ba0d4b into bottlerocket-os:develop Mar 26, 2024
1 check passed
@bcressey bcressey deleted the avoid-gitignore branch March 26, 2024 17:57
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.

3 participants