[feature] add --skip-refresh to globals (#1736)

This commit is contained in:
Shane Starcher
2024-10-12 19:56:55 +08:00
committed by GitHub
parent 4beb2ac042
commit b6ab825d3c
10 changed files with 62 additions and 16 deletions
+10 -10
View File
@@ -175,7 +175,7 @@ func (a *App) Diff(c DiffConfigProvider) error {
includeCRDs := !c.SkipCRDs()
prepErr := run.withPreparedCharts("diff", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
IncludeCRDs: &includeCRDs,
Validate: c.Validate(),
@@ -240,7 +240,7 @@ func (a *App) Template(c TemplateConfigProvider) error {
run.helm.SetEnableLiveOutput(false)
prepErr := run.withPreparedCharts("template", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
IncludeCRDs: &includeCRDs,
SkipCleanup: c.SkipCleanup(),
@@ -264,7 +264,7 @@ func (a *App) Template(c TemplateConfigProvider) error {
func (a *App) WriteValues(c WriteValuesConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
prepErr := run.withPreparedCharts("write-values", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
SkipCleanup: c.SkipCleanup(),
Concurrency: c.Concurrency(),
@@ -315,7 +315,7 @@ func (a *App) Lint(c LintConfigProvider) error {
// `helm lint` on helm v2 and v3 does not support remote charts, that we need to set `forceDownload=true` here
prepErr := run.withPreparedCharts("lint", state.ChartPrepareOptions{
ForceDownload: true,
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
SkipCleanup: c.SkipCleanup(),
Concurrency: c.Concurrency(),
@@ -350,7 +350,7 @@ func (a *App) Fetch(c FetchConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
prepErr := run.withPreparedCharts("pull", state.ChartPrepareOptions{
ForceDownload: true,
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
OutputDir: c.OutputDir(),
OutputDirTemplate: c.OutputDirTemplate(),
@@ -371,7 +371,7 @@ func (a *App) Sync(c SyncConfigProvider) error {
includeCRDs := !c.SkipCRDs()
prepErr := run.withPreparedCharts("sync", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Wait: c.Wait(),
WaitForJobs: c.WaitForJobs(),
@@ -404,7 +404,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
includeCRDs := !c.SkipCRDs()
prepErr := run.withPreparedCharts("apply", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Wait: c.Wait(),
WaitForJobs: c.WaitForJobs(),
@@ -466,7 +466,7 @@ func (a *App) Delete(c DeleteConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
if !c.SkipCharts() {
err := run.withPreparedCharts("delete", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Concurrency: c.Concurrency(),
DeleteWait: c.DeleteWait(),
@@ -489,7 +489,7 @@ func (a *App) Destroy(c DestroyConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
if !c.SkipCharts() {
err := run.withPreparedCharts("destroy", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Concurrency: c.Concurrency(),
DeleteWait: c.DeleteWait(),
@@ -516,7 +516,7 @@ func (a *App) Test(c TestConfigProvider) error {
}
err := run.withPreparedCharts("test", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Concurrency: c.Concurrency(),
}, func() {
+10
View File
@@ -2092,6 +2092,7 @@ type configImpl struct {
skipCleanup bool
skipCRDs bool
skipDeps bool
skipRefresh bool
skipTests bool
skipNeeds bool
@@ -2133,6 +2134,10 @@ func (c configImpl) SkipDeps() bool {
return c.skipDeps
}
func (c configImpl) SkipRefresh() bool {
return c.skipRefresh
}
func (c configImpl) SkipNeeds() bool {
return c.skipNeeds
}
@@ -2206,6 +2211,7 @@ type applyConfig struct {
skipCleanup bool
skipCRDs bool
skipDeps bool
skipRefresh bool
skipNeeds bool
includeNeeds bool
includeTransitiveNeeds bool
@@ -2282,6 +2288,10 @@ func (a applyConfig) SkipDeps() bool {
return a.skipDeps
}
func (a applyConfig) SkipRefresh() bool {
return a.skipRefresh
}
func (a applyConfig) SkipNeeds() bool {
return a.skipNeeds
}
+11
View File
@@ -10,6 +10,7 @@ type ConfigProvider interface {
StripArgsValuesOnExitError() bool
DisableForceUpdate() bool
SkipDeps() bool
SkipRefresh() bool
FileOrDir() string
KubeContext() string
@@ -58,6 +59,7 @@ type ApplyConfigProvider interface {
Set() []string
SkipCRDs() bool
SkipDeps() bool
SkipRefresh() bool
Wait() bool
WaitForJobs() bool
@@ -106,6 +108,7 @@ type SyncConfigProvider interface {
Set() []string
SkipCRDs() bool
SkipDeps() bool
SkipRefresh() bool
Wait() bool
WaitForJobs() bool
SyncArgs() string
@@ -134,6 +137,7 @@ type DiffConfigProvider interface {
Validate() bool
SkipCRDs() bool
SkipDeps() bool
SkipRefresh() bool
IncludeTests() bool
@@ -165,6 +169,7 @@ type DeleteConfigProvider interface {
Purge() bool
SkipDeps() bool
SkipRefresh() bool
SkipCharts() bool
DeleteWait() bool
DeleteTimeout() int
@@ -179,6 +184,7 @@ type DestroyConfigProvider interface {
Cascade() string
SkipDeps() bool
SkipRefresh() bool
SkipCharts() bool
DeleteWait() bool
DeleteTimeout() int
@@ -192,6 +198,7 @@ type TestConfigProvider interface {
Args() string
SkipDeps() bool
SkipRefresh() bool
Timeout() int
Cleanup() bool
Logs() bool
@@ -205,6 +212,7 @@ type LintConfigProvider interface {
Values() []string
Set() []string
SkipDeps() bool
SkipRefresh() bool
SkipCleanup() bool
DAGConfig
@@ -214,6 +222,7 @@ type LintConfigProvider interface {
type FetchConfigProvider interface {
SkipDeps() bool
SkipRefresh() bool
OutputDir() string
OutputDirTemplate() string
@@ -230,6 +239,7 @@ type TemplateConfigProvider interface {
OutputDirTemplate() string
Validate() bool
SkipDeps() bool
SkipRefresh() bool
SkipCleanup() bool
SkipTests() bool
OutputDir() string
@@ -253,6 +263,7 @@ type WriteValuesConfigProvider interface {
Set() []string
OutputFileTemplate() string
SkipDeps() bool
SkipRefresh() bool
SkipCleanup() bool
IncludeTransitiveNeeds() bool
+5
View File
@@ -38,6 +38,7 @@ type destroyConfig struct {
concurrency int
interactive bool
skipDeps bool
skipRefresh bool
logger *zap.SugaredLogger
includeTransitiveNeeds bool
skipCharts bool
@@ -73,6 +74,10 @@ func (d destroyConfig) SkipDeps() bool {
return d.skipDeps
}
func (d destroyConfig) SkipRefresh() bool {
return d.skipRefresh
}
func (d destroyConfig) IncludeTransitiveNeeds() bool {
return d.includeTransitiveNeeds
}
+5
View File
@@ -24,6 +24,7 @@ type diffConfig struct {
validate bool
skipCRDs bool
skipDeps bool
skipRefresh bool
includeTests bool
skipNeeds bool
includeNeeds bool
@@ -74,6 +75,10 @@ func (a diffConfig) SkipDeps() bool {
return a.skipDeps
}
func (a diffConfig) SkipRefresh() bool {
return a.skipRefresh
}
func (a diffConfig) IncludeTests() bool {
return a.includeTests
}