Skip to content

Commit

Permalink
Merge branch 'master' into fix/pipelines-kms-permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 11, 2020
2 parents 7b5d663 + 698e5ef commit 300e195
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-codebuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ const bbSource = codebuild.Source.bitBucket({
});
```

### For all Git sources

For all Git sources, you can fetch submodules while cloing git repo.

```typescript
const gitHubSource = codebuild.Source.gitHub({
owner: 'awslabs',
repo: 'aws-cdk',
fetchSubmodules: true,
});
```

## Artifacts

CodeBuild Projects can produce Artifacts and upload them to S3. For example:
Expand Down
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-codebuild/lib/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ interface GitSourceProps extends SourceProps {
* @default the default branch's HEAD commit ID is used
*/
readonly branchOrRef?: string;

/**
* Whether to fetch submodules while cloning git repo.
*
* @default false
*/
readonly fetchSubmodules?: boolean;
}

/**
Expand All @@ -127,12 +134,14 @@ interface GitSourceProps extends SourceProps {
abstract class GitSource extends Source {
private readonly cloneDepth?: number;
private readonly branchOrRef?: string;
private readonly fetchSubmodules?: boolean;

protected constructor(props: GitSourceProps) {
super(props);

this.cloneDepth = props.cloneDepth;
this.branchOrRef = props.branchOrRef;
this.fetchSubmodules = props.fetchSubmodules;
}

public bind(_scope: Construct, _project: IProject): SourceConfig {
Expand All @@ -142,6 +151,9 @@ abstract class GitSource extends Source {
sourceProperty: {
...superConfig.sourceProperty,
gitCloneDepth: this.cloneDepth,
gitSubmodulesConfig: this.fetchSubmodules ? {
fetchSubmodules: this.fetchSubmodules,
} : undefined,
},
};
}
Expand Down
4 changes: 4 additions & 0 deletions packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ export = {
owner: 'testowner',
repo: 'testrepo',
cloneDepth: 3,
fetchSubmodules: true,
webhook: true,
reportBuildStatus: false,
webhookFilters: [
Expand All @@ -561,6 +562,9 @@ export = {
Location: 'https://github.com/testowner/testrepo.git',
ReportBuildStatus: false,
GitCloneDepth: 3,
GitSubmodulesConfig: {
FetchSubmodules: true,
},
},
}));

Expand Down

0 comments on commit 300e195

Please sign in to comment.