The Simplest Way to Make Buildkite and Step Functions Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair buildkite and step functions to run cloud tasks right from build pipelines. Buildkite runs your code checks, and Step Functions runs multi-step cloud jobs. This setup lets engineers trigger complex cloud tasks after a build passes. One tool handles code tests, and the other runs state machines in the cloud. When you join them well, deployments stay fast, safe, and easy to track. How buildkite and step functions share roles and data First, the build agent needs a safe way to talk t

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair buildkite and step functions to run cloud tasks right from build pipelines. Buildkite runs your code checks, and Step Functions runs multi-step cloud jobs.

This setup lets engineers trigger complex cloud tasks after a build passes. One tool handles code tests, and the other runs state machines in the cloud. When you join them well, deployments stay fast, safe, and easy to track.

How buildkite and step functions share roles and data

First, the build agent needs a safe way to talk to your cloud account. Teams should avoid static keys that sit in pipeline settings for months. Instead, the build agent can trade a short job token for a cloud role. This swap uses open identity standards that both platforms support out of the box.

Once the agent gets a role, it sends a start call to the state machine. It passes small data payloads like a commit hash, build number, or artifact path. The state machine reads this input and starts its sequence of cloud tasks.

During the run, the two tools must stay in sync. A build job can poll the state machine until the cloud workflow finishes. For long jobs, the state machine can send a callback signal when it ends. This callback tells the pipeline to mark the step as passed or failed.

Common failure modes and how to scope roles

Many teams start by sharing one broad cloud account key across all build agents. This choice creates a big risk if a single pipeline script leaks that key. Anyone with that key could trigger any state machine in your cloud account. Broad roles also make it hard to see which team ran a given job.

Another common issue is missing logs when a cloud task fails mid-run. If the build agent only sees a generic failure, developers waste time hunting for errors. They end up opening the cloud console by hand to read raw step logs. That extra access often leads teams to grant broad read permissions to every developer.

Cloud Functions IAM + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these problems by scoping roles down to a single pipeline. Give each pipeline its own role that can start only one specific state machine. Lock down network paths so only your build agents can reach the cloud API. Keep payload data small, and never pass raw secrets like card numbers in inputs.

If step logs hold user data like emails or phone numbers, apply data masking. Masking rewrites matched fields in results so sensitive strings stay safe during debugging. Clear log forwarding also sends state errors right back to the build output page.

Keeping long workflows fast and predictable

State machines can run for minutes or hours while build agents wait for results. If a build agent just sits idle, you pay for wasted compute time. A better pattern pauses the build step and waits for an outside event.

When the state machine finishes its work, its final task calls the build API. That call unblocks the pipeline and passes back the final status and output links. You should also set clear time limits on both sides of the workflow. Time limits stop stuck cloud tasks from holding up your deployment queue all day.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How should a Buildkite agent log in to start a state machine?

Use an identity token from the build agent to assume a scoped cloud role. This method removes the need to store static keys in your pipeline settings.

Should the build agent wait for Step Functions to finish?

Wait only if the cloud workflow finishes in a few seconds. For longer runs, pause the build step and let the state machine send a callback.

How do we restrict which pipeline can run a production workflow?

Check the pipeline name and branch claim inside your cloud role trust rules. Only allow the main branch of a specific pipeline to start production state machines.

The query runs. The emails stay hidden.