-
Notifications
You must be signed in to change notification settings - Fork 824
commit: add --source-date-epoch and --rewrite-timestamp flags #6189
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
commit: add --source-date-epoch and --rewrite-timestamp flags #6189
Conversation
8507637
to
1c201ea
Compare
cmd/buildah/commit.go
Outdated
@@ -327,6 +348,9 @@ func commitCmd(c *cobra.Command, args []string, iopts commitInputOptions) error | |||
timestamp := time.Unix(0, 0).UTC() | |||
options.HistoryTimestamp = ×tamp | |||
} | |||
if exclusiveFlags > 1 { | |||
return errors.New("can not use more then one timestamp option at at time") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return errors.New("can not use more then one timestamp option at at time") | |
return errors.New("cannot use more then one timestamp option at at time") |
nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
tests/commit.bats
Outdated
run_buildah add --add-history "$cid" $TEST_SCRATCH_DIR/context/* /context | ||
# commit using defaults | ||
run_buildah commit "$cid" oci:$TEST_SCRATCH_DIR/default | ||
# commit with an implicity-provided timestamp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# commit with an implicity-provided timestamp | |
# commit with an implicitly-provided timestamp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
@@ -1229,9 +1212,40 @@ func (i *containerImageRef) makeExtraImageContentDiff(includeFooter bool) (_ str | |||
return diff.Name(), digester.Digest(), counter.Count, nil | |||
} | |||
|
|||
func makeFilteredLayerWriteCloser(wc io.WriteCloser, layerModTime, layerLatestModTime *time.Time) io.WriteCloser { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: A small comment about this function will be helpful documenting precedence order between layerModTime
and layerLatestModTime
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR LGTM just small nits and one question.
1c201ea
to
a013447
Compare
Add a --source-date-epoch flag, defaulting to $SOURCE_DATE_EPOCH if set, which sets the created-on date and the timestamp for the new history entries, but does not default to modifying the timestamps on contents in new layers. Add a --rewrite-timestamp flag, which "clamps" timestamps in the new layers to not be later than the --source-date-epoch value if both the --rewrite-timestamp and --source-date-epoch flags were set. Signed-off-by: Nalin Dahyabhai <[email protected]>
a013447
to
6c82e7e
Compare
Ephemeral COPR build failed. @containers/packit-build please check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, nalind The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM |
/lgtm |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add a
--source-date-epoch flag
, defaulting to$SOURCE_DATE_EPOCH
if set, which sets the created-on date and the timestamp for the new history entries, but does not default to modifying the timestamps on contents in new layers.Add a
--rewrite-timestamp
flag, which "clamps" timestamps in the new layers to not be later than the--source-date-epoch
value if both the--rewrite-timestamp
and--source-date-epoch
flags were set.How to verify it
New integration tests!
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
Does this PR introduce a user-facing change?