command-line interface for GoCD
that helps in interacting with GoCD server.
While GoCD offers a user interface for performing various tasks, this CLI is designed for administrators responsible for managing GoCD. It aims to provide CLI-based functionality equivalent to the UI.
This tool communicates with the GoCD
server's API to perform tasks such as encrypting and decrypting secrets, retrieving lists of pipelines, creating configuration repositories, and more.
This CLI utilizes the GoCD Golang SDK. If you encounter a bug with the CLI, it likely originates from the SDK.
- Go 1.17 or above . Installing go can be found here.
- Basic understanding of CI/CD server GoCD and GoCD golang sdk.
The authorization configuration for GoCD can be locally cached for future use, streamlining subsequent operations.
The command auth-config
will do the work.
# Running the below command should cache configurations under $HOME/.gocd/auth_config.yaml.
gocd-cli auth-config store --server-url <gocd-url> --username <username> --password <password>
# User creds cached can be validated using below command.
gocd-cli who-am-i
# The response to the above command should be:
# user: admin
# Once we have authorization configurations cached, we do not need to pass the credentials every time we invoke the cli.
gocd-cli environment list
The gocd-cli
will display any pending updates in a diff format, similar to how it is commonly done in other CLI tools such as Terraform.
Updated documentation on all available commands and flags can be found here.
- Recommend installing released versions. Release binaries are available on the releases page and docker from here.
- Can always build it locally by running
go build
against cloned repo.
Latest version of docker images are published to ghcr.io, all available images can be found there.
docker pull ghcr.io/nikhilsbhat/gocd-cli:latest
docker pull ghcr.io/nikhilsbhat/gocd-cli:<github-release-tag>
- The
gocd-cli pipeline validate-syntax
command utilizes GoCD's plugin binary to validate the syntax of the pipeline. - As the plugins are in JAR format, Java installation is required on the machine where the command will be executed.