use containerd's epoch package for handling SOURCE_DATE_EPOCH#1908
Open
thaJeztah wants to merge 1 commit intodocker:masterfrom
Open
use containerd's epoch package for handling SOURCE_DATE_EPOCH#1908thaJeztah wants to merge 1 commit intodocker:masterfrom
thaJeztah wants to merge 1 commit intodocker:masterfrom
Conversation
This allows us to validate the value before we're using it, and makes sure we handle things in the same way. Signed-off-by: Sebastiaan van Stijn <[email protected]>
crazy-max
reviewed
Jun 23, 2023
Comment on lines
+125
to
+130
| v, err := epoch.SourceDateEpoch() | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| if v != nil { | ||
| opts.BuildArgs[epoch.SourceDateEpochEnv] = strconv.FormatInt(v.Unix(), 10) |
Member
There was a problem hiding this comment.
I'm not sure parsing string to time and back to string for this purpose is ideal.
Member
Author
There was a problem hiding this comment.
Yeah, it's not; I started working on a branch to add a utility for parsing in containerd (although we have one in BuildKit as well).
Member
Author
There was a problem hiding this comment.
I could still use the parsing, and just get the env-var separately; let me check for a bit
Member
Author
There was a problem hiding this comment.
hm.. no no utility on its own, so if could be;
opts.BuildArgs[epoch.SourceDateEpochEnv] = os.Getenv(epoch.SourceDateEpochEnv)which also looks a bit odd, as we're setting a value that's not the v != nil that we check 😞
Member
|
@thaJeztah What's the status of this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows us to validate the value before we're using it, and makes sure we handle things in the same way.