A multi-language SDK for Buildkite! 🪁
Consumes the Buildkite pipeline schema and generates and publishes packages for TypeScript or JavaScript, Python, Go, and Ruby.
Learn more about how to set up the Buildkite SDK for each langauge, and use it to work with your Buildkite pipelines, from the Buildkite SDK page of the Buildkite Docs.
In v0.4.0 we introduced type generation from Buildkite's Pipeline Schema. You can find a list of breaking changes here.
To work on the SDK, you'll need current versions of the following tools:
See mise.toml for details. (We also recommend Mise for tool-version management.) If you're on a Mac, and you use Homebrew, you can run brew bundle and mise install to get all you need:
brew bundle
mise installIf you hit any rough edges during development, please file an issue. Thanks!
# Install all project dependencies.
npm install
# Test all SDKs and apps.
npm test
# Build all SDKs (and write them to ./dist/sdks).
npm run build
# Build all SDK docs (and write them to ./dist/docs).
npm run docs
# Serve the docs locally (which builds them implicitly).
npm run docs:serve
# Run all apps (which writes JSON and YAML pipelines to ./out).
npm run apps
# Watch all projects for changes (which rebuilds the docs and SDKs and re-runs all apps).
npm run watch
# Launch web servers for all docsets and watch all projects for changes. (Requires reload.)
npm run dev
# Format all SDK code.
npm run format
# Publish to npm, PyPi pkg.go.dev, and RubyGems.
npm run publish
# Publish the docs to AWS.
npm run docs:publish
# Clear away build and test artifacts.
npm run cleanThis SDK generates types from the Buildkite pipeline schema. When changes are made to the pipeline-schema repository, you can regenerate the types by running:
# Regenerate the types for all languages.
npm run types
# Regenerate the types for a specific language.
npm run types-ts
npm run types-py
npm run types-goThe type generator automatically fetches the latest schema from the main branch of the pipeline-schema repository. Generated types are then written to:
sdk/typescript/src/types/sdk/python/src/buildkite_sdk/schema.pysdk/go/sdk/buildkite/
Note that the type-generator binary (a Go program at internal/gen/type-gen) is automatically built when you run npm run types. If you need to rebuild that binary manually, run npx nx gen:build.
We manage this repository with Nx. To upgrade the Nx workspace to the latest version, use nx migrate. From the root of the project, run:
npx nx migrate latestSee the nx guide for details.
All SDKs version on the same cadence. To publish a new version (of all SDKs), follow these steps:
-
Commit all pending changes. We want the release commit to be "clean" (i.e., to consist only of changes related to the release itself.)
-
Update the
VERSION_FROMandVERSION_TOvalues in therelease:alltask in./project.json. -
Leaving that single change uncommitted and run the release script:
npm run release:create-branch
This script:
- Updates the version numbers in all affected files
- Rebuilds all SDKs
- Commits all changes (e.g., to version files, lockfiles, and anything else under
./sdk) - Pushes the branch to GitHub
-
Next open a PR with the created branch.
-
After the PR is merged, from an up-to-date main branch, create and push the release tags:
git tag v{VERSION_TO} main git tag sdk/go/v{VERSION_TO} main git push origin v{VERSION_TO} git push origin sdk/go/v{VERSION_TO} -
Once the tags have been created, manually trigger the SDK Release Pipeline in Buildkite. After the pipeline has finished, manually create a release in GitHub (example).
The SDK language docs are managed by a Pulumi Program in infra and manually deployed after every release.
The following environment variables are required for releasing and publishing:
NPM_TOKENfor publishing to npm (withnpm publish)PYPI_TOKENfror publishing to PyPI (withuv publish)GEM_HOST_API_KEYfor publishing to RubyGems (withgem push)
See the publish:all tasks in ./project.json for details.