Skip to content

Commit

Permalink
fix: GetApps should clone to environments/dev, not environments
Browse files Browse the repository at this point in the history
Also adds `--auto-merge` to `jx delete app`

fixes jenkins-x#6350

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
  • Loading branch information
abayer committed Jan 9, 2020
1 parent 3c423bd commit a7ae93a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/apps/gitops.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func (o *GitOpsOptions) DeleteApp(app string, alias string, autoMerge bool) erro

// GetApps retrieves all the apps information for the given appNames from the repository and / or the CRD API
func (o *GitOpsOptions) GetApps(appNames map[string]bool, expandFn func([]string) (*v1.AppList, error)) (*v1.AppList, error) {
dir := filepath.Join(o.EnvironmentsDir, o.DevEnv.Name)
dir, _, _, _, err := gits.ForkAndPullRepo(o.DevEnv.Spec.Source.URL, o.EnvironmentsDir, o.DevEnv.Spec.Source.Ref, "master", o.GitProvider, o.Gitter, "")
if err != nil {
return nil, errors.Wrapf(err, "couldn't pull the environment repository from %s", o.DevEnv.Name)
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/deletecmd/delete_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type DeleteAppOptions struct {
Namespace string
Purge bool
Alias string
AutoMerge bool
}

// NewCmdDeleteApp creates a command object for this command
Expand Down Expand Up @@ -74,6 +75,7 @@ func NewCmdDeleteApp(commonOpts *opts.CommonOptions) *cobra.Command {
cmd.Flags().StringVarP(&o.Namespace, opts.OptionNamespace, "n", defaultNamespace, "The Namespace to install into (available when NOT using GitOps for your dev environment)")
cmd.Flags().StringVarP(&o.Alias, opts.OptionAlias, "", "",
"An alias to use for the app (available when using GitOps for your dev environment)")
cmd.Flags().BoolVarP(&o.AutoMerge, "auto-merge", "", false, "Automatically merge GitOps pull requests that pass CI")

return cmd
}
Expand All @@ -89,6 +91,7 @@ func (o *DeleteAppOptions) Run() error {
GitOps: o.GitOps,
BatchMode: o.BatchMode,
Helmer: o.Helm(),
AutoMerge: o.AutoMerge,
}

if o.GitOps {
Expand Down

0 comments on commit a7ae93a

Please sign in to comment.