@@ -30,9 +30,9 @@ import (
30
30
routingutil "github.com/codefresh-io/cli-v2/pkg/util/routing"
31
31
wfutil "github.com/codefresh-io/cli-v2/pkg/util/workflow"
32
32
33
- "github.com/argoproj-labs/argocd-autopilot/pkg/application"
34
- "github.com/argoproj-labs/argocd-autopilot/pkg/fs"
35
- "github.com/argoproj-labs/argocd-autopilot/pkg/git"
33
+ apapp "github.com/argoproj-labs/argocd-autopilot/pkg/application"
34
+ apfs "github.com/argoproj-labs/argocd-autopilot/pkg/fs"
35
+ apgit "github.com/argoproj-labs/argocd-autopilot/pkg/git"
36
36
aputil "github.com/argoproj-labs/argocd-autopilot/pkg/util"
37
37
apicommon "github.com/argoproj/argo-events/pkg/apis/common"
38
38
eventsourcereg "github.com/argoproj/argo-events/pkg/apis/eventsource"
@@ -53,8 +53,8 @@ import (
53
53
54
54
type (
55
55
GitSourceCreateOptions struct {
56
- InsCloneOpts * git .CloneOptions
57
- GsCloneOpts * git .CloneOptions
56
+ InsCloneOpts * apgit .CloneOptions
57
+ GsCloneOpts * apgit .CloneOptions
58
58
GsName string
59
59
RuntimeName string
60
60
RuntimeNamespace string
@@ -82,22 +82,22 @@ type (
82
82
GitSourceEditOptions struct {
83
83
RuntimeName string
84
84
GsName string
85
- GsCloneOpts * git .CloneOptions
85
+ GsCloneOpts * apgit .CloneOptions
86
86
Include * string
87
87
Exclude * string
88
88
}
89
89
90
90
gitSourceCalendarDemoPipelineOptions struct {
91
91
runtimeName string
92
- gsCloneOpts * git .CloneOptions
93
- gsFs fs .FS
92
+ gsCloneOpts * apgit .CloneOptions
93
+ gsFs apfs .FS
94
94
}
95
95
96
96
gitSourceGitDemoPipelineOptions struct {
97
97
runtimeName string
98
- gsCloneOpts * git .CloneOptions
98
+ gsCloneOpts * apgit .CloneOptions
99
99
gitProvider cfgit.Provider
100
- gsFs fs .FS
100
+ gsFs apfs .FS
101
101
hostName string
102
102
ingressHost string
103
103
skipIngress bool
@@ -132,7 +132,7 @@ func NewGitSourceCommand() *cobra.Command {
132
132
133
133
func NewGitSourceCreateCommand () * cobra.Command {
134
134
var (
135
- gsCloneOpts * git .CloneOptions
135
+ gsCloneOpts * apgit .CloneOptions
136
136
gitProvider cfgit.Provider
137
137
createRepo bool
138
138
include string
@@ -188,17 +188,22 @@ func NewGitSourceCreateCommand() *cobra.Command {
188
188
RunE : func (cmd * cobra.Command , args []string ) error {
189
189
ctx := cmd .Context ()
190
190
191
- runtimeNamespace := args [0 ]
192
- namespace := cmd .Flag ("namespace" ).Value .String ()
193
- if namespace != "" {
194
- runtimeNamespace = namespace
191
+ runtimeName := args [0 ]
192
+ runtime , err := getRuntime (ctx , runtimeName )
193
+ if err != nil {
194
+ return err
195
+ }
196
+
197
+ runtimeNamespace := runtimeName
198
+ if runtime .Metadata .Namespace != nil {
199
+ runtimeNamespace = * runtime .Metadata .Namespace
195
200
}
196
201
197
202
return RunGitSourceCreate (ctx , & GitSourceCreateOptions {
198
203
GsCloneOpts : gsCloneOpts ,
199
204
GitProvider : gitProvider ,
200
205
GsName : args [1 ],
201
- RuntimeName : args [ 0 ] ,
206
+ RuntimeName : runtimeName ,
202
207
RuntimeNamespace : runtimeNamespace ,
203
208
CreateDemoResources : false ,
204
209
Include : include ,
@@ -245,7 +250,7 @@ func RunGitSourceCreate(ctx context.Context, opts *GitSourceCreateOptions) error
245
250
return nil
246
251
}
247
252
248
- func ensureGitSourceDirectory (ctx context.Context , opts * GitSourceCreateOptions , gsRepo git .Repository , gsFs fs .FS ) error {
253
+ func ensureGitSourceDirectory (ctx context.Context , opts * GitSourceCreateOptions , gsRepo apgit .Repository , gsFs apfs .FS ) error {
249
254
fi , err := gsFs .ReadDir ("." )
250
255
if err != nil {
251
256
return fmt .Errorf ("failed to read files in git-source repo. Err: %w" , err )
@@ -411,7 +416,7 @@ func RunGitSourceDelete(ctx context.Context, opts *GitSourceDeleteOptions) error
411
416
412
417
func NewGitSourceEditCommand () * cobra.Command {
413
418
var (
414
- gsCloneOpts * git .CloneOptions
419
+ gsCloneOpts * apgit .CloneOptions
415
420
include string
416
421
exclude string
417
422
)
@@ -492,7 +497,7 @@ func RunGitSourceEdit(ctx context.Context, opts *GitSourceEditOptions) error {
492
497
return nil
493
498
}
494
499
495
- func createDemoResources (ctx context.Context , opts * GitSourceCreateOptions , gsRepo git .Repository , gsFs fs .FS ) error {
500
+ func createDemoResources (ctx context.Context , opts * GitSourceCreateOptions , gsRepo apgit .Repository , gsFs apfs .FS ) error {
496
501
fi , err := gsFs .ReadDir ("." )
497
502
if err != nil {
498
503
return fmt .Errorf ("failed to read files in git-source repo. Err: %w" , err )
@@ -1391,7 +1396,7 @@ func deleteCommonRedundantFields(crd map[string]interface{}) {
1391
1396
}
1392
1397
1393
1398
func writeObjectToYaml [Object any ](
1394
- gsFs fs .FS ,
1399
+ gsFs apfs .FS ,
1395
1400
filePath string ,
1396
1401
object Object ,
1397
1402
cleanUpFunc func (Object ) (map [string ]interface {}, error ),
@@ -1425,7 +1430,7 @@ func legacyGitSourceCreate(ctx context.Context, opts *GitSourceCreateOptions) er
1425
1430
1426
1431
appDef := & runtime.AppDef {
1427
1432
Name : opts .GsName ,
1428
- Type : application .AppTypeDirectory ,
1433
+ Type : apapp .AppTypeDirectory ,
1429
1434
URL : opts .GsCloneOpts .Repo ,
1430
1435
Include : opts .Include ,
1431
1436
Exclude : opts .Exclude ,
0 commit comments