Skip to content

Commit

Permalink
feat(aws-lambda): Add AWS Lambda runtime python3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Hogan Bobertz committed Apr 17, 2023
1 parent 70e2a33 commit 08fb3cd
Show file tree
Hide file tree
Showing 369 changed files with 13,733 additions and 5,113 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 14
env:
NODE_OPTIONS: "--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}"

- name: Locate Yarn cache
id: yarn-cache
Expand All @@ -39,7 +41,9 @@ jobs:
run: |-
npm -g install lerna npm-check-updates
- name: Build Integ Runner
run: lerna run build --scope @aws-cdk/integ-runner --include-dependencies
run: |
export NODE_OPTIONS="--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}"
npx lerna run build --scope @aws-cdk/integ-runner
- name: List Mono-Repo Packages
id: list-packages
# These need to be ignored from the `ncu` runs!
Expand All @@ -63,7 +67,7 @@ jobs:
(cd $(dirname $pj) && ncu --upgrade --reject='constructs,${{ steps.list-packages.outputs.list }}')
done
# Upgrade dependencies at an aws-eks integ test docker image
cd packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/ && ncu --upgrade --reject=',${{ steps.list-packages.outputs.list }}'
cd packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/ && ncu --upgrade --reject=',${{ steps.list-packages.outputs.list }}'
# This will ensure the current lockfile is up-to-date with the dependency specifications (necessary for "yarn upgrade" to run)
- name: Run "yarn install"
Expand Down
18 changes: 12 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ Most contributions only require working on a single package, usually `aws-cdk-li
time, you can execute the following to build it and it's dependencies.

```console
$ cd packages/aws-cdk-lib
$ ../../scripts/buildup
$ npx lerna run build --scope=aws-cdk-lib
```

Note: The `buildup` command is resumable. If your build fails, you can fix the issue and run `buildup --resume` to
resume.
Note: `lerna` uses a local cache by default. If your build fails, you can fix
the issue and run the command again and it will not rerun any previously
successful steps.

At this point, you can run build and test the `aws-cdk-lib` module by running

Expand All @@ -121,13 +121,19 @@ However, if you wish to build the entire repository, the following command will

```console
cd <root of the CDK repo>
scripts/foreach.sh yarn build
npx lerna run build
```
Note: The `foreach` command is resumable by default; you must supply `-r` or `--reset` to start a new session.

You are now ready to start contributing to the CDK. See the [Pull Requests](#pull-requests) section on how to make your
changes and submit it as a pull request.

If you want to run a build without using the local cache, provide the
`--skip-nx-cache` flag.

```console
$ npx lerna run build --skip-nx-cache
```

### Pack

As called out in the above sections, the AWS CDK uses jsii to produce polyglot targets. This means that each CDK module
Expand Down
32 changes: 25 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ runtarget="build"
run_tests="true"
check_prereqs="true"
check_compat="true"
ci="false"
scope=""
while [[ "${1:-}" != "" ]]; do
case $1 in
-h|--help)
Expand All @@ -27,6 +29,9 @@ while [[ "${1:-}" != "" ]]; do
--skip-compat)
check_compat="false"
;;
--ci)
ci=true
;;
*)
echo "Unrecognized parameter: $1"
exit 1
Expand All @@ -48,6 +53,18 @@ fi

echo "============================================================================================="
echo "installing..."
version=$(node -p "require('./package.json').version")
# this is super weird. If you run 'npm install' twice
# and it actually performs an install, then
# node-bundle test will fail with "npm ERR! maxAge must be a number".
# This won't happen in most instances because if nothing changes then npm install
# won't perform an install.
# In the pipeline however, npm install is run once when all the versions are '0.0.0' (via ./scripts/bump-candidate.sh)
# and then `align-versions` is run which updates all the versions to
# (for example) `2.74.0-rc.0` and then npm install is run again here.
if [ "$version" != "0.0.0" ]; then
rm -rf node_modules
fi
yarn install --frozen-lockfile --network-timeout 1000000

fail() {
Expand All @@ -72,21 +89,22 @@ node ./scripts/check-yarn-lock.js
BUILD_INDICATOR=".BUILD_COMPLETED"
rm -rf $BUILD_INDICATOR

# Speed up build by reusing calculated tree hashes
# On dev machine, this speeds up the TypeScript part of the build by ~30%.
export MERKLE_BUILD_CACHE=$(mktemp -d)
trap "rm -rf $MERKLE_BUILD_CACHE" EXIT

if [ "$run_tests" == "true" ]; then
runtarget="$runtarget+test"
runtarget="$runtarget,test"
fi

# Limit top-level concurrency to available CPUs - 1 to limit CPU load.
concurrency=$(node -p 'Math.max(1, require("os").cpus().length - 1)')

flags=""
if [ "$ci" == "true" ]; then
flags="--stream --no-progress --skip-nx-cache"
export FORCE_COLOR=false
fi

echo "============================================================================================="
echo "building..."
time npx lerna run $bail --stream --concurrency=$concurrency $runtarget || fail
time npx lerna run $bail --concurrency=$concurrency $runtarget $flags || fail

if [ "$check_compat" == "true" ]; then
/bin/bash scripts/check-api-compatibility.sh
Expand Down
2 changes: 1 addition & 1 deletion buildspec-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ phases:
- /bin/bash ./scripts/cache-load.sh
build:
commands:
- /bin/bash ./build.sh
- /bin/bash ./build.sh --ci
# After compilation, run Rosetta (using the cache if available).
# This will print errors, and fail the build if there are compilation errors in any packages marked as 'strict'.
- /bin/bash ./scripts/run-rosetta.sh
Expand Down
2 changes: 1 addition & 1 deletion buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ phases:
- codebuild-breakpoint
- 'if ${BUMP_CANDIDATE:-false}; then env NODE_OPTIONS="--max-old-space-size=8196 ${NODE_OPTIONS:-}" /bin/bash ./scripts/bump-candidate.sh; fi'
- /bin/bash ./scripts/align-version.sh
- /bin/bash ./build.sh
- /bin/bash ./build.sh --ci
post_build:
commands:
# Short-circuit: Don't run pack if the above build failed.
Expand Down
25 changes: 18 additions & 7 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
{
"lerna": "^4.0.0",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
"packages/*",
"packages/aws-cdk-lib",
"packages/cdk-cli-wrapper",
"packages/cdk-assets",
"packages/aws-cdk",
"packages/cdk",
"packages/@aws-cdk/*",
"packages/awslint",
"packages/@aws-cdk-containers/*",
"packages/@aws-cdk-testing/*",
"packages/@aws-cdk/*/lambda-packages/*",
"tools/*",
"tools/@aws-cdk/*",
"scripts/@aws-cdk/script-tests",
"packages/individual-packages/*"
"tools/@aws-cdk/cdk-build-tools",
"tools/@aws-cdk/cdk-release",
"tools/@aws-cdk/cfn2ts",
"tools/@aws-cdk/eslint-plugin",
"tools/@aws-cdk/node-bundle",
"tools/@aws-cdk/pkglint",
"tools/@aws-cdk/pkgtools",
"tools/@aws-cdk/prlint",
"tools/@aws-cdk/yarn-cling",
"scripts/@aws-cdk/script-tests"
],
"rejectCycles": "true",
"version": "0.0.0"
"version": "0.0.0",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
60 changes: 60 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"extends": "@nrwl/workspace/presets/npm.json",
"workspaceLayout": { },
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"test",
"lint",
"package",
"prepare"
]
}
}
},
"targetDefaults": {
"build": {
"implicitDependencies": ["aws-cdk-lib"],
"dependsOn": ["^build"],
"inputs": [
"{projectRoot}/lib/!(*.d|*.generated).ts",
"{projectRoot}/test/!(*.d).ts",
"!{workspaceRoot}/**/tsconfig.json",
"!{workspaceRoot}/**/tsconfig.json",
"!{workspaceRoot}/tsconfig.base.json",
"!{workspaceRoot}/**/tsconfig.tsbuildinfo"
],
"outputs": [
"!{projectRoot}/**/*.integ.snapshot/*",
"{projectRoot}/tsconfig.json",
"{projectRoot}/lib/aws-custom-resource/sdk-api-metadata.json",
"{projectRoot}/build-info.json",
"{projectRoot}/lib/**/*.js",
"{projectRoot}/lib/layer.zip",
"{projectRoot}/bin/**/*.js",
"{projectRoot}/lib/**/*.js.map",
"{projectRoot}/lib/**/*.generated.ts",
"{projectRoot}/lib/**/*.d.ts",
"{projectRoot}/test/**/*.d.ts",
"{projectRoot}/test/**/*.js",
"{projectRoot}/.jsii",
"{projectRoot}/spec/*.json",
"{projectRoot}/.warnings.jsii.js"
]
},
"test": {
"dependsOn": ["build"]
},
},
"affected": {
"defaultBase": "main"
},
"pluginsConfig": {
"@nrwl/js": {
"analyzeSourceFiles": false
}
}
}
29 changes: 21 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"pack": "./pack.sh",
"compat": "./scripts/check-api-compatibility.sh",
"bump": "./bump.sh",
"build-all": "tsc -b",
"postinstall": "patch-package --error-on-fail"
"build-all": "tsc -b"
},
"devDependencies": {
"@types/node": "18.11.19",
Expand All @@ -28,10 +27,13 @@
"jsii-pacmak": "1.78.1",
"jsii-reflect": "1.78.1",
"jsii-rosetta": "~5.0.0",
"lerna": "^4.0.0",
"lerna": "^6.6.1",
"patch-package": "^6.5.1",
"semver": "^6.3.0",
"standard-version": "^9.5.0",
"@nrwl/cli": "^15.9.1",
"@nrwl/workspace": "^15.9.1",
"nx": "^15.9.1",
"typescript": "~4.9.5"
},
"resolutions": {
Expand Down Expand Up @@ -66,15 +68,26 @@
},
"workspaces": {
"packages": [
"packages/*",
"packages/aws-cdk-lib",
"packages/cdk-cli-wrapper",
"packages/aws-cdk",
"packages/cdk",
"packages/cdk-assets",
"packages/@aws-cdk/*",
"packages/awslint",
"packages/@aws-cdk-containers/*",
"packages/@aws-cdk-testing/*",
"packages/@aws-cdk/*/lambda-packages/*",
"tools/*",
"tools/@aws-cdk/*",
"scripts/@aws-cdk/script-tests",
"packages/individual-packages/*"
"tools/@aws-cdk/cdk-build-tools",
"tools/@aws-cdk/cdk-release",
"tools/@aws-cdk/cfn2ts",
"tools/@aws-cdk/eslint-plugin",
"tools/@aws-cdk/node-bundle",
"tools/@aws-cdk/pkglint",
"tools/@aws-cdk/pkgtools",
"tools/@aws-cdk/prlint",
"tools/@aws-cdk/yarn-cling",
"scripts/@aws-cdk/script-tests"
],
"nohoist": [
"**/jszip",
Expand Down
8 changes: 1 addition & 7 deletions packages/@aws-cdk-testing/cli-integ/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@

---

![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> 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.
![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)

---

Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk-testing/cli-integ/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"axios": "^0.27.2",
"fs-extra": "^9.1.0",
"glob": "^7.2.3",
"jest": "^27.5.1",
"jest": "^29.5.0",
"jest-junit": "^14.0.1",
"make-runnable": "^1.4.1",
"npm": "^8.19.4",
Expand All @@ -66,8 +66,8 @@
"engines": {
"node": ">= 14.15.0"
},
"stability": "experimental",
"maturity": "experimental",
"stability": "stable",
"maturity": "stable",
"publishConfig": {
"tag": "latest"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "31.0.0",
"files": {
"0765ff416c5e4523ba0bbdb8e53aff6c7d624c5023c3a04e16b3da31551a31c7": {
"source": {
"path": "Standard1.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "0765ff416c5e4523ba0bbdb8e53aff6c7d624c5023c3a04e16b3da31551a31c7.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Loading

0 comments on commit 08fb3cd

Please sign in to comment.