agent

command module
v3.46.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: MIT Imports: 5 Imported by: 0

README

Buildkite Agent

Build status Go Reference

The buildkite-agent is a small, reliable, and cross-platform build runner that makes it easy to run automated builds on your own infrastructure. It’s main responsibilities are polling buildkite.com for work, running build jobs, reporting back the status code and output log of the job, and uploading the job's artifacts.

Full documentation is available at buildkite.com/docs/agent

$ buildkite-agent --help
Usage:

  buildkite-agent <command> [options...]

Available commands are:

  start      Starts a Buildkite agent
  annotate   Annotate the build page within the Buildkite UI with text from within a Buildkite job
  artifact   Upload/download artifacts from Buildkite jobs
  meta-data  Get/set data from Buildkite jobs
  pipeline   Make changes to the pipeline of the currently running build
  step       Make changes to a step (this includes any jobs that were created from the step)
  bootstrap  Run a Buildkite job locally
  help       Shows a list of commands or help for one command

Use "buildkite-agent <command> --help" for more information about a command.

Dependencies

The agent is fairly portable and should run out of the box on most supported platforms without extras. On Linux hosts it requires dbus.

Installing

The agents page on Buildkite has personalised instructions, or you can refer to the Buildkite docs. Both cover installing the agent with Ubuntu (via apt), Debian (via apt), macOS (via homebrew), Windows and Linux.

Docker

We also support and publish Docker Images for the following operating systems. Docker images are tagged using the agent SemVer components followed by the operating system.

For example, agent version 3.30.0 is published as:

  • 3-ubuntu-20.04, tracks minor and bugfix updates in version 3 installed in Ubuntu 20.04
  • 3.30-ubuntu-20.04, tracks bugfix updates in version 3.30 installed in Ubuntu 20.04
  • 3.30.0-ubuntu-20.04, tracks the exact version installed in Ubuntu 20.04
Supported operating systems
  • Alpine 3.12
  • Ubuntu 18.04 LTS (x86_64), supported to end of life for 18.04
  • Ubuntu 20.04 LTS (x86_64), supported to end of life for 20.04
  • Ubuntu 22.04 LTS (x86_64), supported to end of life for 22.04

Starting

To start an agent all you need is your agent token, which you can find on your Agents page within Buildkite.

buildkite-agent start --token
Telemetry

By default, the agent sends some information back to the Buildkite mothership on what features are in use on that agent. Nothing sensitive or identifying is sent back to Buildkite, but if you want, you can disable this feature reporting by adding the --no-feature-reporting flag to your buildkite-agent start call. A full list of the features that we track can be found here.

Development

These instructions assume you are running a recent macOS, but could easily be adapted to Linux and Windows.

# Make sure you have go 1.11+ installed.
brew install go

# Download the code somewhere, no GOPATH required
git clone https://github.com/buildkite/agent.git
cd agent

# Create a temporary builds directory
mkdir /tmp/buildkite-builds

# Build an agent binary and start the agent
go build -o /usr/local/bin/buildkite-agent .
buildkite-agent start --debug --build-path=/tmp/buildkite-builds --token "abc"

# Or, run the agent directly and skip the build step
go run *.go start --debug --build-path=/tmp/buildkite-builds --token "abc"
Dependency management

We're using Go 1.18+ and Go Modules to manage our Go dependencies.

Dependencies are no longer committed to the repository, so compiling on Go <= 1.10 is not supported.

Go Version

The agent is compiled using Go 1.18. Previous go versions may work, but are not guaranteed to.

Platform Support

We provide support for security and bug fixes on the current major release only.

Our architecture and operating system support is primarily limited by what golang itself supports.

Architecture Support

We offer support for the following machine architectures (inspired by the Rust language platform support guidance).

Tier 1, guaranteed to work
  • linux x86_64
  • linux arm64
  • windows x86_64
Tier 2, guaranteed to build
  • linux x86
  • windows x86
  • darwin x86_64
  • darwin arm64
Tier 3, community supported

We release binaries for various other platforms, and it should be possible to build it anywhere Go compiles, but official support is not provided for these Tier 3 platforms.

Operating System Support

We currently provide support for running the Buildkite Agent on the following operating systems. Future major releases may drop support for old operating systems. The agent binary is fairly portable and should run out of the box on most UNIX like systems.

  • Ubuntu 18.04 and newer
  • Debian 8 and newer
  • Red Hat RHEL 7 and newer
  • CentOS
    • CentOS 7
    • CentOS 8
  • Amazon Linux 2
  • macOS [1]
    • 10.12
    • 10.13
    • 10.14
    • 10.15
    • 11
  • Windows Server
    • 2012
    • 2016
    • 2019

[1] See https://github.com/golang/go/issues/23011 for macOS / golang support and Supported macOS Versions for the last supported version of the Buildkite Agent for versions of macOS prior to those listed above.

Contributing

See ./CONTRIBUTING.md

Contributors

Many thanks to our fine contributors! A full list can be found here, but you're all amazing, and we greatly appreciate your input ❤️

Copyright (c) 2014-2019 Buildkite Pty Ltd. See LICENSE for details.

Documentation

Overview

Buildkite-agent is a small, reliable, cross-platform build runner that makes it easy to run automated builds on your own infrastructure.

Directories

Path Synopsis
Package agent provides the key agent components - workers, worker pool, job runner, log streamer, artifact up/downloaders, etc.
Package agent provides the key agent components - workers, worker pool, job runner, log streamer, artifact up/downloaders, etc.
plugin
Package plugin provides types for managing agent plugins.
Package plugin provides types for managing agent plugins.
Package api provides an API client for the Buildkite Pipelines API.
Package api provides an API client for the Buildkite Pipelines API.
Package bootstrap provides management of the phases of execution of a Buildkite job.
Package bootstrap provides management of the phases of execution of a Buildkite job.
integration
Package integration defines a series of integration tests for the bootstrap.
Package integration defines a series of integration tests for the bootstrap.
shell
Package shell provides a cross-platform virtual shell abstraction for executing commands.
Package shell provides a cross-platform virtual shell abstraction for executing commands.
Package clicommand contains the definitions of buildkite-agent subcommands.
Package clicommand contains the definitions of buildkite-agent subcommands.
Package cliconfig provides a configuration file loader.
Package cliconfig provides a configuration file loader.
Package env provides utilities for dealing with environment variables.
Package env provides utilities for dealing with environment variables.
Package experiments provides a global registry of enabled and disabled experiments.
Package experiments provides a global registry of enabled and disabled experiments.
Package hook provides management and execution of hook scripts, and the ability to capture environment variable changes caused by scripts.
Package hook provides management and execution of hook scripts, and the ability to capture environment variable changes caused by scripts.
internal
agentapi
Package agentapi provides an API for interacting with the agent.
Package agentapi provides an API for interacting with the agent.
socket
Package socket provides common implementations for local APIs that use HTTP over Unix domain sockets.
Package socket provides common implementations for local APIs that use HTTP over Unix domain sockets.
jobapi provides an API with which to interact with and mutate the currently executing job Pronunciation: /ˈdʒɑbapi/ /joh-bah-pee/
jobapi provides an API with which to interact with and mutate the currently executing job Pronunciation: /ˈdʒɑbapi/ /joh-bah-pee/
Package logger provides a logger abstraction for writing log messages in configurable formats to different outputs, such as a console, plain text file, or a JSON file.
Package logger provides a logger abstraction for writing log messages in configurable formats to different outputs, such as a console, plain text file, or a JSON file.
Package metrics provides a wrapper around Datadog metrics collection.
Package metrics provides a wrapper around Datadog metrics collection.
Package mime provides an extended mapping of file extensions to MIME types.
Package mime provides an extended mapping of file extensions to MIME types.
Package pool provides a worker pool that enforces an upper limit on concurrent workers.
Package pool provides a worker pool that enforces an upper limit on concurrent workers.
Package process provides a helper for running and managing a subprocess.
Package process provides a helper for running and managing a subprocess.
Package race can be used to tell if the race detector is enabled.
Package race can be used to tell if the race detector is enabled.
Package redaction provides an efficient configurable string redactor.
Package redaction provides an efficient configurable string redactor.
Package shellscript contains helpers for dealing with shell scripts.
Package shellscript contains helpers for dealing with shell scripts.
Package status provides a status page handler, for exposing a summary of what the various pieces of the agent are doing.
Package status provides a status page handler, for exposing a summary of what the various pieces of the agent are doing.
Package stdin provides a cross-platform method for determining if standard input is readable.
Package stdin provides a cross-platform method for determining if standard input is readable.
Package system provides a way to log OS-specific platform information.
Package system provides a way to log OS-specific platform information.
Package tracetools provides an abstraction across tracing systems (OpenTelemetry, DataDog).
Package tracetools provides an abstraction across tracing systems (OpenTelemetry, DataDog).
Package utils provides some file- and filepath-helper functions.
Package utils provides some file- and filepath-helper functions.
Package version provides the agent version strings.
Package version provides the agent version strings.
Package yamltojson provides helpers for using yaml.Node, particularly a converter into JSON.
Package yamltojson provides helpers for using yaml.Node, particularly a converter into JSON.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL