File tree Expand file tree Collapse file tree 3 files changed +81
-0
lines changed
packages/@aws-cdk/aws-codebuild Expand file tree Collapse file tree 3 files changed +81
-0
lines changed Original file line number Diff line number Diff line change @@ -617,3 +617,31 @@ if (project.enableBatchBuilds()) {
617617 console .log (' Batch builds were enabled' );
618618}
619619```
620+
621+ ## Timeouts
622+
623+ There are two types of timeouts that can be set when creating your Project.
624+ The ` timeout ` property can be used to set an upper limit on how long your Project is able to run without being marked as completed.
625+ The default is 60 minutes.
626+ An example of overriding the default follows.
627+
628+ ``` ts
629+ import * as codebuild from ' @aws-cdk/aws-codebuild' ;
630+
631+ new codebuild .Project (stack , ' MyProject' , {
632+ timeout: Duration .minutes (90 )
633+ });
634+ ```
635+
636+ The ` queuedTimeout ` property can be used to set an upper limit on how your Project remains queued to run.
637+ There is no default value for this property.
638+ As an example, to allow your Project to queue for up to thirty (30) minutes before the build fails,
639+ use the following code.
640+
641+ ``` ts
642+ import * as codebuild from ' @aws-cdk/aws-codebuild' ;
643+
644+ new codebuild .Project (stack , ' MyProject' , {
645+ queuedTimeout: Duration .minutes (30 )
646+ });
647+ ```
Original file line number Diff line number Diff line change @@ -575,6 +575,15 @@ export interface CommonProjectProps {
575575 * @default - no log configuration is set
576576 */
577577 readonly logging ?: LoggingOptions ;
578+
579+ /**
580+ * The number of minutes after which AWS CodeBuild stops the build if it's
581+ * still in queue. For valid values, see the timeoutInMinutes field in the AWS
582+ * CodeBuild User Guide.
583+ *
584+ * @default - no queue timeout is set
585+ */
586+ readonly queuedTimeout ?: Duration
578587}
579588
580589export interface ProjectProps extends CommonProjectProps {
@@ -869,6 +878,7 @@ export class Project extends ProjectBase {
869878 cache : cache . _toCloudFormation ( ) ,
870879 name : this . physicalName ,
871880 timeoutInMinutes : props . timeout && props . timeout . toMinutes ( ) ,
881+ queuedTimeoutInMinutes : props . queuedTimeout && props . queuedTimeout . toMinutes ( ) ,
872882 secondarySources : Lazy . any ( { produce : ( ) => this . renderSecondarySources ( ) } ) ,
873883 secondarySourceVersions : Lazy . any ( { produce : ( ) => this . renderSecondarySourceVersions ( ) } ) ,
874884 secondaryArtifacts : Lazy . any ( { produce : ( ) => this . renderSecondaryArtifacts ( ) } ) ,
Original file line number Diff line number Diff line change @@ -960,4 +960,47 @@ export = {
960960 test . done ( ) ;
961961 } ,
962962 } ,
963+
964+ 'Timeouts' : {
965+ 'can add queued timeout' ( test : Test ) {
966+ // GIVEN
967+ const stack = new cdk . Stack ( ) ;
968+
969+ // WHEN
970+ new codebuild . Project ( stack , 'Project' , {
971+ source : codebuild . Source . s3 ( {
972+ bucket : new s3 . Bucket ( stack , 'Bucket' ) ,
973+ path : 'path' ,
974+ } ) ,
975+ queuedTimeout : cdk . Duration . minutes ( 30 ) ,
976+ } ) ;
977+
978+ // THEN
979+ expect ( stack ) . to ( haveResourceLike ( 'AWS::CodeBuild::Project' , {
980+ QueuedTimeoutInMinutes : 30 ,
981+ } ) ) ;
982+
983+ test . done ( ) ;
984+ } ,
985+ 'can override build timeout' ( test : Test ) {
986+ // GIVEN
987+ const stack = new cdk . Stack ( ) ;
988+
989+ // WHEN
990+ new codebuild . Project ( stack , 'Project' , {
991+ source : codebuild . Source . s3 ( {
992+ bucket : new s3 . Bucket ( stack , 'Bucket' ) ,
993+ path : 'path' ,
994+ } ) ,
995+ timeout : cdk . Duration . minutes ( 30 ) ,
996+ } ) ;
997+
998+ // THEN
999+ expect ( stack ) . to ( haveResourceLike ( 'AWS::CodeBuild::Project' , {
1000+ TimeoutInMinutes : 30 ,
1001+ } ) ) ;
1002+
1003+ test . done ( ) ;
1004+ } ,
1005+ } ,
9631006} ;
You can’t perform that action at this time.
0 commit comments