Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Feb 9, 2021
2 parents 5377713 + 6597a09 commit ad06392
Show file tree
Hide file tree
Showing 114 changed files with 2,003 additions and 402 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/auto-approve-v2-merge-forward.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/v2-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Automated actions for PRs against the v2-main branch
name: v2
on:
pull_request:
branches:
- v2-main
types:
- labeled
- opened
- ready_for_review
- reopened
- synchronize
- unlabeled
- unlocked

jobs:
# Run yarn pkglint on merge forward PRs and commit the results
pkglint:
if: contains(github.event.pull_request.labels.*.name, 'pr/forward-merge')
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
branch: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: lint
run: |-
yarn install --frozen-lockfile
yarn pkglint
- name: push
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'automatic pkglint fixes'

# Approve automated PRs
# Only approve! mergify takes care of the actual merge.
auto-approve:
if: >
github.event.pull_request.user.login == 'aws-cdk-automation'
&& contains(github.event.pull_request.labels.*.name, 'pr/auto-approve')
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action@v2.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
13 changes: 8 additions & 5 deletions .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v2

- name: Set up Node
uses: actions/setup-node@v2.1.0
uses: actions/setup-node@v2.1.4
with:
node-version: 10

Expand Down Expand Up @@ -55,12 +55,15 @@ jobs:
lerna exec --parallel ncu -- --upgrade --filter=@types/node,@types/fs-extra --target=minor
lerna exec --parallel ncu -- --upgrade --filter=typescript --target=patch
lerna exec --parallel ncu -- --upgrade --reject='@types/node,@types/fs-extra,constructs,typescript,aws-sdk,${{ steps.list-packages.outputs.list }}' --target=minor
# This will create a brand new `yarn.lock` file (this is more efficient than `yarn install && yarn upgrade`)
- name: Run "yarn install --force"
run: yarn install --force
# This will ensure the current lockfile is up-to-date with the dependency specifications (necessary for "yarn update" to run)
- name: Run "yarn install"
run: yarn install

- name: Run "yarn upgrade"
run: yarn upgrade

- name: Make Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v3
with:
# Git commit details
branch: automation/yarn-upgrade
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/lib/assertions/have-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class HaveResourceAssertion extends JestFriendlyAssertion<StackInspector>
properties === undefined ? anything() :
allowValueExtension ? deepObjectLike(properties) :
objectLike(properties);
this.part = part !== undefined ? part : ResourcePart.Properties;
this.part = part ?? ResourcePart.Properties;
}

public assertUsing(inspector: StackInspector): boolean {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-amplify/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ export class App extends Resource implements IApp, iam.IGrantable {
basicAuthConfig: props.autoBranchCreation.basicAuth && props.autoBranchCreation.basicAuth.bind(this, 'BranchBasicAuth'),
buildSpec: props.autoBranchCreation.buildSpec && props.autoBranchCreation.buildSpec.toBuildSpec(),
enableAutoBranchCreation: true,
enableAutoBuild: props.autoBranchCreation.autoBuild === undefined ? true : props.autoBranchCreation.autoBuild,
enableAutoBuild: props.autoBranchCreation.autoBuild ?? true,
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables ) }, { omitEmptyArray: true }), // eslint-disable-line max-len
enablePullRequestPreview: props.autoBranchCreation.pullRequestPreview === undefined ? true : props.autoBranchCreation.pullRequestPreview,
enablePullRequestPreview: props.autoBranchCreation.pullRequestPreview ?? true,
pullRequestEnvironmentName: props.autoBranchCreation.pullRequestEnvironmentName,
stage: props.autoBranchCreation.stage,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-amplify/lib/branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export class Branch extends Resource implements IBranch {
branchName,
buildSpec: props.buildSpec && props.buildSpec.toBuildSpec(),
description: props.description,
enableAutoBuild: props.autoBuild === undefined ? true : props.autoBuild,
enablePullRequestPreview: props.pullRequestPreview === undefined ? true : props.pullRequestPreview,
enableAutoBuild: props.autoBuild ?? true,
enablePullRequestPreview: props.pullRequestPreview ?? true,
environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }),
pullRequestEnvironmentName: props.pullRequestEnvironmentName,
stage: props.stage,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-amplify/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class Domain extends Resource {
private renderSubDomainSettings() {
return this.subDomains.map(s => ({
branchName: s.branch.branchName,
prefix: s.prefix === undefined ? s.branch.branchName : s.prefix,
prefix: s.prefix ?? s.branch.branchName,
}));
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface HttpIntegrationProps {
*/
export class HttpIntegration extends Integration {
constructor(url: string, props: HttpIntegrationProps = { }) {
const proxy = props.proxy !== undefined ? props.proxy : true;
const proxy = props.proxy ?? true;
const method = props.httpMethod || 'GET';
super({
type: proxy ? IntegrationType.HTTP_PROXY : IntegrationType.HTTP,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class LambdaIntegration extends AwsIntegration {
private readonly enableTest: boolean;

constructor(handler: lambda.IFunction, options: LambdaIntegrationOptions = { }) {
const proxy = options.proxy === undefined ? true : options.proxy;
const proxy = options.proxy ?? true;

super({
proxy,
Expand All @@ -51,7 +51,7 @@ export class LambdaIntegration extends AwsIntegration {
});

this.handler = handler;
this.enableTest = options.allowTestInvoke === undefined ? true : options.allowTestInvoke;
this.enableTest = options.allowTestInvoke ?? true;
}

public bind(method: Method): IntegrationConfig {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export abstract class ResourceBase extends ResourceConstruct implements IResourc
//
// statusCode

const statusCode = options.statusCode !== undefined ? options.statusCode : 204;
const statusCode = options.statusCode ?? 204;

//
// prepare responseParams
Expand Down Expand Up @@ -522,7 +522,7 @@ export class ProxyResource extends Resource {
defaultMethodOptions: props.defaultMethodOptions,
});

const anyMethod = props.anyMethod !== undefined ? props.anyMethod : true;
const anyMethod = props.anyMethod ?? true;
if (anyMethod) {
this.anyMethod = this.addMethod('ANY');
}
Expand Down
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ export abstract class RestApiBase extends Resource implements IRestApi {
}

protected configureDeployment(props: RestApiOptions) {
const deploy = props.deploy === undefined ? true : props.deploy;
const deploy = props.deploy ?? true;
if (deploy) {

this._latestDeployment = new Deployment(this, 'Deployment', {
Expand Down Expand Up @@ -593,7 +593,7 @@ export class SpecRestApi extends RestApiBase {
name: this.restApiName,
policy: props.policy,
failOnWarnings: props.failOnWarnings,
body: apiDefConfig.inlineDefinition ? apiDefConfig.inlineDefinition : undefined,
body: apiDefConfig.inlineDefinition ?? undefined,
bodyS3Location: apiDefConfig.inlineDefinition ? undefined : apiDefConfig.s3Location,
endpointConfiguration: this._configureEndpoints(props),
parameters: props.parameters,
Expand All @@ -608,7 +608,7 @@ export class SpecRestApi extends RestApiBase {
this.addDomainName('CustomDomain', props.domainName);
}

const cloudWatchRole = props.cloudWatchRole !== undefined ? props.cloudWatchRole : true;
const cloudWatchRole = props.cloudWatchRole ?? true;
if (cloudWatchRole) {
this.configureCloudWatchRole(resource);
}
Expand Down Expand Up @@ -700,13 +700,13 @@ export class RestApi extends RestApiBase {
binaryMediaTypes: props.binaryMediaTypes,
endpointConfiguration: this._configureEndpoints(props),
apiKeySourceType: props.apiKeySourceType,
cloneFrom: props.cloneFrom ? props.cloneFrom.restApiId : undefined,
cloneFrom: props.cloneFrom?.restApiId,
parameters: props.parameters,
});
this.node.defaultChild = resource;
this.restApiId = resource.ref;

const cloudWatchRole = props.cloudWatchRole !== undefined ? props.cloudWatchRole : true;
const cloudWatchRole = props.cloudWatchRole ?? true;
if (cloudWatchRole) {
this.configureCloudWatchRole(resource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export abstract class BaseScalableAttribute extends CoreConstruct {
scalableDimension: this.props.dimension,
resourceId: this.props.resourceId,
role: this.props.role,
minCapacity: props.minCapacity !== undefined ? props.minCapacity : 1,
minCapacity: props.minCapacity ?? 1,
maxCapacity: props.maxCapacity,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function orderAndCompleteIntervals(intervals: ScalingInterval[]): CompleteScalin
intervals = intervals.map(x => ({ ...x }));

// Sort by whatever number we have for each interval
intervals.sort(comparatorFromKey((x: ScalingInterval) => x.lower !== undefined ? x.lower : x.upper));
intervals.sort(comparatorFromKey((x: ScalingInterval) => x.lower ?? x.upper));

// Propagate boundaries until no more change
while (propagateBounds(intervals)) { /* Repeat */ }
Expand Down
9 changes: 4 additions & 5 deletions packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,8 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements

// desiredCapacity just reflects what the user has supplied.
const desiredCapacity = props.desiredCapacity;
const minCapacity = props.minCapacity !== undefined ? props.minCapacity : 1;
const maxCapacity = props.maxCapacity !== undefined ? props.maxCapacity :
desiredCapacity !== undefined ? desiredCapacity : Math.max(minCapacity, 1);
const minCapacity = props.minCapacity ?? 1;
const maxCapacity = props.maxCapacity ?? desiredCapacity ?? Math.max(minCapacity, 1);

withResolved(minCapacity, maxCapacity, (min, max) => {
if (min > max) {
Expand Down Expand Up @@ -1009,7 +1008,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
const { subnetIds, hasPublic } = props.vpc.selectSubnets(props.vpcSubnets);
const asgProps: CfnAutoScalingGroupProps = {
autoScalingGroupName: this.physicalName,
cooldown: props.cooldown !== undefined ? props.cooldown.toSeconds().toString() : undefined,
cooldown: props.cooldown?.toSeconds().toString(),
minSize: Tokenization.stringifyNumber(minCapacity),
maxSize: Tokenization.stringifyNumber(maxCapacity),
desiredCapacity: desiredCapacity !== undefined ? Tokenization.stringifyNumber(desiredCapacity) : undefined,
Expand Down Expand Up @@ -1509,7 +1508,7 @@ enum HealthCheckType {
* Render the rolling update configuration into the appropriate object
*/
function renderRollingUpdateConfig(config: RollingUpdateConfiguration = {}): CfnAutoScalingRollingUpdate {
const waitOnResourceSignals = config.minSuccessfulInstancesPercent !== undefined ? true : false;
const waitOnResourceSignals = config.minSuccessfulInstancesPercent !== undefined;
const pauseTime = config.pauseTime || (waitOnResourceSignals ? Duration.minutes(5) : Duration.seconds(0));

return {
Expand Down
9 changes: 4 additions & 5 deletions packages/@aws-cdk/aws-batch/lib/compute-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export class ComputeEnvironment extends Resource implements IComputeEnvironment
minvCpus: props.computeResources.minvCpus || 0,
placementGroup: props.computeResources.placementGroup,
securityGroupIds: this.buildSecurityGroupIds(props.computeResources.vpc, props.computeResources.securityGroups),
spotIamFleetRole: spotFleetRole ? spotFleetRole.roleArn : undefined,
spotIamFleetRole: spotFleetRole?.roleArn,
subnets: props.computeResources.vpc.selectSubnets(props.computeResources.vpcSubnets).subnetIds,
tags: props.computeResources.computeResourcesTags,
type: props.computeResources.type || ComputeResourceType.ON_DEMAND,
Expand All @@ -384,9 +384,8 @@ export class ComputeEnvironment extends Resource implements IComputeEnvironment
const computeEnvironment = new CfnComputeEnvironment(this, 'Resource', {
computeEnvironmentName: this.physicalName,
computeResources,
serviceRole: props.serviceRole
? props.serviceRole.roleArn
: new iam.Role(this, 'Resource-Service-Instance-Role', {
serviceRole: props.serviceRole?.roleArn
?? new iam.Role(this, 'Resource-Service-Instance-Role', {
managedPolicies: [
iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSBatchServiceRole'),
],
Expand All @@ -409,7 +408,7 @@ export class ComputeEnvironment extends Resource implements IComputeEnvironment
}

private isManaged(props: ComputeEnvironmentProps): boolean {
return props.managed === undefined ? true : props.managed;
return props.managed ?? true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudformation/lib/nested-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class NestedStack extends core.NestedStack {
super(scope, id, {
parameters: props.parameters,
timeout: props.timeout,
notificationArns: props.notifications ? props.notifications.map(n => n.topicArn) : undefined,
notificationArns: props.notifications?.map(n => n.topicArn),
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MyNestedStack extends cfn.NestedStack {
code: lambda.Code.inline('console.error("hi")'),
handler: 'index.handler',
environment: {
TOPIC_ARN: props.siblingTopic ? props.siblingTopic.topicArn : '',
TOPIC_ARN: props.siblingTopic?.topicArn ?? '',
QUEUE_URL: props.subscriber.queueUrl, // nested stack references a resource in the parent
},
});
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudfront/lib/web-distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,10 @@ export class CloudFrontWebDistribution extends cdk.Resource implements IDistribu
let distributionConfig: CfnDistribution.DistributionConfigProperty = {
comment: props.comment,
enabled: true,
defaultRootObject: props.defaultRootObject !== undefined ? props.defaultRootObject : 'index.html',
defaultRootObject: props.defaultRootObject ?? 'index.html',
httpVersion: props.httpVersion || HttpVersion.HTTP2,
priceClass: props.priceClass || PriceClass.PRICE_CLASS_100,
ipv6Enabled: (props.enableIpV6 !== undefined) ? props.enableIpV6 : true,
ipv6Enabled: props.enableIpV6 ?? true,
// eslint-disable-next-line max-len
customErrorResponses: props.errorConfigurations, // TODO: validation : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcachingminttl
webAclId: props.webACLId,
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cloudwatch/lib/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class AlarmWidget extends ConcreteWidget {
alarms: [this.props.alarm.alarmArn],
},
yAxis: {
left: this.props.leftYAxis !== undefined ? this.props.leftYAxis : undefined,
left: this.props.leftYAxis ?? undefined,
},
},
}];
Expand Down Expand Up @@ -271,8 +271,8 @@ export class GraphWidget extends ConcreteWidget {
metrics: metrics.length > 0 ? metrics : undefined,
annotations: horizontalAnnotations.length > 0 ? { horizontal: horizontalAnnotations } : undefined,
yAxis: {
left: this.props.leftYAxis !== undefined ? this.props.leftYAxis : undefined,
right: this.props.rightYAxis !== undefined ? this.props.rightYAxis : undefined,
left: this.props.leftYAxis ?? undefined,
right: this.props.rightYAxis ?? undefined,
},
legend: this.props.legendPosition !== undefined ? { position: this.props.legendPosition } : undefined,
liveData: this.props.liveData,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codebuild/lib/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,14 @@ abstract class ThirdPartyGitSource extends GitSource {
super(props);

this.webhook = props.webhook;
this.reportBuildStatus = props.reportBuildStatus === undefined ? true : props.reportBuildStatus;
this.reportBuildStatus = props.reportBuildStatus ?? true;
this.webhookFilters = props.webhookFilters || [];
this.webhookTriggersBatchBuild = props.webhookTriggersBatchBuild;
}

public bind(_scope: CoreConstruct, project: IProject): SourceConfig {
const anyFilterGroupsProvided = this.webhookFilters.length > 0;
const webhook = this.webhook === undefined ? (anyFilterGroupsProvided ? true : undefined) : this.webhook;
const webhook = this.webhook ?? (anyFilterGroupsProvided ? true : undefined);

if (!webhook && anyFilterGroupsProvided) {
throw new Error('`webhookFilters` cannot be used when `webhook` is `false`');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ export class CustomLambdaDeploymentConfig extends Resource implements ILambdaDep
// Generates the name of the deployment config. It's also what you'll see in the AWS console
// The name of the config is <construct unique id>.Lambda<deployment type><percentage>Percent<interval>Minutes
// Unless the user provides an explicit name
this.deploymentConfigName = props.deploymentConfigName !== undefined
? props.deploymentConfigName
: `${Names.uniqueId(this)}.Lambda${props.type}${props.percentage}Percent${props.type === CustomLambdaDeploymentConfigType.LINEAR
this.deploymentConfigName = props.deploymentConfigName
?? `${Names.uniqueId(this)}.Lambda${props.type}${props.percentage}Percent${props.type === CustomLambdaDeploymentConfigType.LINEAR
? 'Every'
: ''}${props.interval.toMinutes()}Minutes`;
this.deploymentConfigArn = arnForDeploymentConfig(this.deploymentConfigName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase {
});

this._autoScalingGroups = props.autoScalingGroups || [];
this.installAgent = props.installAgent === undefined ? true : props.installAgent;
this.installAgent = props.installAgent ?? true;
this.codeDeployBucket = s3.Bucket.fromBucketName(this, 'Bucket', `aws-codedeploy-${cdk.Stack.of(this).region}`);
for (const asg of this._autoScalingGroups) {
this.addCodeDeployAgentInstallUserData(asg);
Expand Down
Loading

0 comments on commit ad06392

Please sign in to comment.