Skip to content

Commit c5e57ed

Browse files
AWS CodeBuild now supports comment-based pull request control.
1 parent 8aac8c2 commit c5e57ed

11 files changed

+520
-5
lines changed

generator/ServiceModels/codebuild/codebuild-2016-10-06.api.json

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,8 @@
14191419
"filterGroups":{"shape":"FilterGroups"},
14201420
"buildType":{"shape":"WebhookBuildType"},
14211421
"manualCreation":{"shape":"WrapperBoolean"},
1422-
"scopeConfiguration":{"shape":"ScopeConfiguration"}
1422+
"scopeConfiguration":{"shape":"ScopeConfiguration"},
1423+
"pullRequestBuildPolicy":{"shape":"PullRequestBuildPolicy"}
14231424
}
14241425
},
14251426
"CreateWebhookOutput":{
@@ -2496,6 +2497,45 @@
24962497
"orderedProxyRules":{"shape":"FleetProxyRules"}
24972498
}
24982499
},
2500+
"PullRequestBuildApproverRole":{
2501+
"type":"string",
2502+
"enum":[
2503+
"GITHUB_READ",
2504+
"GITHUB_TRIAGE",
2505+
"GITHUB_WRITE",
2506+
"GITHUB_MAINTAIN",
2507+
"GITHUB_ADMIN",
2508+
"GITLAB_GUEST",
2509+
"GITLAB_PLANNER",
2510+
"GITLAB_REPORTER",
2511+
"GITLAB_DEVELOPER",
2512+
"GITLAB_MAINTAINER",
2513+
"GITLAB_OWNER",
2514+
"BITBUCKET_READ",
2515+
"BITBUCKET_WRITE",
2516+
"BITBUCKET_ADMIN"
2517+
]
2518+
},
2519+
"PullRequestBuildApproverRoles":{
2520+
"type":"list",
2521+
"member":{"shape":"PullRequestBuildApproverRole"}
2522+
},
2523+
"PullRequestBuildCommentApproval":{
2524+
"type":"string",
2525+
"enum":[
2526+
"DISABLED",
2527+
"ALL_PULL_REQUESTS",
2528+
"FORK_PULL_REQUESTS"
2529+
]
2530+
},
2531+
"PullRequestBuildPolicy":{
2532+
"type":"structure",
2533+
"required":["requiresCommentApproval"],
2534+
"members":{
2535+
"requiresCommentApproval":{"shape":"PullRequestBuildCommentApproval"},
2536+
"approverRoles":{"shape":"PullRequestBuildApproverRoles"}
2537+
}
2538+
},
24992539
"PutResourcePolicyInput":{
25002540
"type":"structure",
25012541
"required":[
@@ -3301,7 +3341,8 @@
33013341
"branchFilter":{"shape":"String"},
33023342
"rotateSecret":{"shape":"Boolean"},
33033343
"filterGroups":{"shape":"FilterGroups"},
3304-
"buildType":{"shape":"WebhookBuildType"}
3344+
"buildType":{"shape":"WebhookBuildType"},
3345+
"pullRequestBuildPolicy":{"shape":"PullRequestBuildPolicy"}
33053346
}
33063347
},
33073348
"UpdateWebhookOutput":{

generator/ServiceModels/codebuild/codebuild-2016-10-06.docs.json

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,31 @@
14931493
"UpdateFleetInput$proxyConfiguration": "<p>The proxy configuration of the compute fleet.</p>"
14941494
}
14951495
},
1496+
"PullRequestBuildApproverRole": {
1497+
"base": null,
1498+
"refs": {
1499+
"PullRequestBuildApproverRoles$member": null
1500+
}
1501+
},
1502+
"PullRequestBuildApproverRoles": {
1503+
"base": null,
1504+
"refs": {
1505+
"PullRequestBuildPolicy$approverRoles": "<p>List of repository roles that have approval privileges for pull request builds when comment approval is required. Only users with these roles can provide valid comment approvals. If a pull request contributor is one of these roles, their pull request builds will trigger automatically. This field is only applicable when <code>requiresCommentApproval</code> is not <i>DISABLED</i>.</p>"
1506+
}
1507+
},
1508+
"PullRequestBuildCommentApproval": {
1509+
"base": null,
1510+
"refs": {
1511+
"PullRequestBuildPolicy$requiresCommentApproval": "<p>Specifies when comment-based approval is required before triggering a build on pull requests. This setting determines whether builds run automatically or require explicit approval through comments.</p> <ul> <li> <p> <i>DISABLED</i>: Builds trigger automatically without requiring comment approval</p> </li> <li> <p> <i>ALL_PULL_REQUESTS</i>: All pull requests require comment approval before builds execute (unless contributor is one of the approver roles)</p> </li> <li> <p> <i>FORK_PULL_REQUESTS</i>: Only pull requests from forked repositories require comment approval (unless contributor is one of the approver roles)</p> </li> </ul>"
1512+
}
1513+
},
1514+
"PullRequestBuildPolicy": {
1515+
"base": "<p>Configuration policy that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>",
1516+
"refs": {
1517+
"CreateWebhookInput$pullRequestBuildPolicy": "<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>",
1518+
"UpdateWebhookInput$pullRequestBuildPolicy": "<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>"
1519+
}
1520+
},
14961521
"PutResourcePolicyInput": {
14971522
"base": null,
14981523
"refs": {}
@@ -2067,7 +2092,7 @@
20672092
"StartBuildBatchInput$idempotencyToken": "<p>A unique, case sensitive identifier you provide to ensure the idempotency of the <code>StartBuildBatch</code> request. The token is included in the <code>StartBuildBatch</code> request and is valid for five minutes. If you repeat the <code>StartBuildBatch</code> request with the same token, but change a parameter, CodeBuild returns a parameter mismatch error.</p>",
20682093
"StartBuildInput$sourceVersion": "<p>The version of the build input to be built, for this build only. If not specified, the latest version is used. If specified, the contents depends on the source provider:</p> <dl> <dt>CodeCommit</dt> <dd> <p>The commit ID, branch, or Git tag to use.</p> </dd> <dt>GitHub</dt> <dd> <p>The commit ID, pull request ID, branch name, or tag name that corresponds to the version of the source code you want to build. If a pull request ID is specified, it must use the format <code>pr/pull-request-ID</code> (for example <code>pr/25</code>). If a branch name is specified, the branch's HEAD commit ID is used. If not specified, the default branch's HEAD commit ID is used.</p> </dd> <dt>GitLab</dt> <dd> <p>The commit ID, branch, or Git tag to use.</p> </dd> <dt>Bitbucket</dt> <dd> <p>The commit ID, branch name, or tag name that corresponds to the version of the source code you want to build. If a branch name is specified, the branch's HEAD commit ID is used. If not specified, the default branch's HEAD commit ID is used.</p> </dd> <dt>Amazon S3</dt> <dd> <p>The version ID of the object that represents the build input ZIP file to use.</p> </dd> </dl> <p>If <code>sourceVersion</code> is specified at the project level, then this <code>sourceVersion</code> (at the build level) takes precedence. </p> <p>For more information, see <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/sample-source-version.html\">Source Version Sample with CodeBuild</a> in the <i>CodeBuild User Guide</i>. </p>",
20692094
"StartBuildInput$sourceLocationOverride": "<p>A location that overrides, for this build, the source location for the one defined in the build project.</p>",
2070-
"StartBuildInput$buildspecOverride": "<p>A buildspec file declaration that overrides the latest one defined in the build project, for this build only. The buildspec defined on the project is not changed.</p> <p>If this value is set, it can be either an inline buildspec definition, the path to an alternate buildspec file relative to the value of the built-in <code>CODEBUILD_SRC_DIR</code> environment variable, or the path to an S3 bucket. The bucket must be in the same Amazon Web Services Region as the build project. Specify the buildspec file using its ARN (for example, <code>arn:aws:s3:::my-codebuild-sample2/buildspec.yml</code>). If this value is not provided or is set to an empty string, the source code must contain a buildspec file in its root directory. For more information, see <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage\">Buildspec File Name and Storage Location</a>.</p> <note> <p>Since this property allows you to change the build commands that will run in the container, you should note that an IAM principal with the ability to call this API and set this parameter can override the default settings. Moreover, we encourage that you use a trustworthy buildspec location like a file in your source repository or a Amazon S3 bucket.</p> </note>",
2095+
"StartBuildInput$buildspecOverride": "<p>A buildspec file declaration that overrides the latest one defined in the build project, for this build only. The buildspec defined on the project is not changed.</p> <p>If this value is set, it can be either an inline buildspec definition, the path to an alternate buildspec file relative to the value of the built-in <code>CODEBUILD_SRC_DIR</code> environment variable, or the path to an S3 bucket. The bucket must be in the same Amazon Web Services Region as the build project. Specify the buildspec file using its ARN (for example, <code>arn:aws:s3:::my-codebuild-sample2/buildspec.yml</code>). If this value is not provided or is set to an empty string, the source code must contain a buildspec file in its root directory. For more information, see <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage\">Buildspec File Name and Storage Location</a>.</p> <note> <p>Since this property allows you to change the build commands that will run in the container, you should note that an IAM principal with the ability to call this API and set this parameter can override the default settings. Moreover, we encourage that you use a trustworthy buildspec location like a file in your source repository or a Amazon S3 bucket. Alternatively, you can restrict overrides to the buildspec by using a condition key: <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/action-context-keys.html#action-context-keys-example-overridebuildspec.html\">Prevent unauthorized modifications to project buildspec</a>.</p> </note>",
20712096
"StartBuildInput$certificateOverride": "<p>The name of a certificate for this build that overrides the one specified in the build project.</p>",
20722097
"StartBuildInput$idempotencyToken": "<p>A unique, case sensitive identifier you provide to ensure the idempotency of the StartBuild request. The token is included in the StartBuild request and is valid for 5 minutes. If you repeat the StartBuild request with the same token, but change a parameter, CodeBuild returns a parameter mismatch error. </p>",
20732098
"TestCase$testRawDataPath": "<p> The path to the raw data file that contains the test result. </p>",

generator/ServiceModels/codebuild/codebuild-2016-10-06.normal.json

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,6 +2122,10 @@
21222122
"scopeConfiguration":{
21232123
"shape":"ScopeConfiguration",
21242124
"documentation":"<p>The scope configuration for global or organization webhooks.</p> <note> <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p> </note>"
2125+
},
2126+
"pullRequestBuildPolicy":{
2127+
"shape":"PullRequestBuildPolicy",
2128+
"documentation":"<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>"
21252129
}
21262130
}
21272131
},
@@ -4012,6 +4016,52 @@
40124016
},
40134017
"documentation":"<p>Information about the proxy configurations that apply network access control to your reserved capacity instances.</p>"
40144018
},
4019+
"PullRequestBuildApproverRole":{
4020+
"type":"string",
4021+
"enum":[
4022+
"GITHUB_READ",
4023+
"GITHUB_TRIAGE",
4024+
"GITHUB_WRITE",
4025+
"GITHUB_MAINTAIN",
4026+
"GITHUB_ADMIN",
4027+
"GITLAB_GUEST",
4028+
"GITLAB_PLANNER",
4029+
"GITLAB_REPORTER",
4030+
"GITLAB_DEVELOPER",
4031+
"GITLAB_MAINTAINER",
4032+
"GITLAB_OWNER",
4033+
"BITBUCKET_READ",
4034+
"BITBUCKET_WRITE",
4035+
"BITBUCKET_ADMIN"
4036+
]
4037+
},
4038+
"PullRequestBuildApproverRoles":{
4039+
"type":"list",
4040+
"member":{"shape":"PullRequestBuildApproverRole"}
4041+
},
4042+
"PullRequestBuildCommentApproval":{
4043+
"type":"string",
4044+
"enum":[
4045+
"DISABLED",
4046+
"ALL_PULL_REQUESTS",
4047+
"FORK_PULL_REQUESTS"
4048+
]
4049+
},
4050+
"PullRequestBuildPolicy":{
4051+
"type":"structure",
4052+
"required":["requiresCommentApproval"],
4053+
"members":{
4054+
"requiresCommentApproval":{
4055+
"shape":"PullRequestBuildCommentApproval",
4056+
"documentation":"<p>Specifies when comment-based approval is required before triggering a build on pull requests. This setting determines whether builds run automatically or require explicit approval through comments.</p> <ul> <li> <p> <i>DISABLED</i>: Builds trigger automatically without requiring comment approval</p> </li> <li> <p> <i>ALL_PULL_REQUESTS</i>: All pull requests require comment approval before builds execute (unless contributor is one of the approver roles)</p> </li> <li> <p> <i>FORK_PULL_REQUESTS</i>: Only pull requests from forked repositories require comment approval (unless contributor is one of the approver roles)</p> </li> </ul>"
4057+
},
4058+
"approverRoles":{
4059+
"shape":"PullRequestBuildApproverRoles",
4060+
"documentation":"<p>List of repository roles that have approval privileges for pull request builds when comment approval is required. Only users with these roles can provide valid comment approvals. If a pull request contributor is one of these roles, their pull request builds will trigger automatically. This field is only applicable when <code>requiresCommentApproval</code> is not <i>DISABLED</i>.</p>"
4061+
}
4062+
},
4063+
"documentation":"<p>Configuration policy that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>"
4064+
},
40154065
"PutResourcePolicyInput":{
40164066
"type":"structure",
40174067
"required":[
@@ -4968,7 +5018,7 @@
49685018
},
49695019
"buildspecOverride":{
49705020
"shape":"String",
4971-
"documentation":"<p>A buildspec file declaration that overrides the latest one defined in the build project, for this build only. The buildspec defined on the project is not changed.</p> <p>If this value is set, it can be either an inline buildspec definition, the path to an alternate buildspec file relative to the value of the built-in <code>CODEBUILD_SRC_DIR</code> environment variable, or the path to an S3 bucket. The bucket must be in the same Amazon Web Services Region as the build project. Specify the buildspec file using its ARN (for example, <code>arn:aws:s3:::my-codebuild-sample2/buildspec.yml</code>). If this value is not provided or is set to an empty string, the source code must contain a buildspec file in its root directory. For more information, see <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage\">Buildspec File Name and Storage Location</a>.</p> <note> <p>Since this property allows you to change the build commands that will run in the container, you should note that an IAM principal with the ability to call this API and set this parameter can override the default settings. Moreover, we encourage that you use a trustworthy buildspec location like a file in your source repository or a Amazon S3 bucket.</p> </note>"
5021+
"documentation":"<p>A buildspec file declaration that overrides the latest one defined in the build project, for this build only. The buildspec defined on the project is not changed.</p> <p>If this value is set, it can be either an inline buildspec definition, the path to an alternate buildspec file relative to the value of the built-in <code>CODEBUILD_SRC_DIR</code> environment variable, or the path to an S3 bucket. The bucket must be in the same Amazon Web Services Region as the build project. Specify the buildspec file using its ARN (for example, <code>arn:aws:s3:::my-codebuild-sample2/buildspec.yml</code>). If this value is not provided or is set to an empty string, the source code must contain a buildspec file in its root directory. For more information, see <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage\">Buildspec File Name and Storage Location</a>.</p> <note> <p>Since this property allows you to change the build commands that will run in the container, you should note that an IAM principal with the ability to call this API and set this parameter can override the default settings. Moreover, we encourage that you use a trustworthy buildspec location like a file in your source repository or a Amazon S3 bucket. Alternatively, you can restrict overrides to the buildspec by using a condition key: <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/action-context-keys.html#action-context-keys-example-overridebuildspec.html\">Prevent unauthorized modifications to project buildspec</a>.</p> </note>"
49725022
},
49735023
"insecureSslOverride":{
49745024
"shape":"WrapperBoolean",
@@ -5572,6 +5622,10 @@
55725622
"buildType":{
55735623
"shape":"WebhookBuildType",
55745624
"documentation":"<p>Specifies the type of build this webhook will trigger.</p> <note> <p> <code>RUNNER_BUILDKITE_BUILD</code> is only available for <code>NO_SOURCE</code> source type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see <a href=\"https://docs.aws.amazon.com/codebuild/latest/userguide/sample-runner-buildkite.html\">Tutorial: Configure a CodeBuild-hosted Buildkite runner</a> in the <i>CodeBuild user guide</i>.</p> </note>"
5625+
},
5626+
"pullRequestBuildPolicy":{
5627+
"shape":"PullRequestBuildPolicy",
5628+
"documentation":"<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>"
55755629
}
55765630
}
55775631
},

sdk/src/Services/CodeBuild/Generated/Model/CreateWebhookRequest.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public partial class CreateWebhookRequest : AmazonCodeBuildRequest
5454
private List<List<WebhookFilter>> _filterGroups = AWSConfigs.InitializeCollections ? new List<List<WebhookFilter>>() : null;
5555
private bool? _manualCreation;
5656
private string _projectName;
57+
private PullRequestBuildPolicy _pullRequestBuildPolicy;
5758
private ScopeConfiguration _scopeConfiguration;
5859

5960
/// <summary>
@@ -178,6 +179,26 @@ internal bool IsSetProjectName()
178179
return this._projectName != null;
179180
}
180181

182+
/// <summary>
183+
/// Gets and sets the property PullRequestBuildPolicy.
184+
/// <para>
185+
/// A PullRequestBuildPolicy object that defines comment-based approval requirements for
186+
/// triggering builds on pull requests. This policy helps control when automated builds
187+
/// are executed based on contributor permissions and approval workflows.
188+
/// </para>
189+
/// </summary>
190+
public PullRequestBuildPolicy PullRequestBuildPolicy
191+
{
192+
get { return this._pullRequestBuildPolicy; }
193+
set { this._pullRequestBuildPolicy = value; }
194+
}
195+
196+
// Check to see if PullRequestBuildPolicy property is set
197+
internal bool IsSetPullRequestBuildPolicy()
198+
{
199+
return this._pullRequestBuildPolicy != null;
200+
}
201+
181202
/// <summary>
182203
/// Gets and sets the property ScopeConfiguration.
183204
/// <para>

sdk/src/Services/CodeBuild/Generated/Model/Internal/MarshallTransformations/CreateWebhookRequestMarshaller.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@ public IRequest Marshall(CreateWebhookRequest publicRequest)
114114
context.Writer.Write(publicRequest.ProjectName);
115115
}
116116

117+
if(publicRequest.IsSetPullRequestBuildPolicy())
118+
{
119+
context.Writer.WritePropertyName("pullRequestBuildPolicy");
120+
context.Writer.WriteObjectStart();
121+
122+
var marshaller = PullRequestBuildPolicyMarshaller.Instance;
123+
marshaller.Marshall(publicRequest.PullRequestBuildPolicy, context);
124+
125+
context.Writer.WriteObjectEnd();
126+
}
127+
117128
if(publicRequest.IsSetScopeConfiguration())
118129
{
119130
context.Writer.WritePropertyName("scopeConfiguration");

0 commit comments

Comments
 (0)