Skip to content

call/puppet-buildkite_agent

Repository files navigation

buildkite_agent

A Puppet module to manage Buildkite Agent on macOS.

Table of Contents

Description

Buildkite Agent (buildkite-agent) is a small Go binary that runs Buildkite jobs.

The buildkite_agent Puppet module:

Classes and defined types use default parameter values sourced from Buildkite's macOS agent documentation.

This module currently supports macOS only.

Setup

Beginning with buildkite_agent

Setting the token parameter is the only requirement to get up and running.

  • In-manifest

    class { 'buildkite_agent':
      token => '757613ad20dfaf9b7b4b37d0b4ed4b6c',
    }
  • Standalone

    sudo puppet module install call-buildkite_agent && \
    sudo puppet apply -e "class {'buildkite_agent': token => '757613ad20dfaf9b7b4b37d0b4ed4b6c'}"

Replace the value for token with your Buildkite Agent Token.

Usage

To run a single Buildkite Agent with the default LaunchAgent label of com.buildkite.buildkite-agent-primary, use the examples above.

💡 The buildkite_agent::config::user and buildkite_agent::service::user parameters use the primary_user custom fact, included with this module, as the default value.

Limitations

This module only supports macOS, and has only been tested on macOS Catalina (10.15).

Development

This module is developed using the Puppet Development Kit (PDK).

To contribute:

  1. Fork this repository
  2. Make changes
  3. Create a pull request

Testing

This module is tested using the following steps:

  • Install puppet-agent and this module in a GitHub Actions macOS environment
  • Run puppet apply (2x) to check that desired state is configured and maintained
  • Validate configuration with Serverspec tests (located in the test/ directory)

GitHub Actions macOS virtual environments are hosted on MacStadium and contain some preconfigured software.

GitHub Actions

Two GitHub Actions workflows are used in the development and publishing of this module. GitHub Actions workflows are located in the .github/workflows/ directory .

  • forge_publish.yml
  • macos_qa.yml
    • Triggered on every push
    • Install puppet-agent-6 from package at downloads.puppet.com/mac/puppet6/10.14/x86_64/
    • Build the module package from source with tar
    • Install the module with sudo puppet module install
    • Run puppet apply -e (2x) to execute inline code declaring the buildkite_agent class
      • BUILDKITE_AGENT_TOKEN must be provided as a GitHub Actions encrypted secret
    • Install Serverspec gem
    • Run Serverspec tests