commit: add --source-date-epoch and --rewrite-timestamp flags#6189
Conversation
8507637 to
1c201ea
Compare
cmd/buildah/commit.go
Outdated
| 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.
| 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
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.
| # commit with an implicity-provided timestamp | |
| # commit with an implicitly-provided timestamp |
| 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.
Nit: A small comment about this function will be helpful documenting precedence order between layerModTime and layerLatestModTime ?
flouthoc
left a comment
There was a problem hiding this comment.
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. |
|
[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 DetailsNeeds 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_EPOCHif 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-timestampflag, which "clamps" timestamps in the new layers to not be later than the--source-date-epochvalue if both the--rewrite-timestampand--source-date-epochflags 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?