Skip to content

gocd-contrib/docker-gocd-cli-dojo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gocd-cli in docker

A Dojo docker image featuring:

The primary use case of this image is to help with validating GoCD config repos before pushing changes to the source control.

Images are pushed to dockerhub at kudulab/gocd-cli-dojo.

Setup

  1. Install docker, if you haven't already.
  2. Install Dojo, it is a self-contained binary, so just place it somewhere on the PATH. On Linux:
DOJO_VERSION=0.4.1
wget -O dojo https://github.com/ai-traders/dojo/releases/download/${DOJO_VERSION}/dojo_linux_amd64
sudo mv dojo /usr/local/bin
sudo chmod +x /usr/local/bin/dojo

Usage

  1. cd into project which has GoCD configuration files.
  2. Configure access to the GoCD server.
  3. The quickest way to start is to run the docker container
dojo --image=kudulab/gocd-cli-dojo:yaml

Then you can execute gocd CLI, for example to validate GoCD configuration files

gocd configrepo preflight -r my-repo-id --yaml ci.gocd.yaml

Please refer to gocd-cli documentation to find out more about usage.

You may also find this introductory blog post useful.

Configuration

You must configure access to your GoCD in order to execute the preflight checks. There are 2 ways to do it:

settings file

In your home directory create a file .gocd/settings.yaml with following content:

auth:
  password: ***
  type: basic
  user: my_gocd_username
config_version: 1
server:
  url: http://go.mydomain.com/go

environment variables

Before running dojo you can export following variables:

Required variables to set:

  • GOCDCLI_SERVER_URL=https://your-gocd-host/go

To use basic authentication:

  • GOCDCLI_AUTH_TYPE=basic
  • GOCDCLI_AUTH_USER=myuser
  • GOCDCLI_AUTH_PASSWORD=mysupersecretpasswd

To use token-based authentication:

  • GOCDCLI_AUTH_TOKEN=secrettoken

To skip authentication setup:

  • GOCDCLI_SKIP_AUTH set to any value to avoid authentication setup.

License

Copyright 2019 Tomasz Sętkowski

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.