Skip to content

Commit

Permalink
Update/Create cli documentation for newer commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsbhat committed Jun 13, 2023
1 parent 1e01018 commit f4b9969
Show file tree
Hide file tree
Showing 109 changed files with 664 additions and 187 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ This cli uses GoCD golang [sdk](https://github.com/nikhilsbhat/gocd-sdk-go). If
* [Go](https://golang.org/dl/) 1.17 or above . Installing go can be found [here](https://golang.org/doc/install).
* Basic understanding of CI/CD server [GoCD](https://www.gocd.org/) and GoCD golang [sdk](https://github.com/nikhilsbhat/gocd-sdk-go).

## Authorization

The authorization configuration used for GoCD can be cached locally so that it can be used for future operations.

The command `auth-config` will do the work.

```shell
gocd-cli auth-config store --server-url <gocd-url> --username <username> --password <password>
# Running the above command should cache configurations under $HOME/.gocd/auth_config.yaml.

# Once we have authorization configurations cached, we do not need to pass the credentials every time we invoke the cli.
gocd-cli environment list
```

## Documentation

Updated documentation on all available commands and flags can be found [here](https://github.com/nikhilsbhat/gocd-cli/blob/main/docs/doc/gocd-cli.md).
Expand Down
2 changes: 1 addition & 1 deletion cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
func registerAuthConfigCommand() *cobra.Command {
registerAuthConfigCmd := &cobra.Command{
Use: "auth-config",
Short: "Command to set/remove the authorization configuration to be used by the cli",
Short: "Command to store/remove the authorization configuration to be used by the cli",
Long: `Using the auth config commands, one can cache the authorization configuration onto a file so it can be used by further calls made using this utility.
Also, the cached authentication configurations can be erased using the same`,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
5 changes: 3 additions & 2 deletions docs/doc/gocd-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ gocd-cli [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -34,6 +33,8 @@ gocd-cli [flags]
### SEE ALSO

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]
* [gocd-cli artifact](gocd-cli_artifact.md) - Command to operate on artifacts store/config present in GoCD
* [gocd-cli auth-config](gocd-cli_auth-config.md) - Command to store/remove the authorization configuration to be used by the cli
* [gocd-cli backup](gocd-cli_backup.md) - Command to operate on backup in GoCD [https://api.gocd.org/current/#backups]
* [gocd-cli cluster-profile](gocd-cli_cluster-profile.md) - Command to operate on cluster-profile present in GoCD [https://api.gocd.org/current/#cluster-profiles]
* [gocd-cli configrepo](gocd-cli_configrepo.md) - Command to operate on configrepo present in GoCD [https://api.gocd.org/current/#config-repo]
Expand All @@ -49,4 +50,4 @@ gocd-cli [flags]
* [gocd-cli user](gocd-cli_user.md) - Command to operate on users in GoCD [https://api.gocd.org/current/#users]
* [gocd-cli version](gocd-cli_version.md) - Command to fetch the version of gocd-cli installed

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ gocd-cli agents [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -48,4 +47,4 @@ gocd-cli agents [flags]
* [gocd-cli agents list](gocd-cli_agents_list.md) - Command to LIST all the agents present in GoCD [https://api.gocd.org/current/#get-all-agents]
* [gocd-cli agents update](gocd-cli_agents_update.md) - Command to UPDATE an agent with all specified configuration [https://api.gocd.org/current/#update-an-agent]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gocd-cli agents delete [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -36,4 +35,4 @@ gocd-cli agents delete [flags]

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents_get-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gocd-cli agents get-all [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -36,4 +35,4 @@ gocd-cli agents get-all [flags]

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gocd-cli agents get [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -36,4 +35,4 @@ gocd-cli agents get [flags]

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents_job-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gocd-cli agents job-history [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -36,4 +35,4 @@ gocd-cli agents job-history [flags]

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents_kill-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gocd-cli agents kill-task [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -36,4 +35,4 @@ gocd-cli agents kill-task [flags]

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gocd-cli agents list [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -36,4 +35,4 @@ gocd-cli agents list [flags]

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
3 changes: 1 addition & 2 deletions docs/doc/gocd-cli_agents_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gocd-cli agents update [flags]
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--save-config enable this to locally save auth configs used to connect GoCD server (path: $HOME/.gocd/auth_config.yaml)
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
Expand All @@ -36,4 +35,4 @@ gocd-cli agents update [flags]

* [gocd-cli agents](gocd-cli_agents.md) - Command to operate on agents present in GoCD [https://api.gocd.org/current/#agents]

###### Auto generated by spf13/cobra on 21-Mar-2023
###### Auto generated by spf13/cobra on 13-Jun-2023
53 changes: 53 additions & 0 deletions docs/doc/gocd-cli_artifact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## gocd-cli artifact

Command to operate on artifacts store/config present in GoCD

### Synopsis

Command leverages GoCD agents apis' [https://api.gocd.org/current/#artifacts-config, https://api.gocd.org/current/#artifact-store] to
GET/CREATE/UPDATE/DELETE GoCD artifact

```
gocd-cli artifact [flags]
```

### Options

```
-h, --help help for artifact
```

### Options inherited from parent commands

```
-t, --auth-token string token to authenticate with GoCD server, should not be co-used with basic auth (username/password)
--ca-file-path string path to file containing CA cert used to authenticate GoCD server, if you have one
--from-file string file containing configurations of objects that needs to be created in GoCD, config-repo/pipeline-group/environment and etc.
--json enable this to Render output in JSON format
-l, --log-level string log level for gocd cli, log levels supported by [https://github.com/sirupsen/logrus] will work (default "info")
--no-color enable this to Render output in YAML format
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
-u, --username string username to authenticate with GoCD server
--yaml enable this to Render output in YAML format
```

### SEE ALSO

* [gocd-cli](gocd-cli.md) - Command line interface for GoCD
* [gocd-cli artifact create-store](gocd-cli_artifact_create-store.md) - Command to CREATE an artifact store with all specified configurations in GoCD [https://api.gocd.org/current/#create-an-artifact-store]
* [gocd-cli artifact delete-store](gocd-cli_artifact_delete-store.md) - Command to DELETE a specific artifact store present in GoCD [https://api.gocd.org/current/#delete-an-artifact-store]
* [gocd-cli artifact get-all-stores](gocd-cli_artifact_get-all-stores.md) - Command to GET all the artifact stores present in GoCD [https://api.gocd.org/current/#get-all-artifact-stores]
* [gocd-cli artifact get-config](gocd-cli_artifact_get-config.md) - Command to GET a configured artifact configuration GoCD [https://api.gocd.org/current/#get-artifacts-config]
* [gocd-cli artifact get-store](gocd-cli_artifact_get-store.md) - Command to GET an specific artifact store in GoCD [https://api.gocd.org/current/#get-an-artifact-store]
* [gocd-cli artifact job-history](gocd-cli_artifact_job-history.md) - Command to GET information of the jobs that ran on a specific agent present in GoCD [https://api.gocd.org/current/#agent-job-run-history]
* [gocd-cli artifact kill-task](gocd-cli_artifact_kill-task.md) - Command to KILL a specific task running on a specific agent present in GoCD [https://api.gocd.org/current/#kill-running-tasks]
* [gocd-cli artifact list-store](gocd-cli_artifact_list-store.md) - Command to LIST all artifact stores present in GoCD [https://api.gocd.org/current/#get-all-artifact-stores]
* [gocd-cli artifact update-config](gocd-cli_artifact_update-config.md) - Command to UPDATE artifact config specified configurations in GoCD [https://api.gocd.org/current/#update-artifacts-config]
* [gocd-cli artifact update-store](gocd-cli_artifact_update-store.md) - Command to UPDATE an artifact store with all specified configurations in GoCD [https://api.gocd.org/current/#update-an-artifact-store]

###### Auto generated by spf13/cobra on 13-Jun-2023
38 changes: 38 additions & 0 deletions docs/doc/gocd-cli_artifact_create-store.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## gocd-cli artifact create-store

Command to CREATE an artifact store with all specified configurations in GoCD [https://api.gocd.org/current/#create-an-artifact-store]

```
gocd-cli artifact create-store [flags]
```

### Options

```
-h, --help help for create-store
```

### Options inherited from parent commands

```
-t, --auth-token string token to authenticate with GoCD server, should not be co-used with basic auth (username/password)
--ca-file-path string path to file containing CA cert used to authenticate GoCD server, if you have one
--from-file string file containing configurations of objects that needs to be created in GoCD, config-repo/pipeline-group/environment and etc.
--json enable this to Render output in JSON format
-l, --log-level string log level for gocd cli, log levels supported by [https://github.com/sirupsen/logrus] will work (default "info")
--no-color enable this to Render output in YAML format
-p, --password string password to authenticate with GoCD server
-q, --query string query to filter the results, ex: '.material.attributes.type | id eq git'. this uses library gojsonq beneath
more queries can be found here https://github.com/thedevsaddam/gojsonq/wiki/Queries
--server-url string GoCD server URL base path (default "http://localhost:8153/go")
--skip-cache-config if enabled locally save auth configs would not be used to authenticate GoCD server (path: $HOME/.gocd/auth_config.yaml)
--to-file string file to which the output needs to be written to (this works only if --yaml or --json is enabled)
-u, --username string username to authenticate with GoCD server
--yaml enable this to Render output in YAML format
```

### SEE ALSO

* [gocd-cli artifact](gocd-cli_artifact.md) - Command to operate on artifacts store/config present in GoCD

###### Auto generated by spf13/cobra on 13-Jun-2023
Loading

0 comments on commit f4b9969

Please sign in to comment.