Developing pipeline.yml on a branch?

I’m building a new pipeline, and want to do it on a branch. Is there a way to have the pipeline.yml file come from a branch? It appears that it can only come from main?

Hey Aronchik,

Welcome to Buildkite community :wave:

Pipeline can be run from any branch unless branch limiting is applied on it.

When you run new build on the UI, are you able to choose, different branch and run a build for it?

Could you also ensure under pipeline settings, repository settings no branch limiting is applied?

Let us know any sample build link if the issue persists so we can assist further.

Cheers,
Priya

sorry, slightly different question.

i’m building a new pipeline.yml and i want to test out the pipeline on a branch before i check it in. as near as i can tell, i can only access the buildkite pipelines on main - am i missing something?

Hey @aronchick ,

As my colleague @Priya suggested, when you trigger a build through UI using the new build option, you can specify the branch on which you want to trigger the build.

So based on which branch you select, it will checkout that branch and use the pipeline.yml file from it. I hope this clarifies your question. If not, please let us know if you have any further questions.

Thanks,
Suma

i think this gets at most of it - is there a way to trigger a build on a given sha or tag with an API call?

Hey @aronchick :wave:

For sure, you can trigger a build using our REST API here: Builds API | Buildkite Documentation

curl -H "Authorization: Bearer $TOKEN" \
  -X POST "https://api.buildkite.com/v2/organizations/{org.slug}/pipelines/{pipeline.slug}/builds" \
  -H "Content-Type: application/json" \
  -d '{
    "commit": "abcd0b72a1e580e90712cdd9eb26d3fb41cd09c8",
    "branch": "main",
    "message": "Testing all the things :rocket:",
    "author": {
      "name": "Keith Pitt",
      "email": "me@keithpitt.com"
    },
    "env": {
      "MY_ENV_VAR": "some_value"
    },
    "meta_data": {
      "some build data": "value",
      "other build data": true
    }
  }'

In the request body properties, you can specify a SHA or tag using the commit property (this is also outlined on the page, but here’s a screenshot for reference):

Hope this answers your questions!

Thanks,
Jared

this looks great - will do!