GoCD commandline interface
command-line interface for GoCD
that helps in interacting with GoCD server.
Introduction
GoCD has user interface from where all the work that this CLI does can be operated, but this cli targets admins who manage GoCD.
By providing cli equivalent support of the UI.
This interacts with GoCD
server's api to encrypt, decrypt secrets get list of pipelines, create config-repos and many more.
This cli uses GoCD golang sdk. If you find bug with CLI, probably that bug would at the SDK.
Requirements
- Go 1.17 or above . Installing go can be found here.
- Basic understanding of CI/CD server GoCD and GoCD golang sdk.
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.
# 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
Documentation
Updated documentation on all available commands and flags can be found here.
Installation
- 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.
Docker
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>
Note
- The command
gocd-cli pipeline validate-syntax
would use GoCD's plugin binary to validate the pipeline syntax.
- Since the plugins are jars, it is expected to have Java installed, on the machine from which the command would be executed.