Skip to content

Commit 0b0fa38

Browse files
CR-15158 (#654)
* CR-15158 Co-authored-by: Daniel Soifer <daniel.soifer@codefresh.io>
1 parent 0356cd3 commit 0b0fa38

File tree

9 files changed

+47
-110
lines changed

9 files changed

+47
-110
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.15
1+
VERSION=v0.1.16
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/config.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ commands, respectively:
5555
cmd.AddCommand(NewConfigDeleteContextCommand())
5656
cmd.AddCommand(NewConfigSetRuntimeCommand())
5757
cmd.AddCommand(NewConfigGetRuntimeCommand())
58+
cmd.AddCommand(NewResetIscRepoUrlCommand())
5859

5960
return cmd
6061
}
@@ -272,3 +273,40 @@ func RunConfigDeleteContext(ctx context.Context, context string) error {
272273
log.G(ctx).Infof("Deleted context: %s", context)
273274
return nil
274275
}
276+
277+
func NewResetIscRepoUrlCommand() *cobra.Command {
278+
cmd := &cobra.Command{
279+
Use: "reset-shared-config-repo",
280+
Aliases: []string{"reset-isc"},
281+
Short: "Reset the URL of the shared configuration repo",
282+
Args: cobra.NoArgs,
283+
PersistentPreRunE: cfConfig.RequireAuthentication,
284+
PreRunE: func(cmd *cobra.Command, args []string) error {
285+
var err error
286+
var runtimesExist bool
287+
288+
ctx := cmd.Context()
289+
290+
runtimesExist, err = isRuntimesExist(ctx)
291+
if err != nil {
292+
return err
293+
}
294+
if runtimesExist {
295+
return fmt.Errorf("unable to reset the shared configuration repo as there are runtimes installed in the account. Uninstall all the runtimes from your account and try again")
296+
}
297+
298+
return nil
299+
},
300+
RunE: func(cmd *cobra.Command, _ []string) error {
301+
ctx := cmd.Context()
302+
err := resetIscRepoUrl(ctx)
303+
if err != nil {
304+
return fmt.Errorf("failed to reset account Internal Shared Repository url: %w", err)
305+
}
306+
fmt.Printf("shared configuration repo was reset successfully \n")
307+
return nil
308+
},
309+
}
310+
311+
return cmd
312+
}

cmd/commands/root.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ variables in advanced to simplify the use of those commands.
5959
cmd.AddCommand(NewPipelineCommand())
6060
cmd.AddCommand(NewIntegrationCommand())
6161
cmd.AddCommand(NewCompletionCommand())
62-
cmd.AddCommand(NewSettingCommand())
6362

6463
cobra.OnInitialize(func() { postInitCommands(cmd.Commands()) })
6564

cmd/commands/settings.go

Lines changed: 0 additions & 71 deletions
This file was deleted.

docs/commands/cli-v2.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ cli-v2 [flags]
4040
* [cli-v2 integration](cli-v2_integration.md) - Manage integrations with git providers, container registries and more
4141
* [cli-v2 pipeline](cli-v2_pipeline.md) - Manage pipelines of Codefresh runtimes
4242
* [cli-v2 runtime](cli-v2_runtime.md) - Manage Codefresh runtimes
43-
* [cli-v2 settings](cli-v2_settings.md) - Settings commands
4443
* [cli-v2 upgrade](cli-v2_upgrade.md) - Upgrades the cli
4544
* [cli-v2 version](cli-v2_version.md) - Show cli version
4645
* [cli-v2 workflow](cli-v2_workflow.md) - Manage workflows of Codefresh runtimes

docs/commands/cli-v2_config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ cli-v2 config [flags]
4343
* [cli-v2 config delete-context](cli-v2_config_delete-context.md) - Delete the specified authentication context
4444
* [cli-v2 config get-contexts](cli-v2_config_get-contexts.md) - Lists all Codefresh authentication contexts
4545
* [cli-v2 config get-runtime](cli-v2_config_get-runtime.md) - Gets the default runtime for the current authentication context
46+
* [cli-v2 config reset-shared-config-repo](cli-v2_config_reset-shared-config-repo.md) - Reset the URL of the shared configuration repo
4647
* [cli-v2 config set-runtime](cli-v2_config_set-runtime.md) - Sets the default runtime name to use for the current authentication context
4748
* [cli-v2 config use-context](cli-v2_config_use-context.md) - Switch the current authentication context
4849

docs/commands/cli-v2_settings_reset-isc-url.md renamed to docs/commands/cli-v2_config_reset-shared-config-repo.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
## cli-v2 settings reset-isc-url
1+
## cli-v2 config reset-shared-config-repo
22

3-
Reset the URL of the shared configurations repo.
3+
Reset the URL of the shared configuration repo
44

55
```
6-
cli-v2 settings reset-isc-url [flags]
6+
cli-v2 config reset-shared-config-repo [flags]
77
```
88

99
### Options
1010

1111
```
12-
-h, --help help for reset-isc-url
12+
-h, --help help for reset-shared-config-repo
1313
```
1414

1515
### Options inherited from parent commands
@@ -24,5 +24,5 @@ cli-v2 settings reset-isc-url [flags]
2424

2525
### SEE ALSO
2626

27-
* [cli-v2 settings](cli-v2_settings.md) - Settings commands
27+
* [cli-v2 config](cli-v2_config.md) - Manage Codefresh authentication contexts
2828

docs/commands/cli-v2_settings.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.15/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.16/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.15/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.16/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

0 commit comments

Comments
 (0)