Skip to main content

A tool for managing the gocd server

Project description

A tool for automating the configuration of a GoCD server.

It achieves this by utilizing the published GoCD API specification.

Getting Started

Before the gocd-tool can be used, it has to be built and installed. To accomplish this, use the following make workflow.

To build the image, simply use make in the root of the repo directory:

$ make
python3 -m venv venv
venv/bin/python -m pip install --upgrade pip setuptools wheel
...
=> exporting to image                                                                                                                          0.1s
=> => exporting layers                                                                                                                         0.1s
=> => writing image sha256:ca6354050605d70eba222536fb2155ae75db734e1191020d68a42742f9e658a9                                                    0.0s
=> => naming to docker.io/ucphhpc/gocd-tools:edge                                                                                              0.0s

$ make install
/Library/Developer/CommandLineTools/usr/bin/make install-dep
venv/bin/pip install -r requirements.txt
Requirement already satisfied: requests in ./venv/lib/python3.10/site-packages (from -r requirements.txt (line 1)) (2.27.1)
...
Successfully built gocd-tools
Installing collected packages: gocd-tools
Attempting uninstall: gocd-tools
    Found existing installation: gocd-tools 0.0.1a3
    Uninstalling gocd-tools-0.0.1a3:
    Successfully uninstalled gocd-tools-0.0.1a3
Successfully installed gocd-tools-0.0.1a3

Support

Currently, the tool supports configuring the follow aspects.

Configuration

The gocd-tools configures the targeted GoCD server via YAML config files.

These configuration files are by default expected to be located in the current user’s ~/.gocd-tools/config directory.

-rw-r–r–

1 user staff 100 13 Apr 14:38 artifacts_config.yml

-rw-r–r–

1 user staff 328 13 Apr 14:38 cluster_profiles.yml

-rw-r–r–

1 user staff 1595 13 Apr 14:38 elastic_agent_profiles.yml

-rw-r–r–

1 user staff 438 13 Apr 14:38 pipeline_group_configs.yml

-rw-r–r–

1 user staff 5141 13 Apr 14:38 repositories.yml

-rw-r–r–

1 user staff 237 13 Apr 14:38 roles.yml

-rw-r–r–

1 user staff 1107 13 Apr 14:38 secret_managers.yml

-rw-r–r–

1 user staff 18267 13 Apr 14:38 templates.yml

To specify which server should be configured, and how the tool should authenticate against that server the tool currently relies on environment variables. Namely the GOCD_BASE_URL and the GOCD_AUTH_TOKEN environment variables.

Therefore they should be set in the current shell before the targeted server is attempted to be configured:

export GOCD_BASE_URL=https://url-to-the-gocd-server
export GOCD_AUTH_TOKEN=`Your Personal Access Token <https://docs.gocd.org/current/configuration/access_tokens.html>`_

Usage

After installation and the required configuration, the tool can be used by calling the gocd-tools command:

$ gocd-tools -h
usage: gocd-tools [-h] {setup} ...

options:
-h, --help  show this help message and exit

COMMAND:
{setup}

Thereby, the supported commands can be discovered through the defined CLI, for example:

$ gocd-tools setup -h
usage: gocd-tools setup [-h] {secrets,server} ...

options:
-h, --help        show this help message and exit

COMMAND:
{secrets,server}


$ gocd-tools setup server -h
usage: gocd-tools setup server [-h] {init,configure,cleanup} ...

options:
-h, --help            show this help message and exit

COMMAND:
{init,configure,cleanup}

For instance, to configure and subsequent cleanup a server, the following commands should be used:

$ gocd-tools setup server init
Init server: https://url-to-the-gocd-server
Failed to find: 401:{
"message": "You are not authenticated!"
}
{
    "msg": "The Authorization config for: https://ci.erda.dk was completed",
    "status": "success"
}

$ gocd-tools setup server configure
Authenticate
Setup Roles
Failed to find: 404:{"message":"Role with name \u0027manager\u0027 was not found!"}
Creating: manager
...
{
    "msg": "Succesfully configured the https://url-to-the-gocd-server endpoint",
    "status": "success"
}

$ gocd-tools setup server cleanup
Authenticate
Delete Config Repositories
...
Delete Roles
Removing: manager
{
    "msg": "Succesfully finished the cleanup of endpoint: https://url-to-the-gocd-server",
    "status": "success"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gocd-tools-0.0.1a4.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

gocd_tools-0.0.1a4-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file gocd-tools-0.0.1a4.tar.gz.

File metadata

  • Download URL: gocd-tools-0.0.1a4.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.3

File hashes

Hashes for gocd-tools-0.0.1a4.tar.gz
Algorithm Hash digest
SHA256 e538ff9066d358529fb1690d3b889465cb8e2064ffa8bc6136881ed3d73b9d50
MD5 557c6545d0717f191c04c4177ea737e7
BLAKE2b-256 ee5f4c51c64a53c38cea8cdde504e70f4654aede3bef6b5b2bd6f888bc6ac205

See more details on using hashes here.

File details

Details for the file gocd_tools-0.0.1a4-py3-none-any.whl.

File metadata

File hashes

Hashes for gocd_tools-0.0.1a4-py3-none-any.whl
Algorithm Hash digest
SHA256 506cb7201718715b448b8a491f2aff9e9195376f5dd34b62799261972284ebf4
MD5 e2638497ffb2197d745c6e8392373081
BLAKE2b-256 8638f0b4cd6f7a724bfe5c6a3f178b0a5f5192c9062e7322cc81e60c959c6f20

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page