Skip to content

Commit

Permalink
Merge branch 'aws:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
AviorSchreiber authored Feb 14, 2023
2 parents b33237c + 144f572 commit 2918a6e
Show file tree
Hide file tree
Showing 69 changed files with 1,624 additions and 566 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/yarn-upgrade-v1main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Locate Yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Restore Yarn cache
uses: actions/cache@v3
Expand All @@ -39,34 +39,30 @@ jobs:
run: yarn install --frozen-lockfile
- name: Install Tools
run: |-
npm -g install lerna npm-check-updates@^9.0.0
npm -g install lerna js-yaml npm-check-updates@^9.0.0
- name: Build CLI
run: cd packages/aws-cdk && ../../scripts/buildup
run: lerna run build --scope aws-cdk --include-dependencies --stream
- name: Build Integ Runner
run: cd packages/@aws-cdk/integ-runner && ../../../scripts/buildup
run: lerna run build --scope @aws-cdk/integ-runner --include-dependencies --stream
- name: List Mono-Repo Packages
id: list-packages
# These need to be ignored from the `ncu` runs!
run: |-
echo -n "::set-output name=list::"
node -p "$(lerna ls --all --json 2>/dev/null).map(item => item.name).join(',')"
echo "list=$(lerna ls --all --json 2>/dev/null | jq -r 'map(.name) | join(",")')" >> $GITHUB_OUTPUT
- name: Run "ncu -u"
# We special-case @types/node because we want to stay on the current major (minimum supported node release)
# We special-case @types/fs-extra because the current major (9.x) is broken with @types/node >= 10
# We special-case some @types because they need to be pinned to specific versions due to breaking changes in minor upgrades https://github.com/DefinitelyTyped/DefinitelyTyped/issues/64266
# We special-case aws-sdk because of breaking changes with TS interface exports in recent minor versions - https://github.com/aws/aws-sdk-js/issues/3453
# We special-case typescript because it's not semantically versionned
# We special-case typescript because it's not semantically versioned
# We special-case constructs because we want to stay in control of the minimum compatible version
# We special-case lerna because we have a patch on it that stops applying if Lerna upgrades. Remove this once https://github.com/lerna/lerna/pull/2874 releases.
# We special-case aws-sdk-mock because of breaking changes in type exports https://github.com/dwyl/aws-sdk-mock/pull/260. We are not respecting `@ts-ignore`
run: |-
# Upgrade dependencies at repository root
ncu --upgrade --filter=@types/node,@types/fs-extra --target=minor
ncu --upgrade --filter=typescript --target=patch
ncu --upgrade --reject=@types/node,@types/prettier,@types/fs-extra,constructs,typescript,lerna --target=minor
ncu --upgrade --reject=@types/node,@types/prettier,constructs,typescript,lerna --target=minor
# Upgrade all the packages
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/prettier,@types/fs-extra,constructs,typescript,aws-sdk,aws-sdk-mock,${{ steps.list-packages.outputs.list }}' --target=minor
lerna exec --parallel ncu -- --upgrade --reject='@types/node,@types/prettier,constructs,typescript,aws-sdk,aws-sdk-mock,${{ steps.list-packages.outputs.list }}' --target=minor
# This will ensure the current lockfile is up-to-date with the dependency specifications (necessary for "yarn update" to run)
- name: Run "yarn install"
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,28 @@ jobs:
run: yarn install --frozen-lockfile
- name: Install Tools
run: |-
npm -g install lerna npm-check-updates@^9.0.0
npm -g install lerna js-yaml npm-check-updates@^9.0.0
- name: Build Integ Runner
run: cd packages/@aws-cdk/integ-runner && ../../../scripts/buildup
run: lerna run build --scope @aws-cdk/integ-runner --include-dependencies
- name: List Mono-Repo Packages
id: list-packages
# These need to be ignored from the `ncu` runs!
run: |-
echo -n "::set-output name=list::"
echo "list=$(lerna ls --all --json 2>/dev/null | jq -r 'map(.name) | join(",")')" >> $GITHUB_OUTPUT
echo "list=$(lerna ls --all --json 2>/dev/null | jq -r 'map(.name) | join(",")')" >> $GITHUB_OUTPUT
- name: Run "ncu -u"
# We special-case @types/node because we want to stay on the current major (minimum supported node release)
# We special-case @types/fs-extra because the current major (9.x) is broken with @types/node >= 10
# We special-case some @types because they need to be pinned to specific versions due to breaking changes in minor upgrades https://github.com/DefinitelyTyped/DefinitelyTyped/issues/64266
# We special-case aws-sdk because of breaking changes with TS interface exports in recent minor versions - https://github.com/aws/aws-sdk-js/issues/3453
# We special-case typescript because it's not semantically versionned
# We special-case typescript because it's not semantically versioned
# We special-case constructs because we want to stay in control of the minimum compatible version
# We special-case lerna because we have a patch on it that stops applying if Lerna upgrades. Remove this once https://github.com/lerna/lerna/pull/2874 releases.
# We special-case aws-sdk-mock because of breaking changes in type exports https://github.com/dwyl/aws-sdk-mock/pull/260. We are not respecting `@ts-ignore`
run: |-
# Upgrade dependencies at repository root
ncu --upgrade --filter=@types/node,@types/fs-extra --target=minor
ncu --upgrade --filter=typescript --target=patch
ncu --upgrade --reject=@types/node,@types/prettier,@types/fs-extra,constructs,typescript,lerna --target=minor
ncu --upgrade --reject=@types/node,@types/prettier,constructs,typescript,lerna --target=minor
# Upgrade all the packages
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/prettier,@types/fs-extra,constructs,typescript,aws-sdk,aws-sdk-mock,${{ steps.list-packages.outputs.list }}' --target=minor
lerna exec --parallel ncu -- --upgrade --reject='@types/node,@types/prettier,constructs,typescript,aws-sdk,aws-sdk-mock,${{ steps.list-packages.outputs.list }}' --target=minor
# Upgrade package.jsons in init templates
for pj in $(find packages/aws-cdk/lib/init-templates -name package.json); do
(cd $(dirname $pj) && ncu --upgrade --reject='constructs,${{ steps.list-packages.outputs.list }}')
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
"postinstall": "patch-package --error-on-fail"
},
"devDependencies": {
"@types/node": "18.11.18",
"@types/prettier": "2.6.0",
"@yarnpkg/lockfile": "^1.1.0",
"cdk-generate-synthetic-examples": "^0.1.140",
"cdk-generate-synthetic-examples": "^0.1.151",
"conventional-changelog-cli": "^2.2.2",
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const MINIMUM_VERSION = '3.9';
* Use NPM preinstalled on the machine to look up a list of TypeScript versions
*/
export function typescriptVersionsSync(): string[] {
const { stdout } = spawnSync('npm', ['--silent', 'view', `typescript@>=${MINIMUM_VERSION}`, 'version', '--json']);
const { stdout } = spawnSync('npm', ['--silent', 'view', `typescript@>=${MINIMUM_VERSION}`, 'version', '--json'], { encoding: 'utf-8' });

const versions: string[] = JSON.parse(stdout);
return Array.from(new Set(versions.map(v => v.split('.').slice(0, 2).join('.'))));
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk-testing/cli-integ/lib/staging/npm.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable no-console */
import * as path from 'path';
import { updateIniKey, loadLines, writeLines } from '../files';
import { shell } from '../shell';
import { LoginInformation } from './codeartifact';
import { parallelShell } from './parallel-shell';
import { UsageDir } from './usage-dir';
import { updateIniKey, loadLines, writeLines } from '../files';
import { shell } from '../shell';

export async function npmLogin(login: LoginInformation, usageDir: UsageDir) {
// Creating an ~/.npmrc that references an envvar is what you're supposed to do. (https://docs.npmjs.com/private-modules/ci-server-config)
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk-testing/cli-integ/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^14.18.36",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@types/semver": "^7.3.13",
"@types/yargs": "^15.0.15",
Expand All @@ -41,7 +40,7 @@
"dependencies": {
"@octokit/rest": "^18.12.0",
"jest": "^27.5.1",
"aws-sdk": "^2.1211.0",
"aws-sdk": "^2.1313.0",
"axios": "^0.27.2",
"jest-junit": "^14.0.1",
"semver": "^7.3.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"aws-cdk-lib": "0.0.0",
"aws-cdk-migration": "0.0.0",
"constructs": "^10.0.0",
"jest": "^27.3.1",
"jest": "^27.5.1",
"ts-jest": "^27.1.5"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-amplifyuibuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^26.0.24"
"@types/jest": "^27.5.2",
"@types/node": "18.11.18"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-eks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/lambda-layer-kubectl-v24": "^2.0.85",
"@aws-cdk/lambda-layer-kubectl-v24": "^2.0.96",
"aws-cdk-lib": "2.47.0",
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
Expand All @@ -93,8 +93,8 @@
"@types/sinon": "^9.0.11",
"@types/yaml": "1.9.6",
"aws-sdk": "^2.1211.0",
"cdk8s": "^2.6.36",
"cdk8s-plus-24": "2.4.8",
"cdk8s": "^2.6.47",
"cdk8s-plus-24": "2.4.19",
"jest": "^27.5.1",
"sinon": "^9.2.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "eks-service-account-sdk-call-integ-test",
"private": "true",
"dependencies": {
"aws-sdk": "^2.1226.0"
"aws-sdk": "^2.1313.0"
}
}
38 changes: 37 additions & 1 deletion packages/@aws-cdk/aws-elasticloadbalancingv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,47 @@ const listener = elbv2.NetworkListener.fromLookup(this, 'ALBListener', {

## Metrics

You may create metrics for each Load Balancer through the `metrics` attribute:
You may create metrics for Load Balancers and Target Groups through the `metrics` attribute:

**Load Balancer:**

```ts
declare const alb: elbv2.IApplicationLoadBalancer;

const albMetrics: elbv2.IApplicationLoadBalancerMetrics = alb.metrics;
const metricConnectionCount: cloudwatch.Metric = albMetrics.activeConnectionCount();
```

**Target Group:**

```ts
declare const targetGroup: elbv2.IApplicationTargetGroup;

const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics;
const metricHealthyHostCount: cloudwatch.Metric = targetGroupMetrics.healthyHostCount();
```

Metrics are also available to imported resources:

```ts
declare const stack: Stack;

const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'MyTargetGroup', {
targetGroupArn: Fn.importValue('TargetGroupArn'),
loadBalancerArns: Fn.importValue('LoadBalancerArn'),
});

const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics;
```

Notice that TargetGroups must be imported by supplying the Load Balancer too, otherwise accessing the `metrics` will
throw an error:

```ts
declare const stack: Stack;
const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'MyTargetGroup', {
targetGroupArn: Fn.importValue('TargetGroupArn'),
});

const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics; // throws an Error()
```
Loading

0 comments on commit 2918a6e

Please sign in to comment.