Files

The gocd-tools tool relies solely on YAML configuration files to configure a particular GoCD server. When a particular configuration operation is executed, the gocd-tools expects to find a related configuration file in the ~/.gocd-tools/config directory.

The names of these files is related to the config operation it GoCD Type that this tool supports.

artifacts_config.yml

This file contains the Artifacts Config configuration. The structure of this file is expected to abide by the format defined the GoCD API for an Artifacts Config Object. An example configuration of this could be:

artifacts_dir: artifacts
purge_settings:
    purge_start_disk_space: 5
    purge_upto_disk_space: 20

authorization_configuration.yml

This file contains the Authorization Configuration configuration. The structure of this file is expected to abide by the format defined the GoCD API for an Authorization Configuration Object. An example configuration of this could be:

- id: "github"
  plugin_id: "cd.go.authorization.github"
  allow_only_known_users_to_login: true
  properties:
    - key: "ClientId"
      value: "CLIENT_ID"
    - key: "ClientSecret"
      value: "CLIENT_SECRET"
    - key: "PersonalAccessToken"
      value: "PERSONAL_ACCESS_TOKEN"
    - key: "GitHubEnterpriseUrl"
      value: ""
    - key: "AllowedOrganizations"
      value: "ucphhpc"
    - key: "AuthenticateWith"
      value: "GitHub"

cluster_profiles.yml

This file contains the Cluster Profiles configurations. The structure of this file is expected to abid by the formated expected by the Cluster Profile Object format. An example configuration of this could be:

- id: "cluster"
  plugin_id: "cd.go.contrib.elastic-agent.docker-swarm"
  properties:
      - key: "go_server_url"
      value: "https://gocd-server-url/go"
      - key: "auto_register_timeout"
      value: "40"
      - key: "max_docker_containers"
      value: "200"
      - key: "docker_uri"
      value: "unix:///var/run/docker.sock"

config_repositories.yml

This file contains the Config Repo configurations. The structure of this file is three-fold. First the id key-value pair is used to set a unique identifer for the Config Repo in question. Second, then authentication section is used to define whether any form of authentication is required to access the designated Config Repo. An example of this could be that the designated Config Repo is a private GitHub repository that requires authentication. To use authentication, the gocd-tools expects this to be provided by a Secret Config File, which an example of can be seen below in the secret_configs.yml section. Thirdly, the config section is passed directly as the Config Repo to be created. An example configuration of this could be:

- id: gocd-tools
  authentication:
      required: no
  config:
      plugin_id: yaml.config.plugin
      material:
          type: git
          attributes:
          url: https://github.com/rasmunk/gocd-tools
          branch: main
          auto_update: true
      rules:
          - directive: allow
          action: refer
          type: "*"
          resource: "*"

elastic_agent_profiles.yml

This file contains the Elastic Agent Profiles configurations. The structure of this file is expected to abid by the formated expected by the Elastic Agent Profile Object format. An example configuration of this could be:

- id: "python"
  cluster_profile_id: "cluster"
  properties:
    - key: "Image"
      value: "ucphhpc/gocd-agent-python:latest"
    - key: "MaxMemory"
      value: "5G"
    - key: "ReservedMemory"
      value: "1G"
    - key: "Networks"
      value: nginx_default
    - key: "Constraints"
      value: node.role == worker

pipeline_group_configs.yml

This file contains the Pipeline Group Config configurations. The structure of this file is expected to abid by the formated expected by the Pipeline Group Config Object format. An example configuration of this could be:

- name: bare_metal_pypi_package
  authorization:
      operate:
      roles:
          - manager

roles.yml

This file contains the Roles configurations. The structure of this file is expected to abid by the formated expected by the Roles Object format. An example configuration of this could be:

- name: manager
  type: plugin
  attributes:
    auth_config_id: github
    properties:
    - key: "Organizations"
        value: "ucphhpc"
  policy:
    - permission: allow
      action: administer
      type: "*"
      resource: "*"

secret_configs.yml

This file contains the Secret Configs configurations. The structure of this file is expected to abid by the formated expected by the Secret Config Object format. An example configuration of this could be:

- id: "common"
  plugin_id: "cd.go.secrets.file-based-plugin"
  description: "File store for secrets"
  properties:
    - key: "SecretsFilePath"
      value: "/gosecret/common.json"
  rules:
    - directive: allow
      action: refer
      type: "*"
      resource: "*"

templates.yml

This file contains the Template Configs configurations. The structure of this file is expected to abid by the formated expected by the Template Config Object format. An example configuration of this could be:

- name: "docker_image"
  stages:
    - name: "build"
      fetch_materials: true
      keep_artifacts: true
      jobs:
        - name: "build"
          elastic_profile_id: "docker"
          timeout: 0
          tasks:
            - type: "exec"
              attributes:
                command: make
                arguments:
                - IMAGE=#{IMAGE}
                - ARGS=#{ARGS}
                run_if:
                - passed
                working_directory: "#{SRC_DIRECTORY}"
          artifacts:
            - type: build
                source: "#{SRC_DIRECTORY}/**"
                destination: ""