This method creates a new build using the original build request, which may or may not result in an identical build.
For triggered builds:
Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision.
For non-triggered builds that specify RepoSource:
If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build.
If the original build specified a commit sha or revision ID, the retried build will use the identical source.
For builds that specify StorageSource:
If the original build pulled source from Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source.
If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.
HTTP request
POST https://cloudbuild.googleapis.com/v1/projects/{projectId}/builds/{id}:retry
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-17 UTC."],[[["\u003cp\u003eThis endpoint allows retrying a previously executed build, creating a new build based on the original request.\u003c/p\u003e\n"],["\u003cp\u003eThe behavior of retrying a build depends on the build type, with triggered builds using the same revision, while non-triggered builds might use a different revision or object.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request for retrying a build uses the \u003ccode\u003ePOST\u003c/code\u003e method with a specific URL structure, requiring both \u003ccode\u003eprojectId\u003c/code\u003e and \u003ccode\u003eid\u003c/code\u003e as path parameters.\u003c/p\u003e\n"],["\u003cp\u003eThe request body contains a JSON representation with a \u003ccode\u003ename\u003c/code\u003e field that specifies the \u003ccode\u003eBuild\u003c/code\u003e resource to retry, indicating the project, location, and build ID.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful retries return an \u003ccode\u003eOperation\u003c/code\u003e instance in the response body, and authorization requires the \u003ccode\u003ecloud-platform\u003c/code\u003e OAuth scope along with specific IAM permissions.\u003c/p\u003e\n"]]],[],null,["# Method: projects.builds.retry\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a new build based on the specified build.\n\nThis method creates a new build using the original build request, which may or may not result in an identical build.\n\nFor triggered builds:\n\n- Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision.\n\nFor non-triggered builds that specify `RepoSource`:\n\n- If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build.\n- If the original build specified a commit sha or revision ID, the retried build will use the identical source.\n\nFor builds that specify `StorageSource`:\n\n- If the original build pulled source from Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source.\n- If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.\n\n### HTTP request\n\n`POST https://cloudbuild.googleapis.com/v1/projects/{projectId}/builds/{id}:retry`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/build/docs/api/reference/rest/Shared.Types/Operation).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/)."]]