Remove reference to stdtime to reduce confusion

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
pull/6679/head
Taylor Thomas 5 years ago
parent 4d7968f692
commit 93abfd75ad

@ -19,7 +19,7 @@ package main
import (
"fmt"
"io"
stdtime "time"
"time"
"github.com/gosuri/uitable"
"github.com/spf13/cobra"
@ -30,7 +30,7 @@ import (
"helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/releaseutil"
"helm.sh/helm/v3/pkg/time"
helmtime "helm.sh/helm/v3/pkg/time"
)
var historyHelp = `
@ -77,12 +77,12 @@ func newHistoryCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}
type releaseInfo struct {
Revision int `json:"revision"`
Updated time.Time `json:"updated"`
Status string `json:"status"`
Chart string `json:"chart"`
AppVersion string `json:"app_version"`
Description string `json:"description"`
Revision int `json:"revision"`
Updated helmtime.Time `json:"updated"`
Status string `json:"status"`
Chart string `json:"chart"`
AppVersion string `json:"app_version"`
Description string `json:"description"`
}
type releaseHistory []releaseInfo
@ -99,7 +99,7 @@ func (r releaseHistory) WriteTable(out io.Writer) error {
tbl := uitable.New()
tbl.AddRow("REVISION", "UPDATED", "STATUS", "CHART", "APP VERSION", "DESCRIPTION")
for _, item := range r {
tbl.AddRow(item.Revision, item.Updated.Format(stdtime.ANSIC), item.Status, item.Chart, item.AppVersion, item.Description)
tbl.AddRow(item.Revision, item.Updated.Format(time.ANSIC), item.Status, item.Chart, item.AppVersion, item.Description)
}
return output.EncodeTable(out, tbl)
}

@ -18,16 +18,16 @@ package main
import (
"testing"
stdtime "time"
"time"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/time"
helmtime "helm.sh/helm/v3/pkg/time"
)
func TestStatusCmd(t *testing.T) {
releasesMockWithStatus := func(info *release.Info, hooks ...*release.Hook) []*release.Release {
info.LastDeployed = time.Unix(1452902400, 0).UTC()
info.LastDeployed = helmtime.Unix(1452902400, 0).UTC()
return []*release.Release{{
Name: "flummoxed-chickadee",
Namespace: "default",
@ -104,7 +104,7 @@ func TestStatusCmd(t *testing.T) {
runTestCmd(t, tests)
}
func mustParseTime(t string) time.Time {
res, _ := time.Parse(stdtime.RFC3339, t)
func mustParseTime(t string) helmtime.Time {
res, _ := helmtime.Parse(time.RFC3339, t)
return res
}

@ -18,16 +18,16 @@ package action
import (
"bytes"
"sort"
stdtime "time"
"time"
"github.com/pkg/errors"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/time"
helmtime "helm.sh/helm/v3/pkg/time"
)
// execHook executes all of the hooks for the given hook event.
func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent, timeout stdtime.Duration) error {
func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent, timeout time.Duration) error {
executingHooks := []*release.Hook{}
for _, h := range rl.Hooks {
@ -61,7 +61,7 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent,
// Record the time at which the hook was applied to the cluster
h.LastRun = release.HookExecution{
StartedAt: time.Now(),
StartedAt: helmtime.Now(),
Phase: release.HookPhaseRunning,
}
cfg.recordRelease(rl)
@ -73,7 +73,7 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent,
// Create hook resources
if _, err := cfg.KubeClient.Create(resources); err != nil {
h.LastRun.CompletedAt = time.Now()
h.LastRun.CompletedAt = helmtime.Now()
h.LastRun.Phase = release.HookPhaseFailed
return errors.Wrapf(err, "warning: Hook %s %s failed", hook, h.Path)
}
@ -81,7 +81,7 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent,
// Watch hook resources until they have completed
err = cfg.KubeClient.WatchUntilReady(resources, timeout)
// Note the time of success/failure
h.LastRun.CompletedAt = time.Now()
h.LastRun.CompletedAt = helmtime.Now()
// Mark hook as succeeded or failed
if err != nil {
h.LastRun.Phase = release.HookPhaseFailed

@ -20,12 +20,12 @@ import (
"bytes"
"fmt"
"strings"
stdtime "time"
"time"
"github.com/pkg/errors"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/time"
helmtime "helm.sh/helm/v3/pkg/time"
)
// Rollback is the action for rolling back to a given release.
@ -35,7 +35,7 @@ type Rollback struct {
cfg *Configuration
Version int
Timeout stdtime.Duration
Timeout time.Duration
Wait bool
DisableHooks bool
DryRun bool
@ -120,7 +120,7 @@ func (r *Rollback) prepareRollback(name string) (*release.Release, *release.Rele
Config: previousRelease.Config,
Info: &release.Info{
FirstDeployed: currentRelease.Info.FirstDeployed,
LastDeployed: time.Now(),
LastDeployed: helmtime.Now(),
Status: release.StatusPendingRollback,
Notes: previousRelease.Info.Notes,
// Because we lose the reference to previous version elsewhere, we set the

@ -18,13 +18,13 @@ package action
import (
"strings"
stdtime "time"
"time"
"github.com/pkg/errors"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/releaseutil"
"helm.sh/helm/v3/pkg/time"
helmtime "helm.sh/helm/v3/pkg/time"
)
// Uninstall is the action for uninstalling releases.
@ -36,7 +36,7 @@ type Uninstall struct {
DisableHooks bool
DryRun bool
KeepHistory bool
Timeout stdtime.Duration
Timeout time.Duration
}
// NewUninstall creates a new Uninstall object with the given configuration.
@ -90,7 +90,7 @@ func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error)
u.cfg.Log("uninstall: Deleting %s", name)
rel.Info.Status = release.StatusUninstalling
rel.Info.Deleted = time.Now()
rel.Info.Deleted = helmtime.Now()
rel.Info.Description = "Deletion in progress (or silently failed)"
res := &release.UninstallReleaseResponse{Release: rel}

@ -18,10 +18,10 @@ package releaseutil // import "helm.sh/helm/v3/pkg/releaseutil"
import (
"testing"
stdtime "time"
"time"
rspb "helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/time"
helmtime "helm.sh/helm/v3/pkg/time"
)
// note: this test data is shared with filter_test.go.
@ -33,8 +33,8 @@ var releases = []*rspb.Release{
tsRelease("vocal-dogs", 3, 6000, rspb.StatusUninstalled),
}
func tsRelease(name string, vers int, dur stdtime.Duration, status rspb.Status) *rspb.Release {
info := &rspb.Info{Status: status, LastDeployed: time.Now().Add(dur)}
func tsRelease(name string, vers int, dur time.Duration, status rspb.Status) *rspb.Release {
info := &rspb.Info{Status: status, LastDeployed: helmtime.Now().Add(dur)}
return &rspb.Release{
Name: name,
Version: vers,

Loading…
Cancel
Save