@@ -34,7 +34,7 @@ export = {
3434 // WHEN
3535 new codebuild . Project ( stack , 'Project' , {
3636 source : new codebuild . CodePipelineSource ( ) ,
37- buildSpec : { phases : [ 'say hi' ] }
37+ buildSpec : { phases : [ 'say hi' ] }
3838 } ) ;
3939
4040 // THEN
@@ -47,6 +47,60 @@ export = {
4747 test . done ( ) ;
4848 } ,
4949
50+ 'github auth test' ( test : Test ) {
51+ // GIVEN
52+ const stack = new cdk . Stack ( ) ;
53+
54+ // WHEN
55+ new codebuild . Project ( stack , 'Project' , {
56+ source : new codebuild . GitHubSource ( {
57+ cloneUrl : "https://github.com/testowner/testrepo" ,
58+ oauthToken : new cdk . Secret ( "test_oauth_token" )
59+ } )
60+ } ) ;
61+
62+ // THEN
63+ expect ( stack ) . to ( haveResource ( 'AWS::CodeBuild::Project' , {
64+ Source : {
65+ Type : "GITHUB" ,
66+ Auth : {
67+ Type : 'OAUTH' ,
68+ Resource : 'test_oauth_token'
69+ } ,
70+ Location : 'https://github.com/testowner/testrepo'
71+ }
72+ } ) ) ;
73+
74+ test . done ( ) ;
75+ } ,
76+
77+ 'github enterprise auth test' ( test : Test ) {
78+ // GIVEN
79+ const stack = new cdk . Stack ( ) ;
80+
81+ // WHEN
82+ new codebuild . Project ( stack , 'Project' , {
83+ source : new codebuild . GitHubEnterpriseSource ( {
84+ cloneUrl : "https://github.testcompany.com/testowner/testrepo" ,
85+ oauthToken : new cdk . Secret ( "test_oauth_token" )
86+ } )
87+ } ) ;
88+
89+ // THEN
90+ expect ( stack ) . to ( haveResource ( 'AWS::CodeBuild::Project' , {
91+ Source : {
92+ Type : "GITHUB_ENTERPRISE" ,
93+ Auth : {
94+ Type : 'OAUTH' ,
95+ Resource : 'test_oauth_token'
96+ } ,
97+ Location : 'https://github.testcompany.com/testowner/testrepo'
98+ }
99+ } ) ) ;
100+
101+ test . done ( ) ;
102+ } ,
103+
50104 'construct from asset' ( test : Test ) {
51105 // GIVEN
52106 const stack = new cdk . Stack ( ) ;
@@ -70,10 +124,12 @@ export = {
70124 {
71125 Name : "SCRIPT_S3_KEY" ,
72126 Type : "PLAINTEXT" ,
73- Value : { "Fn::Join" : [ "" , [
74- { "Fn::Select" : [ 0 , { "Fn::Split" : [ "||" , { Ref : "AssetS3VersionKeyA852DDAE" } ] } ] } ,
75- { "Fn::Select" : [ 1 , { "Fn::Split" : [ "||" , { Ref : "AssetS3VersionKeyA852DDAE" } ] } ] }
76- ] ] }
127+ Value : {
128+ "Fn::Join" : [ "" , [
129+ { "Fn::Select" : [ 0 , { "Fn::Split" : [ "||" , { Ref : "AssetS3VersionKeyA852DDAE" } ] } ] } ,
130+ { "Fn::Select" : [ 1 , { "Fn::Split" : [ "||" , { Ref : "AssetS3VersionKeyA852DDAE" } ] } ] }
131+ ] ]
132+ }
77133 }
78134 ] ,
79135 } ,
0 commit comments