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 {
231
231
}
232
232
233
233
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
237
238
}
238
239
239
240
files , err := filepath .Glob (filepath .Join (dir .SrcDir , "*.yaml" ))
240
241
if err != nil {
241
242
return err
242
243
}
243
244
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
+
244
255
for _ , srcFile := range files {
245
256
destFile := filepath .Join (dir .DestDir , filepath .Base (srcFile ))
246
257
err := copyFileWithHelmLogic (srcFile , destFile , dir .SubDir , s .config .GetProjectName ())
You can’t perform that action at this time.
0 commit comments