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 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.
Each SDK has its own version and sdk/<language>/v<version> tag. Always use
release:create; do not run nx release directly. The local command creates
the release commit and tags. Buildkite publishes the packages.
-
Prepare the repository.
Start from the latest
main, then confirm the working tree is clean:git switch main git pull --ff-only git status --short
The status command must produce no output.
release:createrefreshesorigin/mainand the SDK release tags before it starts. Local SDK release tags that were never pushed are discarded. A real release stops unlessHEADmatchesorigin/main, or if a local tag conflicts with the remote. -
Preview the release and choose a bump.
Bump Preview Create Patch npx nx release:create --dry-runnpx nx release:createMinor npx nx release:create --dry-run --bump=minornpx nx release:create --bump=minorMajor npx nx release:create --dry-run --bump=majornpx nx release:create --bump=majorThe helper selects every SDK changed since its own latest tag. One bump applies to every SDK selected by that run. Confirm the preview lists only the SDKs you intend to release before continuing.
A change to
sdk/<language>/project.jsonalone is ignored. To make a deliberate packaging release for such a change, add--forceto both the preview and create commands. -
Create the release.
Run exactly one command from the Create column above, using the same bump you previewed. For every selected SDK, the command:
- Updates its version file (Go has no version file)
- Updates its
CHANGELOG.md - Creates one release commit
- Creates an
sdk/<language>/v<version>tag
It does not push or publish anything.
-
Review the release commit and tags.
git show --stat git tag --points-at HEAD
Confirm the commit contains only release changes and that there is one tag for each SDK shown in the preview. If anything is wrong, do not push it. Discard the generated release with
git reset --hard origin/main. The nextrelease:createrun removes its unpushed SDK tags. -
Push the commit and tags.
git push --atomic --follow-tags origin main
The atomic push prevents release tags from landing if
mainmoved after the release was created. -
Publish from Buildkite.
Get the release commit SHA:
git rev-parse HEAD
Manually trigger the SDK Release Pipeline against that exact commit. The pipeline refreshes tags from
origin, checks each registry first, skips versions already published, and publishes only versions missing from their registry. A publish step turns red instead of publishing if its tag is missing or does not point at the build commit. Other SDKs can continue independently. -
Create the GitHub Releases.
After Buildkite succeeds, create one GitHub Release for each SDK published. Select its
sdk/<language>/v<version>tag and use that SDK's newCHANGELOG.mdentry as the release body.
| SDK | Version lives in |
|---|---|
| TypeScript | sdk/typescript/package.json |
| Python | sdk/python/pyproject.toml |
| Ruby | sdk/ruby/lib/buildkite/version.rb |
| C# | sdk/csharp/src/Buildkite.Sdk/Buildkite.Sdk.csproj |
| Go | the sdk/go/v* git tag, no file |
TypeScript uses Nx's built-in npm support. The other four are handled by tools/release/version-actions.ts, wired up per SDK in the release block of nx.json.
The SDK language docs are managed by a Pulumi Program in infra and manually deployed after every release.
The local release:create command does not need registry credentials. The
Buildkite SDK Release Pipeline supplies these variables when publishing:
NPM_TOKENfor publishing to npm (withnpm publish)PYPI_TOKENfor publishing to PyPI (withuv publish)GEM_HOST_API_KEYfor publishing to RubyGems (withgem push)NUGET_API_KEYfor publishing to NuGet (withdotnet nuget push)
See each SDK's publish target in sdk/<language>/project.json for details.
There is no aggregate publish target: publishing happens only through the
release pipeline, one SDK at a time.