Is there a way to trigger a retry on specific job from the api

I am working on deploying a large system from buildkite into another cluster.

I would like to trigger all my master builds Deploy steps so they just get published to the new cluster.

Is there a way to do this throught the api. i only find the rebuild but that i dont want to do i just want to run my Deploy step from a build.

I have gotten the build number and job number from the api now i just wish to do the retry, this would make it possible for me to automate the hole deployment to the new cluster.

Found it myself

HI @Looooopy, and welcome to the Buildkite community forum!

Great find! The API endpoint to retry a job does indeed allow you to rerun a job.

That said, we’d like to point out that it only applies to failed or timed_out jobs.

 
What we suggest is to add a condition to exclude steps that should not run in case of a rebuild. This approach leverages the:

 
For example:

- label: Original run only
  command:
    - echo "This is not a rebuild"
  if: 'build.env("BUILDKITE_REBUILT_FROM_BUILD_ID") == null || build.env("BUILDKITE_REBUILT_FROM_BUILD_ID") == ""'

This way, the only job that will run during a rebuild will be the ones corresponding to steps that do not have that condition when you make a request to the Rebuild a build endpoint.

Let me know if this helps.

I was able to use retry on successful jobs because i have configured it like this.

  - command: |-
      deploy dev
    label: Deploy to DEV
    retry:
      manual:
        permit_on_passed: true
2 Likes

Hi @Looooopy,

Glad to know you are able to find what you need from our docs! If anything else that you need help, just reach out! :wave:

Cheers!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.