99 "strings"
1010
1111 "github.com/jenkins-x-plugins/jx-gitops/pkg/chart"
12- "github.com/jenkins-x/jx-helpers/v3/pkg/yamls"
13-
1412 "github.com/jenkins-x-plugins/jx-gitops/pkg/ghpages"
1513 "github.com/jenkins-x-plugins/jx-gitops/pkg/plugins"
1614 "github.com/jenkins-x-plugins/jx-gitops/pkg/rootcmd"
@@ -29,6 +27,7 @@ import (
2927 "github.com/jenkins-x/jx-helpers/v3/pkg/scmhelpers"
3028 "github.com/jenkins-x/jx-helpers/v3/pkg/stringhelpers"
3129 "github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
30+ "github.com/jenkins-x/jx-helpers/v3/pkg/yamls"
3231 "github.com/jenkins-x/jx-logging/v3/pkg/log"
3332 "github.com/pkg/errors"
3433 "github.com/spf13/cobra"
@@ -102,6 +101,7 @@ type Options struct {
102101 CommandRunner cmdrunner.CommandRunner
103102 Requirements * jxcore.RequirementsConfig
104103 ReleasedCharts int
104+ Cmd * cobra.Command
105105}
106106
107107// NewCmdHelmRelease creates a command object for the command
@@ -113,7 +113,8 @@ func NewCmdHelmRelease() (*cobra.Command, *Options) {
113113 Short : "Performs a release of all the charts in the charts folder" ,
114114 Long : cmdLong ,
115115 Example : fmt .Sprintf (cmdExample , rootcmd .BinaryName ),
116- Run : func (_ * cobra.Command , _ []string ) {
116+ Run : func (cmd * cobra.Command , _ []string ) {
117+ o .Cmd = cmd
117118 err := o .Run ()
118119 helper .CheckErr (err )
119120 },
@@ -291,10 +292,14 @@ func (o *Options) Run() error {
291292
292293 // find the repository URL
293294 if repoURL == "" {
294- repoURL , err = variablefinders .FindRepositoryURL (o .Requirements , o .ContainerRegistryOrg , name )
295- if err != nil {
296- return errors .Wrapf (err , "failed to find chart repository URL" )
297- }
295+ repoURL = variablefinders .FindRepositoryURL (
296+ o .Requirements ,
297+ o .ContainerRegistryOrg ,
298+ name ,
299+ o .ChartOCI ,
300+ o .ChartPages ,
301+ o .flagChanged ("repo-url" ),
302+ )
298303 }
299304 if o .ChartPages {
300305 err = o .ChartPageRegistry (repoURL , chartDir , name )
@@ -701,3 +706,14 @@ func (o *Options) findChartRepositoryUserPassword() (string, string, error) {
701706 }
702707 return userName , password , err
703708}
709+
710+ // FlagChanged returns true if the given flag was supplied on the command line
711+ func (o * Options ) flagChanged (name string ) bool {
712+ if o .Cmd != nil {
713+ f := o .Cmd .Flag (name )
714+ if f != nil {
715+ return f .Changed
716+ }
717+ }
718+ return false
719+ }
0 commit comments