File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
pkg/plugins/optional/helm/v1alpha/scaffolds Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -231,16 +231,27 @@ func (s *initScaffolder) copyConfigFiles() error {
231231 }
232232
233233 for _ , dir := range configDirs {
234- // Ensure destination directory exists
235- if err := os .MkdirAll (dir .DestDir , os .ModePerm ); err != nil {
236- return fmt .Errorf ("failed to create directory %s: %v" , dir .DestDir , err )
234+ // Check if the source directory exists
235+ if _ , err := os .Stat (dir .SrcDir ); os .IsNotExist (err ) {
236+ // Skip if the source directory does not exist
237+ continue
237238 }
238239
239240 files , err := filepath .Glob (filepath .Join (dir .SrcDir , "*.yaml" ))
240241 if err != nil {
241242 return err
242243 }
243244
245+ // Skip processing if the directory is empty (no matching files)
246+ if len (files ) == 0 {
247+ continue
248+ }
249+
250+ // Ensure destination directory exists
251+ if err := os .MkdirAll (dir .DestDir , os .ModePerm ); err != nil {
252+ return fmt .Errorf ("failed to create directory %s: %v" , dir .DestDir , err )
253+ }
254+
244255 for _ , srcFile := range files {
245256 destFile := filepath .Join (dir .DestDir , filepath .Base (srcFile ))
246257 err := copyFileWithHelmLogic (srcFile , destFile , dir .SubDir , s .config .GetProjectName ())
You can’t perform that action at this time.
0 commit comments