From 437516d78e9723ce48d9b94a15f3d68341a0b40a Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 01:47:04 +0800 Subject: [PATCH 01/15] support GithubRepository resource --- packages/@aws-cdk/aws-codestar/README.md | 15 ++++- packages/@aws-cdk/aws-codestar/lib/github.ts | 62 +++++++++++++++++++ packages/@aws-cdk/aws-codestar/lib/index.ts | 1 + packages/@aws-cdk/aws-codestar/package.json | 7 ++- .../aws-codestar/test/codestar.test.ts | 31 +++++++++- .../test/integ.github.expected.json | 18 ++++++ .../aws-codestar/test/integ.github.ts | 17 +++++ 7 files changed, 145 insertions(+), 6 deletions(-) create mode 100644 packages/@aws-cdk/aws-codestar/lib/github.ts create mode 100644 packages/@aws-cdk/aws-codestar/test/integ.github.expected.json create mode 100644 packages/@aws-cdk/aws-codestar/test/integ.github.ts diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index 3f423f3b8a5ab..f16305eb21955 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -11,6 +11,19 @@ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Github Repository + +To create a new Github Repository and commit the assets from S3 bucket into the repository after it is created + ```ts -import * as codestar from '@aws-cdk/aws-codestar'; +new GithubRepository(stack, 'GithubRepo', { + owner: 'foo', + name: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-github-token', { + jsonField: 'token', + }), + bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + key: 'import.zip', +}); ``` diff --git a/packages/@aws-cdk/aws-codestar/lib/github.ts b/packages/@aws-cdk/aws-codestar/lib/github.ts new file mode 100644 index 0000000000000..25434cf7c37ab --- /dev/null +++ b/packages/@aws-cdk/aws-codestar/lib/github.ts @@ -0,0 +1,62 @@ +import { IBucket } from '@aws-cdk/aws-s3'; +import * as cdk from '@aws-cdk/core'; +import * as codestar from './codestar.generated'; + +/** + * Properties of GithubRepository + */ +export interface GithubRepositoryProps { + /** + * The GitHub user name for the owner of the GitHub repository to be created. If this + * repository should be owned by a GitHub organization, provide its name + */ + readonly owner: string; + /** + * The name of the repository you want to create in GitHub with AWS CloudFormation stack creation + */ + readonly name: string; + /** + * The GitHub user's personal access token for the GitHub repository + */ + readonly accessToken: cdk.SecretValue; + /** + * The name of the Amazon S3 bucket that contains the ZIP file with the content to be committed to the new repository + */ + readonly bucket: IBucket; + /** + * The S3 object key or file name for the ZIP file + */ + readonly key: string; + /** + * The object version of the ZIP file, if versioning is enabled for the Amazon S3 bucket + * @default - not specified + */ + readonly version?: string; +} + +/** + * The GithubRepository resource + */ +export class GithubRepository extends cdk.Construct { + /** + * a string combination of the repository owner and the repository name, + * such as `my-github-account/my-github-repo`. + */ + public readonly repository: string; + constructor(scope: cdk.Construct, id: string, props: GithubRepositoryProps) { + super(scope, id); + + const resource = new codestar.CfnGitHubRepository(this, 'GithubRepo', { + repositoryOwner: props.owner, + repositoryName: props.name, + repositoryAccessToken: props.accessToken.toString(), + code: { + s3: { + bucket: props.bucket.bucketName, + key: props.key, + }, + }, + }); + this.repository = resource.ref; + } +} diff --git a/packages/@aws-cdk/aws-codestar/lib/index.ts b/packages/@aws-cdk/aws-codestar/lib/index.ts index 4114892b944da..32f55b127d9f0 100644 --- a/packages/@aws-cdk/aws-codestar/lib/index.ts +++ b/packages/@aws-cdk/aws-codestar/lib/index.ts @@ -1,2 +1,3 @@ // AWS::CodeStar CloudFormation Resources: export * from './codestar.generated'; +export * from './github'; diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index d0c07ad1c6489..53d7ea6ea5760 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -67,16 +67,19 @@ "devDependencies": { "@aws-cdk/assert": "0.0.0", "cdk-build-tools": "0.0.0", + "cdk-integ-tools": "0.0.0", "cfn2ts": "0.0.0", "pkglint": "0.0.0" }, "dependencies": { + "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", "constructs": "^3.0.2" }, "peerDependencies": { "@aws-cdk/core": "0.0.0", - "constructs": "^3.0.2" + "constructs": "^3.0.2", + "@aws-cdk/aws-s3": "0.0.0" }, "engines": { "node": ">= 10.13.0 <13 || >=13.7.0" @@ -86,4 +89,4 @@ "awscdkio": { "announce": false } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index e394ef336bfb4..2920223159400 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -1,6 +1,31 @@ import '@aws-cdk/assert/jest'; -import {} from '../lib'; +import { Bucket } from '@aws-cdk/aws-s3'; +import * as cdk from '@aws-cdk/core'; +import { GithubRepository } from '../lib'; -test('No tests are specified for this package', () => { - expect(true).toBe(true); +test('create', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'GithubDemo'); + + new GithubRepository(stack, 'GithubRepo', { + owner: 'foo', + name: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-github-token', { + jsonField: 'token', + }), + bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + key: 'import.zip', + }); + + expect(stack).toHaveResource('AWS::CodeStar::GitHubRepository', { + RepositoryAccessToken: '{{resolve:secretsmanager:my-github-token:SecretString:token::}}', + RepositoryName: 'bar', + RepositoryOwner: 'foo', + Code: { + S3: { + Bucket: 'bucket-name', + Key: 'import.zip' + } + } + }); }); diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json new file mode 100644 index 0000000000000..9b808dee4676f --- /dev/null +++ b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json @@ -0,0 +1,18 @@ +{ + "Resources": { + "GithubRepo2AECAAC9": { + "Type": "AWS::CodeStar::GitHubRepository", + "Properties": { + "RepositoryAccessToken": "{{resolve:secretsmanager:my-github-token:SecretString:token::}}", + "RepositoryName": "bar", + "RepositoryOwner": "foo", + "Code": { + "S3": { + "Bucket": "bucket-name", + "Key": "import.zip" + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.ts b/packages/@aws-cdk/aws-codestar/test/integ.github.ts new file mode 100644 index 0000000000000..afe5d405afc00 --- /dev/null +++ b/packages/@aws-cdk/aws-codestar/test/integ.github.ts @@ -0,0 +1,17 @@ +import { Bucket } from '@aws-cdk/aws-s3'; +import * as cdk from '@aws-cdk/core'; +import { GithubRepository } from '../lib'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'GithubDemo'); + +new GithubRepository(stack, 'GithubRepo', { + owner: 'foo', + name: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-github-token', { + jsonField: 'token', + }), + bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + key: 'import.zip', +}); \ No newline at end of file From b25950820feef06b693d500d876a07995237af2a Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 02:06:02 +0800 Subject: [PATCH 02/15] minor fix --- packages/@aws-cdk/aws-codestar/lib/github.ts | 30 +++++++++++++------ .../aws-codestar/test/codestar.test.ts | 18 +++++------ .../test/integ.github.expected.json | 4 +-- .../aws-codestar/test/integ.github.ts | 10 +++---- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/packages/@aws-cdk/aws-codestar/lib/github.ts b/packages/@aws-cdk/aws-codestar/lib/github.ts index 25434cf7c37ab..166066c584846 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github.ts @@ -3,9 +3,20 @@ import * as cdk from '@aws-cdk/core'; import * as codestar from './codestar.generated'; /** - * Properties of GithubRepository + * GitHubRepository resource interface */ -export interface GithubRepositoryProps { +export interface IGitHubRepository extends cdk.IResource { + /** + * a string combination of the repository owner and the repository name, + * such as `my-GitHub-account/my-GitHub-repo`. + */ + readonly repository: string +} + +/** + * Properties of GitHubRepository + */ +export interface GitHubRepositoryProps { /** * The GitHub user name for the owner of the GitHub repository to be created. If this * repository should be owned by a GitHub organization, provide its name @@ -14,7 +25,7 @@ export interface GithubRepositoryProps { /** * The name of the repository you want to create in GitHub with AWS CloudFormation stack creation */ - readonly name: string; + readonly gitHubRepositoryName: string; /** * The GitHub user's personal access token for the GitHub repository */ @@ -35,20 +46,21 @@ export interface GithubRepositoryProps { } /** - * The GithubRepository resource + * The GitHubRepository resource + * @resource AWS::CodeStar::GitHubRepository */ -export class GithubRepository extends cdk.Construct { +export class GitHubRepository extends cdk.Resource implements IGitHubRepository { /** * a string combination of the repository owner and the repository name, - * such as `my-github-account/my-github-repo`. + * such as `my-GitHub-account/my-GitHub-repo`. */ public readonly repository: string; - constructor(scope: cdk.Construct, id: string, props: GithubRepositoryProps) { + constructor(scope: cdk.Construct, id: string, props: GitHubRepositoryProps) { super(scope, id); - const resource = new codestar.CfnGitHubRepository(this, 'GithubRepo', { + const resource = new codestar.CfnGitHubRepository(this, 'GitHubRepo', { repositoryOwner: props.owner, - repositoryName: props.name, + repositoryName: props.gitHubRepositoryName, repositoryAccessToken: props.accessToken.toString(), code: { s3: { diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index 2920223159400..79ef7f3a34aaa 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -1,16 +1,16 @@ import '@aws-cdk/assert/jest'; import { Bucket } from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; -import { GithubRepository } from '../lib'; +import { GitHubRepository } from '../lib'; test('create', () => { const app = new cdk.App(); - const stack = new cdk.Stack(app, 'GithubDemo'); + const stack = new cdk.Stack(app, 'GitHubDemo'); - new GithubRepository(stack, 'GithubRepo', { + new GitHubRepository(stack, 'GitHubRepo', { owner: 'foo', - name: 'bar', - accessToken: cdk.SecretValue.secretsManager('my-github-token', { + gitHubRepositoryName: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-GitHub-token', { jsonField: 'token', }), bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), @@ -18,14 +18,14 @@ test('create', () => { }); expect(stack).toHaveResource('AWS::CodeStar::GitHubRepository', { - RepositoryAccessToken: '{{resolve:secretsmanager:my-github-token:SecretString:token::}}', + RepositoryAccessToken: '{{resolve:secretsmanager:my-GitHub-token:SecretString:token::}}', RepositoryName: 'bar', RepositoryOwner: 'foo', Code: { S3: { Bucket: 'bucket-name', - Key: 'import.zip' - } - } + Key: 'import.zip', + }, + }, }); }); diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json index 9b808dee4676f..ba43f7d6bed4a 100644 --- a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json +++ b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json @@ -1,9 +1,9 @@ { "Resources": { - "GithubRepo2AECAAC9": { + "GitHubRepoD2761255": { "Type": "AWS::CodeStar::GitHubRepository", "Properties": { - "RepositoryAccessToken": "{{resolve:secretsmanager:my-github-token:SecretString:token::}}", + "RepositoryAccessToken": "{{resolve:secretsmanager:my-GitHub-token:SecretString:token::}}", "RepositoryName": "bar", "RepositoryOwner": "foo", "Code": { diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.ts b/packages/@aws-cdk/aws-codestar/test/integ.github.ts index afe5d405afc00..995798da71a76 100644 --- a/packages/@aws-cdk/aws-codestar/test/integ.github.ts +++ b/packages/@aws-cdk/aws-codestar/test/integ.github.ts @@ -1,15 +1,15 @@ import { Bucket } from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; -import { GithubRepository } from '../lib'; +import { GitHubRepository } from '../lib'; const app = new cdk.App(); -const stack = new cdk.Stack(app, 'GithubDemo'); +const stack = new cdk.Stack(app, 'GitHubDemo'); -new GithubRepository(stack, 'GithubRepo', { +new GitHubRepository(stack, 'GitHubRepo', { owner: 'foo', - name: 'bar', - accessToken: cdk.SecretValue.secretsManager('my-github-token', { + gitHubRepositoryName: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-GitHub-token', { jsonField: 'token', }), bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), From 168d3a36fd4e9de677587205a83ec8f747f8af23 Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 02:10:40 +0800 Subject: [PATCH 03/15] minor fix --- packages/@aws-cdk/aws-codestar/README.md | 7 ++++--- packages/@aws-cdk/aws-codestar/package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index f16305eb21955..872565fbf24da 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -6,11 +6,12 @@ > All classes with the `Cfn` prefix in this module ([CFN Resources](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) are always stable and safe to use. ---- - +![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. +> The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package. +--- + ## Github Repository diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index 53d7ea6ea5760..0ab376560ca9d 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -85,7 +85,7 @@ "node": ">= 10.13.0 <13 || >=13.7.0" }, "stability": "experimental", - "maturity": "cfn-only", + "maturity": "experimental", "awscdkio": { "announce": false } From 38069723f6d7619f7bba2af78e529546bd3e27da Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 02:29:22 +0800 Subject: [PATCH 04/15] minor --- packages/@aws-cdk/aws-codestar/README.md | 2 +- packages/@aws-cdk/aws-codestar/package.json | 4 ++-- packages/@aws-cdk/aws-codestar/test/codestar.test.ts | 4 ++-- .../@aws-cdk/aws-codestar/test/integ.github.expected.json | 2 +- packages/@aws-cdk/aws-codestar/test/integ.github.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index 872565fbf24da..e1d2bdf4d3609 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -18,7 +18,7 @@ To create a new Github Repository and commit the assets from S3 bucket into the repository after it is created ```ts -new GithubRepository(stack, 'GithubRepo', { +new GitHubRepository(stack, 'GitHubRepo', { owner: 'foo', name: 'bar', accessToken: cdk.SecretValue.secretsManager('my-github-token', { diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index 0ab376560ca9d..35cf16fd7d5cc 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -78,8 +78,8 @@ }, "peerDependencies": { "@aws-cdk/core": "0.0.0", - "constructs": "^3.0.2", - "@aws-cdk/aws-s3": "0.0.0" + "@aws-cdk/aws-s3": "0.0.0", + "constructs": "^3.0.2" }, "engines": { "node": ">= 10.13.0 <13 || >=13.7.0" diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index 79ef7f3a34aaa..513fa90e831b0 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -10,7 +10,7 @@ test('create', () => { new GitHubRepository(stack, 'GitHubRepo', { owner: 'foo', gitHubRepositoryName: 'bar', - accessToken: cdk.SecretValue.secretsManager('my-GitHub-token', { + accessToken: cdk.SecretValue.secretsManager('my-github-token', { jsonField: 'token', }), bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), @@ -18,7 +18,7 @@ test('create', () => { }); expect(stack).toHaveResource('AWS::CodeStar::GitHubRepository', { - RepositoryAccessToken: '{{resolve:secretsmanager:my-GitHub-token:SecretString:token::}}', + RepositoryAccessToken: '{{resolve:secretsmanager:my-github-token:SecretString:token::}}', RepositoryName: 'bar', RepositoryOwner: 'foo', Code: { diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json index ba43f7d6bed4a..778e62c406361 100644 --- a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json +++ b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json @@ -3,7 +3,7 @@ "GitHubRepoD2761255": { "Type": "AWS::CodeStar::GitHubRepository", "Properties": { - "RepositoryAccessToken": "{{resolve:secretsmanager:my-GitHub-token:SecretString:token::}}", + "RepositoryAccessToken": "{{resolve:secretsmanager:my-github-token:SecretString:token::}}", "RepositoryName": "bar", "RepositoryOwner": "foo", "Code": { diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.ts b/packages/@aws-cdk/aws-codestar/test/integ.github.ts index 995798da71a76..23c59ff15c14f 100644 --- a/packages/@aws-cdk/aws-codestar/test/integ.github.ts +++ b/packages/@aws-cdk/aws-codestar/test/integ.github.ts @@ -9,7 +9,7 @@ const stack = new cdk.Stack(app, 'GitHubDemo'); new GitHubRepository(stack, 'GitHubRepo', { owner: 'foo', gitHubRepositoryName: 'bar', - accessToken: cdk.SecretValue.secretsManager('my-GitHub-token', { + accessToken: cdk.SecretValue.secretsManager('my-github-token', { jsonField: 'token', }), bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), From a6be6e52ba81a46765e1d75cf8ef444c1f85c52e Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 02:30:24 +0800 Subject: [PATCH 05/15] minor --- packages/@aws-cdk/aws-codestar/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index e1d2bdf4d3609..414f6cd758635 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -13,9 +13,9 @@ --- -## Github Repository +## GitHub Repository -To create a new Github Repository and commit the assets from S3 bucket into the repository after it is created +To create a new GitHub Repository and commit the assets from S3 bucket into the repository after it is created ```ts new GitHubRepository(stack, 'GitHubRepo', { From 3d82997c75b4cdc4a653b4ddd6811fb9ab8cad24 Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 02:45:46 +0800 Subject: [PATCH 06/15] add enableIssues and isPrivate --- packages/@aws-cdk/aws-codestar/lib/github.ts | 25 +++++++++++++++ .../aws-codestar/test/codestar.test.ts | 31 +++++++++++++++++++ .../test/integ.github.expected.json | 4 ++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-codestar/lib/github.ts b/packages/@aws-cdk/aws-codestar/lib/github.ts index 166066c584846..16fa605f46cff 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github.ts @@ -40,9 +40,31 @@ export interface GitHubRepositoryProps { readonly key: string; /** * The object version of the ZIP file, if versioning is enabled for the Amazon S3 bucket + * * @default - not specified */ readonly version?: string; + /** + * Indicates whether to enable issues for the GitHub repository. You can use GitHub issues to track information + * and bugs for your repository. + * + * @default false + */ + readonly enableIssues?: boolean; + /** + * Indicates whether the GitHub repository is a private repository. If so, you choose who can see and commit to + * this repository. + * + * @default false + */ + readonly private?: boolean; + /** + * A comment or description about the new repository. This description is displayed in GitHub after the repository + * is created. + * + * @default - no description + */ + readonly description?: string; } /** @@ -68,6 +90,9 @@ export class GitHubRepository extends cdk.Resource implements IGitHubRepository key: props.key, }, }, + enableIssues: props.enableIssues ?? false, + isPrivate: props.private ?? false, + repositoryDescription: props.description, }); this.repository = resource.ref; } diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index 513fa90e831b0..9a35d1ee996ac 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -29,3 +29,34 @@ test('create', () => { }, }); }); + +test('enable issues and private', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'GitHubDemo'); + + new GitHubRepository(stack, 'GitHubRepo', { + owner: 'foo', + gitHubRepositoryName: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-github-token', { + jsonField: 'token', + }), + bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + key: 'import.zip', + enableIssues: true, + private: true, + }); + + expect(stack).toHaveResource('AWS::CodeStar::GitHubRepository', { + RepositoryAccessToken: '{{resolve:secretsmanager:my-github-token:SecretString:token::}}', + RepositoryName: 'bar', + RepositoryOwner: 'foo', + Code: { + S3: { + Bucket: 'bucket-name', + Key: 'import.zip', + }, + }, + EnableIssues: true, + IsPrivate: true, + }); +}); diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json index 778e62c406361..936427d16d9c3 100644 --- a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json +++ b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json @@ -11,7 +11,9 @@ "Bucket": "bucket-name", "Key": "import.zip" } - } + }, + "EnableIssues": false, + "IsPrivate": false } } } From 251b27d40f9eec13270a83e052d7ab3480ba6dcc Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Wed, 27 May 2020 08:28:30 +0800 Subject: [PATCH 07/15] Update packages/@aws-cdk/aws-codestar/README.md Co-authored-by: Adam Ruka --- packages/@aws-cdk/aws-codestar/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index 414f6cd758635..a525d510a186a 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -15,7 +15,7 @@ ## GitHub Repository -To create a new GitHub Repository and commit the assets from S3 bucket into the repository after it is created +To create a new GitHub Repository and commit the assets from S3 bucket into the repository after it is created: ```ts new GitHubRepository(stack, 'GitHubRepo', { From 40eb81ba101133df1ae6464882146855b553808f Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Wed, 27 May 2020 08:46:51 +0800 Subject: [PATCH 08/15] Update packages/@aws-cdk/aws-codestar/lib/github.ts Co-authored-by: Adam Ruka --- packages/@aws-cdk/aws-codestar/lib/github.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-codestar/lib/github.ts b/packages/@aws-cdk/aws-codestar/lib/github.ts index 16fa605f46cff..73b8ce34ef977 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github.ts @@ -14,7 +14,7 @@ export interface IGitHubRepository extends cdk.IResource { } /** - * Properties of GitHubRepository + * Construction properties of {@link GitHubRepository}. */ export interface GitHubRepositoryProps { /** From a508d7097e5c370d68df30518cb39613e127e778 Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 11:39:26 +0800 Subject: [PATCH 09/15] fix --- packages/@aws-cdk/aws-codestar/README.md | 7 +- .../lib/{github.ts => github-repository.ts} | 72 +++++++++----- packages/@aws-cdk/aws-codestar/lib/index.ts | 2 +- packages/@aws-cdk/aws-codestar/package.json | 2 +- .../aws-codestar/test/codestar.test.ts | 94 +++++++++---------- .../test/integ.github.expected.json | 20 ---- .../aws-codestar/test/integ.github.ts | 17 ---- 7 files changed, 100 insertions(+), 114 deletions(-) rename packages/@aws-cdk/aws-codestar/lib/{github.ts => github-repository.ts} (67%) delete mode 100644 packages/@aws-cdk/aws-codestar/test/integ.github.expected.json delete mode 100644 packages/@aws-cdk/aws-codestar/test/integ.github.ts diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index a525d510a186a..caf4e9d1b20be 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -18,13 +18,16 @@ To create a new GitHub Repository and commit the assets from S3 bucket into the repository after it is created: ```ts -new GitHubRepository(stack, 'GitHubRepo', { +import * as codestar from '@aws-cdk/aws-codestar'; +import * as s3 from '@aws-cdk/aws-s3' + +new codestar.GitHubRepository(stack, 'GitHubRepo', { owner: 'foo', name: 'bar', accessToken: cdk.SecretValue.secretsManager('my-github-token', { jsonField: 'token', }), - bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + bucket: s3.Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), key: 'import.zip', }); ``` diff --git a/packages/@aws-cdk/aws-codestar/lib/github.ts b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts similarity index 67% rename from packages/@aws-cdk/aws-codestar/lib/github.ts rename to packages/@aws-cdk/aws-codestar/lib/github-repository.ts index 16fa605f46cff..a733332ddc85c 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts @@ -1,4 +1,4 @@ -import { IBucket } from '@aws-cdk/aws-s3'; +import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; import * as codestar from './codestar.generated'; @@ -7,10 +7,14 @@ import * as codestar from './codestar.generated'; */ export interface IGitHubRepository extends cdk.IResource { /** - * a string combination of the repository owner and the repository name, - * such as `my-GitHub-account/my-GitHub-repo`. + * the repository owner */ - readonly repository: string + readonly owner: string + + /** + * the repository name + */ + readonly repo: string } /** @@ -22,42 +26,50 @@ export interface GitHubRepositoryProps { * repository should be owned by a GitHub organization, provide its name */ readonly owner: string; + /** * The name of the repository you want to create in GitHub with AWS CloudFormation stack creation */ - readonly gitHubRepositoryName: string; + readonly repositoryName: string; + /** * The GitHub user's personal access token for the GitHub repository */ readonly accessToken: cdk.SecretValue; + /** * The name of the Amazon S3 bucket that contains the ZIP file with the content to be committed to the new repository */ - readonly bucket: IBucket; + readonly contentsBucket: s3.IBucket; + /** * The S3 object key or file name for the ZIP file */ - readonly key: string; + readonly contentsKey: string; + /** * The object version of the ZIP file, if versioning is enabled for the Amazon S3 bucket * * @default - not specified */ - readonly version?: string; + readonly contentsS3Version?: string; + /** * Indicates whether to enable issues for the GitHub repository. You can use GitHub issues to track information * and bugs for your repository. * - * @default false + * @default true */ readonly enableIssues?: boolean; + /** * Indicates whether the GitHub repository is a private repository. If so, you choose who can see and commit to * this repository. * - * @default false + * @default Visibility.PUBLIC */ - readonly private?: boolean; + readonly visibility?: Visibility; + /** * A comment or description about the new repository. This description is displayed in GitHub after the repository * is created. @@ -69,31 +81,45 @@ export interface GitHubRepositoryProps { /** * The GitHubRepository resource - * @resource AWS::CodeStar::GitHubRepository */ export class GitHubRepository extends cdk.Resource implements IGitHubRepository { - /** - * a string combination of the repository owner and the repository name, - * such as `my-GitHub-account/my-GitHub-repo`. - */ - public readonly repository: string; + + public readonly owner: string; + public readonly repo: string; + constructor(scope: cdk.Construct, id: string, props: GitHubRepositoryProps) { super(scope, id); - const resource = new codestar.CfnGitHubRepository(this, 'GitHubRepo', { + const resource = new codestar.CfnGitHubRepository(this, 'Resource', { repositoryOwner: props.owner, - repositoryName: props.gitHubRepositoryName, + repositoryName: props.repositoryName, repositoryAccessToken: props.accessToken.toString(), code: { s3: { - bucket: props.bucket.bucketName, - key: props.key, + bucket: props.contentsBucket.bucketName, + key: props.contentsKey, }, }, enableIssues: props.enableIssues ?? false, - isPrivate: props.private ?? false, + isPrivate: props.visibility === Visibility.PRIVATE ? true : false, repositoryDescription: props.description, }); - this.repository = resource.ref; + + this.owner = cdk.Fn.select(0, cdk.Fn.split('/', resource.ref)); + this.repo = cdk.Fn.select(1, cdk.Fn.split('/', resource.ref)); } } + +/** + * Visibility of the GitHubRepository + */ +export enum Visibility { + /** + * private repository + */ + PRIVATE, + /** + * public repository + */ + PUBLIC, +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codestar/lib/index.ts b/packages/@aws-cdk/aws-codestar/lib/index.ts index 32f55b127d9f0..ff8a544388441 100644 --- a/packages/@aws-cdk/aws-codestar/lib/index.ts +++ b/packages/@aws-cdk/aws-codestar/lib/index.ts @@ -1,3 +1,3 @@ // AWS::CodeStar CloudFormation Resources: export * from './codestar.generated'; -export * from './github'; +export * from './github-repository'; diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index 35cf16fd7d5cc..5d3c55c02d699 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -77,8 +77,8 @@ "constructs": "^3.0.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", + "@aws-cdk/core": "0.0.0", "constructs": "^3.0.2" }, "engines": { diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index 9a35d1ee996ac..b0d58fb62d17b 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -1,62 +1,56 @@ import '@aws-cdk/assert/jest'; import { Bucket } from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; -import { GitHubRepository } from '../lib'; +import { GitHubRepository, Visibility } from '../lib'; -test('create', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'GitHubDemo'); +describe('GitHub Repository', () => { + let stack: cdk.Stack; - new GitHubRepository(stack, 'GitHubRepo', { - owner: 'foo', - gitHubRepositoryName: 'bar', - accessToken: cdk.SecretValue.secretsManager('my-github-token', { - jsonField: 'token', - }), - bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), - key: 'import.zip', + beforeEach(() => { + const app = new cdk.App(); + stack = new cdk.Stack(app, 'GitHubDemo'); }); - expect(stack).toHaveResource('AWS::CodeStar::GitHubRepository', { - RepositoryAccessToken: '{{resolve:secretsmanager:my-github-token:SecretString:token::}}', - RepositoryName: 'bar', - RepositoryOwner: 'foo', - Code: { - S3: { - Bucket: 'bucket-name', - Key: 'import.zip', + test('create', () => { + new GitHubRepository(stack, 'GitHubRepo', { + owner: 'foo', + repositoryName: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-github-token', { + jsonField: 'token', + }), + contentsBucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + contentsKey: 'import.zip', + }); + + expect(stack).toHaveResource('AWS::CodeStar::GitHubRepository', { + RepositoryAccessToken: '{{resolve:secretsmanager:my-github-token:SecretString:token::}}', + RepositoryName: 'bar', + RepositoryOwner: 'foo', + Code: { + S3: { + Bucket: 'bucket-name', + Key: 'import.zip', + }, }, - }, + }); }); -}); - -test('enable issues and private', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'GitHubDemo'); - new GitHubRepository(stack, 'GitHubRepo', { - owner: 'foo', - gitHubRepositoryName: 'bar', - accessToken: cdk.SecretValue.secretsManager('my-github-token', { - jsonField: 'token', - }), - bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), - key: 'import.zip', - enableIssues: true, - private: true, - }); + test('enable issues and private', () => { + new GitHubRepository(stack, 'GitHubRepo', { + owner: 'foo', + repositoryName: 'bar', + accessToken: cdk.SecretValue.secretsManager('my-github-token', { + jsonField: 'token', + }), + contentsBucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + contentsKey: 'import.zip', + enableIssues: true, + visibility: Visibility.PRIVATE, + }); - expect(stack).toHaveResource('AWS::CodeStar::GitHubRepository', { - RepositoryAccessToken: '{{resolve:secretsmanager:my-github-token:SecretString:token::}}', - RepositoryName: 'bar', - RepositoryOwner: 'foo', - Code: { - S3: { - Bucket: 'bucket-name', - Key: 'import.zip', - }, - }, - EnableIssues: true, - IsPrivate: true, + expect(stack).toHaveResourceLike('AWS::CodeStar::GitHubRepository', { + EnableIssues: true, + IsPrivate: true, + }); }); -}); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json b/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json deleted file mode 100644 index 936427d16d9c3..0000000000000 --- a/packages/@aws-cdk/aws-codestar/test/integ.github.expected.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Resources": { - "GitHubRepoD2761255": { - "Type": "AWS::CodeStar::GitHubRepository", - "Properties": { - "RepositoryAccessToken": "{{resolve:secretsmanager:my-github-token:SecretString:token::}}", - "RepositoryName": "bar", - "RepositoryOwner": "foo", - "Code": { - "S3": { - "Bucket": "bucket-name", - "Key": "import.zip" - } - }, - "EnableIssues": false, - "IsPrivate": false - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codestar/test/integ.github.ts b/packages/@aws-cdk/aws-codestar/test/integ.github.ts deleted file mode 100644 index 23c59ff15c14f..0000000000000 --- a/packages/@aws-cdk/aws-codestar/test/integ.github.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Bucket } from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { GitHubRepository } from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'GitHubDemo'); - -new GitHubRepository(stack, 'GitHubRepo', { - owner: 'foo', - gitHubRepositoryName: 'bar', - accessToken: cdk.SecretValue.secretsManager('my-github-token', { - jsonField: 'token', - }), - bucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), - key: 'import.zip', -}); \ No newline at end of file From fab739d83996e7da0a1d0c0b1fb80f8eabbeed4e Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 11:47:06 +0800 Subject: [PATCH 10/15] update README --- packages/@aws-cdk/aws-codestar/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index caf4e9d1b20be..7b103c7c5b9ee 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -22,12 +22,12 @@ import * as codestar from '@aws-cdk/aws-codestar'; import * as s3 from '@aws-cdk/aws-s3' new codestar.GitHubRepository(stack, 'GitHubRepo', { - owner: 'foo', - name: 'bar', + owner: 'owner-name', + repositoryName: 'my-new-repo', accessToken: cdk.SecretValue.secretsManager('my-github-token', { jsonField: 'token', }), - bucket: s3.Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), - key: 'import.zip', + contentsBucket: s3.Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), + contentsKey: 'import.zip', }); ``` From 5b9107ae5f5abd618b97818fa5e542085ed3804a Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 11:59:13 +0800 Subject: [PATCH 11/15] add awslint exclute rule --- packages/@aws-cdk/aws-codestar/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index 5d3c55c02d699..438baf7f8778a 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -84,6 +84,11 @@ "engines": { "node": ">= 10.13.0 <13 || >=13.7.0" }, + "awslint": { + "exclude": [ + "props-physical-name:@aws-cdk/aws-codestar.GitHubRepositoryProps" + ] + }, "stability": "experimental", "maturity": "experimental", "awscdkio": { From 5ef9d1c6f957d96c7ddbb91ff84e09e345aa0b3a Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 27 May 2020 12:10:03 +0800 Subject: [PATCH 12/15] add trailing newline --- packages/@aws-cdk/aws-codestar/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index 438baf7f8778a..2b1d9cfc7773c 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -94,4 +94,4 @@ "awscdkio": { "announce": false } -} \ No newline at end of file +} From e967b9ac1448f1026cd7538b5d48b56a5e61fd07 Mon Sep 17 00:00:00 2001 From: Pahud Date: Fri, 29 May 2020 07:10:33 +0800 Subject: [PATCH 13/15] add newlines --- packages/@aws-cdk/aws-codestar/lib/github-repository.ts | 2 +- packages/@aws-cdk/aws-codestar/test/codestar.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts index 6500cdd9f5280..7ae4842fbef35 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts @@ -122,4 +122,4 @@ export enum Visibility { * public repository */ PUBLIC, -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index b0d58fb62d17b..53e728ceb55a2 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -53,4 +53,4 @@ describe('GitHub Repository', () => { IsPrivate: true, }); }); -}); \ No newline at end of file +}); From dba74b92cfc9b3ebb415a343c54f70cbbefbdfa9 Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 3 Jun 2020 08:16:27 +0800 Subject: [PATCH 14/15] fix --- packages/@aws-cdk/aws-codestar/README.md | 4 ++-- .../@aws-cdk/aws-codestar/lib/github-repository.ts | 11 ++++++----- packages/@aws-cdk/aws-codestar/test/codestar.test.ts | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index 7b103c7c5b9ee..549ba5a81821a 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -22,8 +22,8 @@ import * as codestar from '@aws-cdk/aws-codestar'; import * as s3 from '@aws-cdk/aws-s3' new codestar.GitHubRepository(stack, 'GitHubRepo', { - owner: 'owner-name', - repositoryName: 'my-new-repo', + owner: 'aws', + repositoryName: 'aws-cdk', accessToken: cdk.SecretValue.secretsManager('my-github-token', { jsonField: 'token', }), diff --git a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts index 7ae4842fbef35..0afd45eb0c826 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts @@ -66,9 +66,9 @@ export interface GitHubRepositoryProps { * Indicates whether the GitHub repository is a private repository. If so, you choose who can see and commit to * this repository. * - * @default Visibility.PUBLIC + * @default RepositoryVisibility.PUBLIC */ - readonly visibility?: Visibility; + readonly visibility?: RepositoryVisibility; /** * A comment or description about the new repository. This description is displayed in GitHub after the repository @@ -98,10 +98,11 @@ export class GitHubRepository extends cdk.Resource implements IGitHubRepository s3: { bucket: props.contentsBucket.bucketName, key: props.contentsKey, + objectVersion: props.contentsS3Version, }, }, - enableIssues: props.enableIssues ?? false, - isPrivate: props.visibility === Visibility.PRIVATE ? true : false, + enableIssues: props.enableIssues ?? true, + isPrivate: props.visibility === RepositoryVisibility.PRIVATE ? true : false, repositoryDescription: props.description, }); @@ -113,7 +114,7 @@ export class GitHubRepository extends cdk.Resource implements IGitHubRepository /** * Visibility of the GitHubRepository */ -export enum Visibility { +export enum RepositoryVisibility { /** * private repository */ diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index 53e728ceb55a2..bc551f25a41d3 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -1,7 +1,7 @@ import '@aws-cdk/assert/jest'; import { Bucket } from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; -import { GitHubRepository, Visibility } from '../lib'; +import { GitHubRepository, RepositoryVisibility } from '../lib'; describe('GitHub Repository', () => { let stack: cdk.Stack; @@ -45,7 +45,7 @@ describe('GitHub Repository', () => { contentsBucket: Bucket.fromBucketName(stack, 'Bucket', 'bucket-name'), contentsKey: 'import.zip', enableIssues: true, - visibility: Visibility.PRIVATE, + visibility: RepositoryVisibility.PRIVATE, }); expect(stack).toHaveResourceLike('AWS::CodeStar::GitHubRepository', { From 118a6bae5a80d727f640ab48dcf37c799be5278c Mon Sep 17 00:00:00 2001 From: Pahud Date: Wed, 3 Jun 2020 14:24:34 +0800 Subject: [PATCH 15/15] Add 'Update or Delete the GitHubRepository' in the README --- packages/@aws-cdk/aws-codestar/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index 549ba5a81821a..87c1685ad6ffd 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -31,3 +31,7 @@ new codestar.GitHubRepository(stack, 'GitHubRepo', { contentsKey: 'import.zip', }); ``` + +## Update or Delete the GitHubRepository + +At this moment, updates to the `GitHubRepository` are not supported and the repository will not be deleted upon the deletion of the CloudFormation stack. You will need to update or delete the GitHub repository manually.