Add `--skip-tests` to helmfile template command (#2057)
* Add skip-tests to helmfile template command * Fix formatting
This commit is contained in:
		
							parent
							
								
									87e5903705
								
							
						
					
					
						commit
						debd3c0eea
					
				
							
								
								
									
										8
									
								
								main.go
								
								
								
								
							
							
						
						
									
										8
									
								
								main.go
								
								
								
								
							|  | @ -282,6 +282,10 @@ func main() { | ||||||
| 					Name:  "include-crds", | 					Name:  "include-crds", | ||||||
| 					Usage: "include CRDs in the templated output", | 					Usage: "include CRDs in the templated output", | ||||||
| 				}, | 				}, | ||||||
|  | 				cli.BoolFlag{ | ||||||
|  | 					Name:  "skip-tests", | ||||||
|  | 					Usage: "skip tests from templated output", | ||||||
|  | 				}, | ||||||
| 				cli.BoolFlag{ | 				cli.BoolFlag{ | ||||||
| 					Name:  "include-needs", | 					Name:  "include-needs", | ||||||
| 					Usage: `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when when --selector/-l flag is not provided`, | 					Usage: `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when when --selector/-l flag is not provided`, | ||||||
|  | @ -934,6 +938,10 @@ func (c configImpl) IncludeCRDs() bool { | ||||||
| 	return c.c.Bool("include-crds") | 	return c.c.Bool("include-crds") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (c configImpl) SkipTests() bool { | ||||||
|  | 	return c.c.Bool("skip-tests") | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (c configImpl) Logger() *zap.SugaredLogger { | func (c configImpl) Logger() *zap.SugaredLogger { | ||||||
| 	return c.c.App.Metadata["logger"].(*zap.SugaredLogger) | 	return c.c.App.Metadata["logger"].(*zap.SugaredLogger) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1858,6 +1858,7 @@ func (a *App) template(r *Run, c TemplateConfigProvider) (bool, []error) { | ||||||
| 				IncludeCRDs:       c.IncludeCRDs(), | 				IncludeCRDs:       c.IncludeCRDs(), | ||||||
| 				OutputDirTemplate: c.OutputDirTemplate(), | 				OutputDirTemplate: c.OutputDirTemplate(), | ||||||
| 				SkipCleanup:       c.SkipCleanup(), | 				SkipCleanup:       c.SkipCleanup(), | ||||||
|  | 				SkipTests:         c.SkipTests(), | ||||||
| 			} | 			} | ||||||
| 			return subst.TemplateReleases(helm, c.OutputDir(), c.Values(), args, c.Concurrency(), c.Validate(), opts) | 			return subst.TemplateReleases(helm, c.OutputDir(), c.Values(), args, c.Concurrency(), c.Validate(), opts) | ||||||
| 		})) | 		})) | ||||||
|  |  | ||||||
|  | @ -2268,6 +2268,7 @@ type configImpl struct { | ||||||
| 	skipCleanup bool | 	skipCleanup bool | ||||||
| 	skipCRDs    bool | 	skipCRDs    bool | ||||||
| 	skipDeps    bool | 	skipDeps    bool | ||||||
|  | 	skipTests   bool | ||||||
| 
 | 
 | ||||||
| 	skipNeeds              bool | 	skipNeeds              bool | ||||||
| 	includeNeeds           bool | 	includeNeeds           bool | ||||||
|  | @ -2310,6 +2311,10 @@ func (c configImpl) SkipNeeds() bool { | ||||||
| 	return c.skipNeeds | 	return c.skipNeeds | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (c configImpl) SkipTests() bool { | ||||||
|  | 	return c.skipTests | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (c configImpl) IncludeNeeds() bool { | func (c configImpl) IncludeNeeds() bool { | ||||||
| 	return c.includeNeeds | 	return c.includeNeeds | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -177,6 +177,7 @@ type TemplateConfigProvider interface { | ||||||
| 	Validate() bool | 	Validate() bool | ||||||
| 	SkipDeps() bool | 	SkipDeps() bool | ||||||
| 	SkipCleanup() bool | 	SkipCleanup() bool | ||||||
|  | 	SkipTests() bool | ||||||
| 	OutputDir() string | 	OutputDir() string | ||||||
| 	IncludeCRDs() bool | 	IncludeCRDs() bool | ||||||
| 	IncludeNeeds() bool | 	IncludeNeeds() bool | ||||||
|  |  | ||||||
|  | @ -1307,6 +1307,7 @@ type TemplateOpts struct { | ||||||
| 	SkipCleanup       bool | 	SkipCleanup       bool | ||||||
| 	OutputDirTemplate string | 	OutputDirTemplate string | ||||||
| 	IncludeCRDs       bool | 	IncludeCRDs       bool | ||||||
|  | 	SkipTests         bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type TemplateOpt interface{ Apply(*TemplateOpts) } | type TemplateOpt interface{ Apply(*TemplateOpts) } | ||||||
|  | @ -1385,6 +1386,10 @@ func (st *HelmState) TemplateReleases(helm helmexec.Interface, outputDir string, | ||||||
| 			flags = append(flags, "--include-crds") | 			flags = append(flags, "--include-crds") | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		if opts.SkipTests { | ||||||
|  | 			flags = append(flags, "--skip-tests") | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		if len(errs) == 0 { | 		if len(errs) == 0 { | ||||||
| 			if err := helm.TemplateRelease(release.Name, release.Chart, flags...); err != nil { | 			if err := helm.TemplateRelease(release.Name, release.Chart, flags...); err != nil { | ||||||
| 				errs = append(errs, err) | 				errs = append(errs, err) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue