Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: is there a way to trigger a rerun for a certain build? #181

Open
FrancescElies opened this issue May 10, 2023 · 3 comments
Open

Comments

@FrancescElies
Copy link
Contributor

FrancescElies commented May 10, 2023

I would like to trigger programatically the rerun failed jobs button
grafik
This is actually a PATCH to /_apis/build/builds/112560?retry=true

credentials = BasicAuthentication("", personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
build_client = connection.clients.get_build_client()

# Get the first page of projects
projects = core_client.get_projects()
project = next(x for x in projects if x.name == "myorg")
build, *_ = build_client.get_builds( project=project.id, build_ids=[112560])

build.rerun_failed()  # what I would like to do

Is there something like rerun_failed()?

@johnbatty
Copy link
Contributor

Currently no, but I should be able to implement something.

Thanks for the hint that this button triggers a PATCH to /_apis/build/builds/112560?retry=true. Do you know if that works with an empty body? The Rust SDK does currently implement update_build, but the spec says that a Build object is required as the body, which I don't think we should be passing if we are just retrying the build. If it does work without a body, I can fix up the SDK to allow this.

@FrancescElies
Copy link
Contributor Author

As far as I could see request body was empty :)

@kenhia
Copy link

kenhia commented Jan 20, 2024

From my ThunderClient collection

PATCH: https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/stages/{stageRefName}?api-version=7.2-preview.1

With a body of

{
  "forceRetryAllJobs": true,
  "state": "retry"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants