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

containerimage: support SOURCE_DATE_EPOCH for CreatedAt #3263

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

AkihiroSuda
Copy link
Member

Fix #3167

@AkihiroSuda
Copy link
Member Author

Target: *desc,
CreatedAt: time.Now(),
Target: *desc,
// CreatedAt is ignored (propagated via imageClientCtx)
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Why? You are saying that there is a field CreatedAt that Create() and Update() methods take, but the implementation is broken, and it doesn't work. And instead, only way to pass the value is with this context dance?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but probably s/broken/unsupported by design/.

The context was chosen to keep the Go API unmodified.

Copy link
Member Author

Choose a reason for hiding this comment

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

What should we do with this?

Copy link
Member

Choose a reason for hiding this comment

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

Is there a containerd issue tracking this? It looks like a bug, and we are trying to work around it.

keep the Go API unmodified.

I don't see how this even matters in this case. The value is inside a struct, so it doesn't change the function signature, and the value has already been there(and it looks like we were even setting it).

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like a bug

Doesn't seem so IIUC: containerd/containerd#8225 (comment)

it doesn't change the function signature

Still CreatedAt time.Time in the struct would have to be changed to CreatedAt *time.Time to differentiate "unset" from "1970-01-01 00:00:00".
Alternatively we could add CreatedAtIsUnset bool in the struct, but that might look uglier than ctx.

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem so IIUC: containerd/containerd#8225 (comment)

I don't think that contradicts. Yes, this is not a build time, but just some time value associated with the containerd image store. But it doesn't change how the value is updated. This is the same value that is returned when querying the Image struct.

Alternatively we could add CreatedAtIsUnset bool in the struct

I think I would prefer this. It is not a blocker for this PR, but we should have something in containerd that tracks this issue so it doesn't get forgotten.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Can we mark more clearly that this is a containerd bug in a comment and needs a follow-up after a fix is done there. There has not been much movement in the containerd issue. I'd like to be sure we are not stuck with this solution forever.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated comments

Comment on lines +2879 to +2934
// https://github.com/containerd/containerd/commit/133ddce7cf18a1db175150e7a69470dea1bb3132
integration.CheckContainerdVersion(t, cdAddress, ">= 1.7.0-beta.1")
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed now

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't be removed, as we still test containerd 1.6 too

@AkihiroSuda
Copy link
Member Author

@tonistiigi PTAL

@AkihiroSuda
Copy link
Member Author

What should we do with this for now?

@AkihiroSuda
Copy link
Member Author

Rebased

@AkihiroSuda AkihiroSuda added this to the v0.12.0 milestone May 24, 2023
Fix issue 3167

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SOURCE_DATE_EPOCH: containerimage: CreatedAt timestamp should be reproducible
3 participants