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

Add mechanism for platform to provide image creation time #292

Merged
merged 3 commits into from
Mar 30, 2022

Conversation

natalieparellano
Copy link
Member

To continue the conversation here.

See related imgutil PR: buildpacks/imgutil#137.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano requested a review from a team as a code owner February 11, 2022 15:01
@natalieparellano natalieparellano changed the base branch from main to platform/0.9 February 11, 2022 15:01
platform.md Outdated
@@ -872,6 +872,9 @@ To achieve reproducibility the lifecycle SHOULD set the following to a constant,
- file modification times in generated layers
- image creation time

The platform MAY set `SOURCE_DATE_EPOCH` in the lifecycle execution environment, where the value of `SOURCE_DATE_EPOCH` MUST be a [UNIX timestamp](https://reproducible-builds.org/specs/source-date-epoch/).
If `SOURCE_DATE_EPOCH` is set, the lifecycle SHOULD set the image creation time to its value.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think setting just the image creation time is 👍

The primary use case I've seen asked from time to time is mostly around the management of the produced images locally or in a registry. The image creation time should be enough to allow for automation around cleanup and auditing of produced images.

I don't know that I've seen anyone reach out about the file mod times, but I would not be opposed to it either if someone felt strongly that we should honor SOURCE_DATE_EPOCH for the files inside the container as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Assuming SOURCE_DATE_EPOCH changes fairly often, setting the file mod time would effectively prohibit launch layer re-use and make builds slower... maybe this is something we could add if someone asks for it, but since no one has, I agree we should leave it out for now.

Copy link

@thedevelopnik thedevelopnik Feb 11, 2022

Choose a reason for hiding this comment

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

As the person who made the original Slack request, I can back up @jabrown85 here on the use case.

This request is purely about how container registries don't really let us separate metadata like timestamp from the artifact itself which makes them a huge pain to manage. The concrete example being that I can tell Gitlab to keep the last 50 images we made of our main branch, but if they all have the same timestamp, then it removes all but 50 random images, often including the one we have currently deployed in prod! So all tag management basically becomes manual or scripted in a janky way like "check the last 50 tags in the git history for that branch and then remove anything that's not that."

I'd rather have a faster build time than not, since it the file mod time doesn't affect the end pain point.

This would basically let us set this env in our CI for building main branch containers so those can be managed, but leave everything else getting the benefits of fully reproducible builds.

@hone
Copy link
Member

hone commented Feb 16, 2022

Is the only downside of this that it hurts reproducibility? Given the same source with no modifications the image/ref will change based on the timestamp?

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@@ -546,6 +546,7 @@ Usage:
| `<stack>` | `CNB_STACK_PATH` | `/cnb/stack.toml` | Path to stack file (see [`stack.toml`](#stacktoml-toml)
| `<uid>` | `CNB_USER_ID` | | UID of the build image `User`
| `<layers>/config/metadata.toml` | | | Build metadata (see [`metadata.toml`](#metadatatoml-toml)
| | `SOURCE_DATE_EPOCH` | | Timestamp for `created` time in app image config |
Copy link
Member Author

Choose a reason for hiding this comment

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

Though other variables used to configure the lifecycle start with CNB_ it seems better keep the interface consistent with other tooling (see under "Reading the variable" here).

platform.md Outdated Show resolved Hide resolved
@natalieparellano
Copy link
Member Author

Putting this in draft so that we can work through buildpacks/rfcs#204

@natalieparellano
Copy link
Member Author

Undrafting this as buildpacks/rfcs#204 is almost out of FCP.

@natalieparellano natalieparellano marked this pull request as ready for review March 16, 2022 14:04
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@hone
Copy link
Member

hone commented Mar 23, 2022

I've merged that RFC, so please look at this spec change please 🙏

@ekcasey ekcasey merged commit 9462d35 into platform/0.9 Mar 30, 2022
@ekcasey ekcasey deleted the source-date-epoch branch March 30, 2022 17:17
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.

None yet

7 participants