Skip to content

Commit f6611ff

Browse files
committed
release/v3.1.0
1 parent ed618e0 commit f6611ff

File tree

322 files changed

+23697
-19165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+23697
-19165
lines changed

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copy this file and rename to ".env" to save your local configuration outside of version control.
2+
# You should then be able to use the npm scripts that require these values.
3+
4+
# Valid values: Disabled or Enabled
5+
# the default is Enabled, but anyone using cdk deploy probably wants this disabled by default
6+
RETAIN_DATA_AND_LOGS=Disabled
7+
8+
# template default is No
9+
ENABLE_DEBUG_LOGGING=Yes
10+
11+
# spoke template
12+
HUB_ACCOUNT=123456789012
File renamed without changes.

.gitignore

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.isort.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[settings]
2+
# this is the black profile as shown here https://pycqa.github.io/isort/docs/configuration/profiles.html
3+
# I coudn't get pre-commit and tox to behave the same with only passing --profile. Now they both use this config
4+
multi_line_output=3
5+
include_trailing_comma=True
6+
force_grid_wrap=0
7+
use_parentheses=True
8+
ensure_newline_before_comments=True
9+
line_length=88
10+
split_on_trailing_comma=True
11+
lines_between_sections=1

.pre-commit-config.yaml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
exclude: |
5+
(?x)^(
6+
^.*\.svg$
7+
# projen-generated files
8+
# `git ls-files | git check-attr linguist-generated --stdin | grep "linguist-generated: set"`
9+
| .*tsconfig\.json$
10+
| .*jest\.config\.json$
11+
| .*\.gitattributes$
12+
| .*\.gitignore$
13+
| ^LICENSE$
14+
| .*cdk\.json$
15+
| .*package-lock\.json$
16+
| .*package\.json$
17+
| ^solution-manifest\.yaml$
18+
| .*pyproject.toml$
19+
| .*__snapshots__.*$
20+
| .*\.projen/.*$
21+
)$
22+
repos:
23+
- repo: https://github.com/pre-commit/pre-commit-hooks
24+
rev: v4.6.0
25+
hooks:
26+
- id: check-executables-have-shebangs
27+
name: Check executables have shebangs
28+
- id: fix-byte-order-marker
29+
name: Fix byte order marker
30+
- id: check-case-conflict
31+
name: Check case conflict
32+
- id: check-json
33+
name: Check json
34+
- id: check-yaml
35+
name: Check yaml
36+
args: [--allow-multiple-documents, --unsafe]
37+
- id: check-toml
38+
name: Check toml
39+
- id: check-merge-conflict
40+
name: Check for merge conflicts
41+
- id: check-added-large-files
42+
name: Check for added large files
43+
exclude: |
44+
(?x)^(
45+
^.*/package-lock.json |
46+
)$
47+
- id: end-of-file-fixer
48+
name: Fix end of the files
49+
- id: trailing-whitespace
50+
name: Trim trailing whitespace
51+
- id: mixed-line-ending
52+
name: Mixed line ending
53+
- id: detect-private-key
54+
name: Detect private keys
55+
- id: detect-aws-credentials
56+
name: Detect AWS Credentials
57+
- repo: https://github.com/Lucas-C/pre-commit-hooks
58+
rev: v1.5.5
59+
hooks:
60+
- id: insert-license
61+
name: Insert license header (typescript and javascript)
62+
files: \.tsx$|\.ts$|\.js$|\.jsx$
63+
args:
64+
- --license-filepath
65+
- ./license_header.txt
66+
- --comment-style
67+
- // # defaults to Python's # syntax, requires changing for typescript syntax.
68+
- --detect-license-in-X-top-lines=3
69+
- id: insert-license
70+
name: Insert license header (python)
71+
files: \.py$
72+
args:
73+
- --license-filepath
74+
- ./license_header.txt
75+
- --comment-style
76+
- "#"
77+
- --detect-license-in-X-top-lines=3
78+
- repo: https://github.com/psf/black-pre-commit-mirror
79+
rev: 24.3.0
80+
hooks:
81+
- id: black
82+
- repo: https://github.com/pycqa/isort
83+
rev: 5.12.0
84+
hooks:
85+
- id: isort
86+
args: ["--profile", "black"]
87+
# tox and pre-commit behave differently when the profile flag is passed,
88+
# so .isort.cfg in the root folder overrides the profile
89+
# keeping the profile flag as a reminder to try to make it work with profile only
90+
- repo: https://github.com/pycqa/flake8
91+
rev: 6.1.0
92+
hooks:
93+
- id: flake8
94+
args: ["--extend-ignore=E501,E203"] # line length and whitespace, handled by black
95+
- repo: https://github.com/koalaman/shellcheck-precommit
96+
rev: v0.10.0
97+
hooks:
98+
- id: shellcheck
99+
name: ShellChecker
100+
args: ["-x", "--severity=warning"]
101+
types: [shell]
102+
exclude: ^.nightswatch/.*$
103+
# Local
104+
- repo: local
105+
hooks:
106+
- id: detect-empty-files
107+
name: Detect Empty Files
108+
entry: scripts/detect-empty-files.sh
109+
language: system
110+
exclude: ^.*__init__\.py$ # __init__.py empty on purpose

.projen/deps.json

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/tasks.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import { PythonProject } from "projen/lib/python";
1717

1818
function main() {
19-
new InstanceScheduler({ version: "3.0.12", cdkVersion: "2.206.0" }).synth();
19+
new InstanceScheduler({ version: "3.1.0", cdkVersion: "2.232.2" }).synth();
2020
}
2121

2222
interface InstanceSchedulerProps {
@@ -70,7 +70,6 @@ class InstanceScheduler extends AwsCdkTypeScriptApp {
7070
];
7171

7272
private static readonly devDeps: string[] = [
73-
"@cdklabs/cdk-ssm-documents",
7473
"@types/uuid",
7574
"@typescript-eslint/eslint-plugin",
7675
"eslint",
@@ -102,6 +101,7 @@ class InstanceScheduler extends AwsCdkTypeScriptApp {
102101
"internal/scripts/cfn-guard",
103102
"build",
104103
"git-info",
104+
".env",
105105
this.testReportDir,
106106
this.coverageReportDir,
107107
];
@@ -174,6 +174,12 @@ class InstanceScheduler extends AwsCdkTypeScriptApp {
174174

175175
this.addScripts({
176176
"update-deps": "chmod +x ./update-all-dependencies.sh && exec ./update-all-dependencies.sh",
177+
"deploy:hub":
178+
"source .env && npx cdk deploy instance-scheduler-on-aws --require-approval=never --parameters RetainDataAndLogs=$RETAIN_DATA_AND_LOGS --parameters Trace=$ENABLE_DEBUG_LOGGING",
179+
"destroy:hub": "source .env && npx cdk destroy instance-scheduler-on-aws -f",
180+
"deploy:spoke":
181+
"source .env && npx cdk deploy instance-scheduler-on-aws-remote --require-approval=never --parameters InstanceSchedulerAccount=$HUB_ACCOUNT",
182+
"destroy:spoke": "source .env && npx cdk destroy instance-scheduler-on-aws-remote -f",
177183
});
178184

179185
new YamlFile(this, "solution-manifest.yaml", {
@@ -199,7 +205,7 @@ class InstanceScheduler extends AwsCdkTypeScriptApp {
199205
"pytest@^7.4.3",
200206
"pytest-cov@^4.1.0",
201207
"tox@^4.11.4",
202-
"urllib3@2.6.0"
208+
"urllib3@^2"
203209
];
204210

205211
const commonPythonProjectOptions: CommonPythonProjectOptions = {
@@ -334,7 +340,7 @@ class InstanceScheduler extends AwsCdkTypeScriptApp {
334340
},
335341
});
336342

337-
this.addTask("e2e-tests", { exec: `jest --config ${e2eConfigFile}`, receiveArgs: true });
343+
this.addTask("e2e-tests", { exec: `node --experimental-vm-modules node_modules/.bin/jest --config ${e2eConfigFile}`, receiveArgs: true });
338344
}
339345

340346
private addTypescriptFiles(...files: string[]): void {
@@ -379,7 +385,7 @@ class InstanceSchedulerLambdaFunction extends PythonProject {
379385
outdir: "./source/app",
380386
poetry: true,
381387
description: "Instance Scheduler on AWS",
382-
deps: ["python@^3.11"],
388+
deps: ["python@^3.12"],
383389
pytest: false,
384390
...options,
385391
});
@@ -391,24 +397,27 @@ class InstanceSchedulerLambdaFunction extends PythonProject {
391397
"ec2",
392398
"ecs",
393399
"lambda",
400+
"events",
394401
"logs",
395402
"rds",
396403
"resourcegroupstaggingapi",
397404
"sns",
398405
"ssm",
399406
"sts",
407+
"sqs",
408+
"events",
400409
];
401410

402-
const motoExtras = ["autoscaling", "dynamodb", "ec2", "logs", "rds", "resourcegroupstaggingapi", "ssm"];
411+
const motoExtras = ["autoscaling", "dynamodb", "ec2", "logs", "rds", "resourcegroupstaggingapi", "ssm", "events"];
403412

404-
const boto3Version = "^1.34.1";
413+
const boto3Version = "^1.40.4";
405414
const jmespathVersion = "1.0.1";
406415
const pythonDateutilVersion = "2.8.2";
407416
[
408417
`boto3@${boto3Version}`,
409418
`boto3-stubs-lite@{version = "${boto3Version}", extras = ${JSON.stringify(boto3StubsExtras)}}`,
410419
`botocore@${boto3Version}`,
411-
"botocore-stubs@^1.31.66",
420+
`botocore-stubs@${boto3Version}`,
412421
"freezegun@^1.3.1",
413422
`jmespath@${jmespathVersion}`,
414423
"pytest-mock@^3.12.0",
@@ -419,12 +428,11 @@ class InstanceSchedulerLambdaFunction extends PythonProject {
419428
"types-freezegun@^1.1.10",
420429
`types-jmespath@${jmespathVersion}`,
421430
`types-python-dateutil@${pythonDateutilVersion}`,
422-
"types-requests@2.31.0.6", // held back, need to support urllib3@^1
431+
"types-requests@^2",
423432
"tzdata@^2023.3",
424-
`urllib3@^2.6.0`,
425433
].forEach((spec: string) => this.addDevDependency(spec));
426434

427-
["aws-lambda-powertools@^3.4.1", "packaging@^24.0"].forEach((spec: string) => this.addDependency(spec));
435+
["aws-lambda-powertools@^3.4.1", "packaging@^24.0", "pydantic", "urllib3@^2",].forEach((spec: string) => this.addDependency(spec));
428436

429437
const pyproject = this.tryFindObjectFile("pyproject.toml");
430438
if (!pyproject) {
@@ -437,7 +445,7 @@ class InstanceSchedulerLambdaFunction extends PythonProject {
437445
throw new Error("Could not override install task");
438446
}
439447
installTask.reset();
440-
installTask.exec("poetry lock --no-update && poetry install");
448+
installTask.exec("poetry lock && poetry install");
441449
}
442450
}
443451

@@ -482,7 +490,7 @@ class InstanceSchedulerCli extends PythonProject {
482490
throw new Error("Could not override install task");
483491
}
484492
installTask.reset();
485-
installTask.exec("poetry lock --no-update && poetry install");
493+
installTask.exec("poetry lock && poetry install");
486494
}
487495
}
488496

0 commit comments

Comments
 (0)