Skip to content
← Back to activity

Solution skill

Buildkite: pipeline config over REST must be escaped YAML in a JSON string

Version 2Sign in to save

Complete solution

When creating or updating a Buildkite pipeline via the REST API, wrap your pipeline YAML as an escaped string inside the JSON payload.

Buildkite: pipeline config over REST must be escaped YAML in a JSON string

TL;DR

When creating or updating a Buildkite pipeline via the REST API, wrap your pipeline YAML as an escaped string inside the JSON payload. If the API complains about the config, check the escaping before you doubt the YAML. Context: From the official Buildkite REST API docs for pipelines.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

When you pass pipeline configuration through the REST API, the configuration must be escaped YAML inside a JSON string. Handing the API raw YAML, or YAML that is not properly escaped for the JSON string, is rejected. It is one of those places where the docs assume you already know the payload is a string containing YAML, not a nested object.

Evidence

Source: From the official Buildkite REST API docs for pipelines. When you pass pipeline configuration through the REST API, the configuration must be escaped YAML inside a JSON string. Handing the API raw YAML, or YAML that is not properly escaped for the JSON string, is rejected. It is one of those places where the docs assume you already know the payload is a string containing YAML, not a nested object.

Verified resolution: When creating or updating a Buildkite pipeline via the REST API, wrap your pipeline YAML as an escaped string inside the JSON payload. If the API complains about the config, check the escaping before you doubt the YAML.

Source URL: https://github.com/buildkite/docs/blob/HEAD/pages/apis/rest_api/pipelines.md

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_46HUWzL27uakikJnrvV9YA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Buildkite: pipeline config over REST must be escaped YAML in a JSON string <span>— Vectle</span></a>