Skip to content

Commit

Permalink
Merge pull request #350 from aws-solutions/hotfix/1.4.2
Browse files Browse the repository at this point in the history
Merge Hotfix/1.4.2 to main
  • Loading branch information
gockle authored Jan 12, 2023
2 parents b8c5ed8 + cb78eca commit 0c95f89
Show file tree
Hide file tree
Showing 19 changed files with 9,472 additions and 992 deletions.
26 changes: 26 additions & 0 deletions .viperlightignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Ignore Config used with code.amazon.com
Config

^docs/
^viperlight/
source/lambda/schedulers/instance_scheduler.py:133
source/lambda/schedulers/instance_scheduler.py:134
source/lambda/requesthandlers/setup_demo_data.py:64
deployment/buildspecs/mainline-s3-spec.yml:20
source/lambda/models/rds/2014-10-31/service-2.json:152
source/lambda/models/ssm/2014-11-06/service-2.json:3240
source/lambda/tests/cloudformation_util.py:26
source/lambda/tests/cloudformation_util.py:27
source/lambda/tests/rds_util.py:27
source/lambda/tests/rds_util.py:28
source/lambda/tests/ec2_util.py:27
source/lambda/tests/ec2_util.py:28
CODE_OF_CONDUCT.md:4
CONTRIBUTING.md:51
source/package-lock.json:6526
source/package-lock.json:3672
source/package-lock.json:3510
source/package-lock.json:3667
source/test/aws-instance-scheduler-stack.test.ts:25
source/test/aws-instance-scheduler-remote-stack.test.ts:24
source/lambda/models/rds/2014-10-31/service-2.json:4873
4 changes: 4 additions & 0 deletions .viperlightrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"all": true,
"failOn": "medium"
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.2] - 2023-01-11
### Fixed
- Upgrade certifi to mitigate [CVE-2022-23491](https://nvd.nist.gov/vuln/detail/CVE-2022-23491).
- Updated issues in bandit scan.
- Updated the CDK version 2.x

## [1.4.1] - 2022-05-12
### Fixed
- Replaced the DescribeLogStreams API call used for getting the next sequence token with PutLogEvents API call to reduce the lambda execution time [#307](https://github.com/awslabs/aws-instance-scheduler/issues/307)
Expand Down
38 changes: 38 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 0.2

phases:
install:
runtime-versions:
python: 3.10
commands:
- pip install --upgrade pip
pre_build:
commands:
- echo "Installing dependencies and executing unit tests - `pwd`"
- cd source
- chmod +x ./run-all-tests.sh && ./run-all-tests.sh
- echo "Installing dependencies and executing unit tests completed `date`"
build:
commands:
- echo "`pwd`"
- echo "cd ../deployment"
- cd ../deployment
- echo "Starting build `date` in `pwd`"
- chmod +x ./build-s3-dist.sh && ./build-s3-dist.sh $DIST_OUTPUT_BUCKET $SOLUTION_NAME $VERSION
- echo "Build completed `date`"
- echo "Starting open-source-dist `date` in `pwd`"
- chmod +x ./build-open-source-dist.sh && ./build-open-source-dist.sh $SOLUTION_NAME
- echo "Open Source Dist completed `date`"

post_build:
commands:
- echo "Retrieving next stage buildspec `date` in `pwd`"
- aws s3 cp s3://solutions-build-assets/changelog-spec.yml ../buildspec.yml
- echo "Retrieving next stage buildspec complete"
- echo "Post build completed on `date`"

artifacts:
files:
- deployment/**/*
- buildspec.yml
- CHANGELOG.md
2 changes: 1 addition & 1 deletion deployment/build-s3-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#

# Important: CDK global version number
cdk_version=1.96.0
cdk_version=2.59.0

# Check to see if the required parameters have been provided:
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
Expand Down
8 changes: 7 additions & 1 deletion source/bin/aws-instance-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* permissions and limitations under the License. *
*****************************************************************************/

import * as cdk from '@aws-cdk/core';
import * as cdk from 'aws-cdk-lib';
import { AwsInstanceSchedulerStack } from '../lib/aws-instance-scheduler-stack';
import { AwsInstanceSchedulerRemoteStack } from '../lib/aws-instance-scheduler-remote-stack';

Expand All @@ -28,6 +28,9 @@ const SOLUTION_PROVIDER = 'AWS Solution Development';
const app = new cdk.App();

new AwsInstanceSchedulerStack(app, 'aws-instance-scheduler', {
synthesizer: new cdk.DefaultStackSynthesizer({
generateBootstrapVersionRule: false
}),
description: `(${SOLUTION_ID}) - The AWS CloudFormation template for deployment of the ${SOLUTION_NAME}, version: ${SOLUTION_VERSION}`,
solutionId: SOLUTION_ID,
solutionTradeMarkName: SOLUTION_TMN,
Expand All @@ -37,6 +40,9 @@ new AwsInstanceSchedulerStack(app, 'aws-instance-scheduler', {
solutionVersion: SOLUTION_VERSION
});
new AwsInstanceSchedulerRemoteStack(app, 'aws-instance-scheduler-remote', {
synthesizer: new cdk.DefaultStackSynthesizer({
generateBootstrapVersionRule: false
}),
description: `(${SOLUTION_ID}S) - The AWS CloudFormation template for ${SOLUTION_NAME} cross account role, version: ${SOLUTION_VERSION}`,
solutionId: SOLUTION_ID,
solutionTradeMarkName: SOLUTION_TMN,
Expand Down
6 changes: 3 additions & 3 deletions source/cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
description="AWS Instance Scheduler CLI",
install_requires=[
"argparse",
"requests>=2.18.4",
"jmespath>=0.9.3",
"boto3>=1.4.7"]
"requests>=2.28.1",
"jmespath>=1.0.1",
"boto3>=1.26.48"]
)

14 changes: 7 additions & 7 deletions source/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
"roots": [
"<rootDir>/test"
],
testMatch: [ '**/*.test.ts'],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"roots": [
"<rootDir>/test"
],
testMatch: [ '**/*.test.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest'
}
}
8 changes: 0 additions & 8 deletions source/lambda/bin/chardetect

This file was deleted.

3 changes: 2 additions & 1 deletion source/lambda/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytz
requests
requests
chardet
2 changes: 1 addition & 1 deletion source/lambda/testing_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
botocore>=1.12.99
boto3>=1.9.99
mock>=2.0.0
pytest>=4.4.1
pytest>=7.2.0
pytest-mock>=1.10.4
pytest-runner>=2.11.1
uuid>=1.30
Expand Down
9 changes: 5 additions & 4 deletions source/lib/aws-instance-scheduler-remote-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* permissions and limitations under the License. *
*****************************************************************************/

import * as cdk from '@aws-cdk/core';
import * as iam from '@aws-cdk/aws-iam';
import { ArnPrincipal, CompositePrincipal, Effect, PolicyStatement } from "@aws-cdk/aws-iam";
import * as cdk from 'aws-cdk-lib';
import * as iam from 'aws-cdk-lib/aws-iam';
import { ArnPrincipal, CompositePrincipal, Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
import { Construct } from "constructs";

export interface AwsInstanceSchedulerRemoteStackProps extends cdk.StackProps {
readonly description: string,
Expand All @@ -30,7 +31,7 @@ export interface AwsInstanceSchedulerRemoteStackProps extends cdk.StackProps {

export class AwsInstanceSchedulerRemoteStack extends cdk.Stack {

constructor(scope: cdk.Construct, id: string, props: AwsInstanceSchedulerRemoteStackProps) {
constructor(scope: Construct, id: string, props: AwsInstanceSchedulerRemoteStackProps) {
super(scope, id, props);

//CFN Parameters
Expand Down
Loading

0 comments on commit 0c95f89

Please sign in to comment.