@@ -263,6 +263,7 @@ func NewRuntimeInstallCommand() *cobra.Command {
263
263
264
264
installationOpts .InsCloneOpts = apu .AddCloneFlags (cmd , & apu.CloneFlagsOptions {
265
265
CreateIfNotExist : true ,
266
+ CloneForWrite : true ,
266
267
})
267
268
268
269
installationOpts .GsCloneOpts = & git.CloneOptions {
@@ -1393,7 +1394,7 @@ func NewRuntimeUninstallCommand() *cobra.Command {
1393
1394
cmd .Flags ().BoolVar (& uninstallationOpts .Force , "force" , false , "If true, will guarantee the runtime is removed from the platform, even in case of errors while cleaning the repo and the cluster" )
1394
1395
cmd .Flags ().BoolVar (& uninstallationOpts .FastExit , "fast-exit" , false , "If true, will not wait for deletion of cluster resources. This means that full resource deletion will not be verified" )
1395
1396
1396
- uninstallationOpts .CloneOpts = apu .AddCloneFlags (cmd , & apu.CloneFlagsOptions {})
1397
+ uninstallationOpts .CloneOpts = apu .AddCloneFlags (cmd , & apu.CloneFlagsOptions {CloneForWrite : true })
1397
1398
uninstallationOpts .KubeFactory = kube .AddFlags (cmd .Flags ())
1398
1399
1399
1400
return cmd
@@ -1667,7 +1668,7 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
1667
1668
}
1668
1669
1669
1670
cmd .Flags ().StringVar (& versionStr , "version" , "" , "The runtime version to upgrade to, defaults to latest" )
1670
- opts .CloneOpts = apu .AddCloneFlags (cmd , & apu.CloneFlagsOptions {})
1671
+ opts .CloneOpts = apu .AddCloneFlags (cmd , & apu.CloneFlagsOptions {CloneForWrite : true })
1671
1672
1672
1673
return cmd
1673
1674
}
@@ -1919,10 +1920,19 @@ func createEventsReporter(ctx context.Context, cloneOpts *git.CloneOptions, opts
1919
1920
}
1920
1921
1921
1922
resPath := cloneOpts .FS .Join (apstore .Default .AppsDir , store .Get ().EventsReporterName , opts .RuntimeName , "resources" )
1923
+ u , err := url .Parse (cloneOpts .URL ())
1924
+ if err != nil {
1925
+ return fmt .Errorf ("failed to parse url: %w" , err )
1926
+ }
1927
+ u .Path += "/" + resPath
1928
+ q := u .Query ()
1929
+ q .Add ("ref" , cloneOpts .Revision ())
1930
+ u .RawQuery = q .Encode ()
1931
+
1922
1932
appDef := & runtime.AppDef {
1923
1933
Name : store .Get ().EventsReporterName ,
1924
1934
Type : application .AppTypeDirectory ,
1925
- URL : cloneOpts . URL () + "/" + resPath ,
1935
+ URL : u . String () ,
1926
1936
IsInternal : true ,
1927
1937
}
1928
1938
if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , store .Get ().CFComponentType , "" , "" ); err != nil {
@@ -1950,10 +1960,19 @@ func createEventsReporter(ctx context.Context, cloneOpts *git.CloneOptions, opts
1950
1960
1951
1961
func createReporter (ctx context.Context , cloneOpts * git.CloneOptions , opts * RuntimeInstallOptions , reporterCreateOpts reporterCreateOptions ) error {
1952
1962
resPath := cloneOpts .FS .Join (apstore .Default .AppsDir , reporterCreateOpts .reporterName , opts .RuntimeName , "resources" )
1963
+ u , err := url .Parse (cloneOpts .URL ())
1964
+ if err != nil {
1965
+ return fmt .Errorf ("failed to parse url: %w" , err )
1966
+ }
1967
+ u .Path += "/" + resPath
1968
+ q := u .Query ()
1969
+ q .Add ("ref" , cloneOpts .Revision ())
1970
+ u .RawQuery = q .Encode ()
1971
+
1953
1972
appDef := & runtime.AppDef {
1954
1973
Name : reporterCreateOpts .reporterName ,
1955
1974
Type : application .AppTypeDirectory ,
1956
- URL : cloneOpts . URL () + "/" + resPath ,
1975
+ URL : u . String () ,
1957
1976
IsInternal : reporterCreateOpts .IsInternal ,
1958
1977
}
1959
1978
if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , store .Get ().CFComponentType , "" , "" ); err != nil {
0 commit comments