mirror of
https://github.com/helm/helm.git
synced 2026-04-29 02:01:10 -04:00
fix: Use chart archive modifed time for OCI push
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
This commit is contained in:
parent
145d12f82f
commit
02ef83fe28
4 changed files with 11 additions and 6 deletions
|
|
@ -90,8 +90,9 @@ func (pusher *OCIPusher) push(chartRef, href string) error {
|
|||
path.Join(strings.TrimPrefix(href, fmt.Sprintf("%s://", registry.OCIScheme)), meta.Metadata.Name),
|
||||
meta.Metadata.Version)
|
||||
|
||||
chartCreationTime := ctime.Created(stat)
|
||||
pushOpts = append(pushOpts, registry.PushOptCreationTime(chartCreationTime.Format(time.RFC3339)))
|
||||
// The time the chart was "created" is semantically the time the chart archive file was last written
|
||||
chartArchiveFileCreatedTime := ctime.Modified(stat)
|
||||
pushOpts = append(pushOpts, registry.PushOptCreationTime(chartArchiveFileCreatedTime.Format(time.RFC3339)))
|
||||
|
||||
_, err = client.Push(chartBytes, ref, pushOpts...)
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -21,5 +21,9 @@ import (
|
|||
)
|
||||
|
||||
func Created(fi os.FileInfo) time.Time {
|
||||
return created(fi)
|
||||
return modified(fi)
|
||||
}
|
||||
|
||||
func Modified(fi os.FileInfo) time.Time {
|
||||
return modified(fi)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func created(fi os.FileInfo) time.Time {
|
||||
func modified(fi os.FileInfo) time.Time {
|
||||
st := fi.Sys().(*syscall.Stat_t)
|
||||
//nolint
|
||||
return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
|
||||
return time.Unix(int64(st.Mtim.Sec), int64(st.Mtim.Nsec))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func created(fi os.FileInfo) time.Time {
|
||||
func modified(fi os.FileInfo) time.Time {
|
||||
return fi.ModTime()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue