Skip to content

Commit 157fa6e

Browse files
authored
Merge pull request #76 from sanjay-reddy-kandi/main
release/v2.7.4
2 parents 865cb75 + 1c378e6 commit 157fa6e

File tree

14 files changed

+524
-74
lines changed

14 files changed

+524
-74
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.7.4] - 2024-11
8+
### Fixed
9+
- Upgrade cross-spawn to mitigate [CVE-2024-21538](https://nvd.nist.gov/vuln/detail/CVE-2024-21538)
10+
- Migrated from pip to poetry
11+
712
## [2.7.3] - 2024-10
813
### Fixed
914
- Update base python image to mitigate [CVE-2024-45490](https://security-tracker.debian.org/tracker/CVE-2024-45490), [CVE-2024-45491](https://security-tracker.debian.org/tracker/CVE-2024-45491), [CVE-2024-45492](https://security-tracker.debian.org/tracker/CVE-2024-45492), [CVE-2023-7104](https://security-tracker.debian.org/tracker/CVE-2023-7104)

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,11 @@ npm run synth
210210
│   └── cost-optimizer-for-amazon-workspaces-spoke-stack.ts
211211
├── package.json
212212
├── package-lock.json
213-
├── testing_requirements.txt
213+
├── poetry.lock
214+
├── pyproject.toml
214215
├── tsconfig.json
215216
└── workspaces_app
216217
├── main.py
217-
├── requirements.txt
218-
├── setup_requirements.txt
219218
├── test_workspaces_app.py
220219
└── workspaces_app
221220
├── __init__.py

deployment/build-s3-dist.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ pack_lambda() {
3232
cp "$include_file" "$package_temp_dir"
3333
done
3434

35+
# Generate requirements.txt using Poetry
36+
pushd "$source_dir"
37+
"$POETRY_HOME"/bin/poetry export --without dev -f requirements.txt --output requirements.txt --without-hashes
38+
popd
39+
40+
# Install dependencies from the generated requirements.txt
3541
pip install -r "$source_dir"/requirements.txt -t "$package_temp_dir"
3642

3743
pushd "$package_temp_dir"
@@ -132,6 +138,8 @@ main() {
132138

133139
cp "$source_dir"/Dockerfile "$wco_folder"
134140
cp "$source_dir"/.dockerignore "$wco_folder"
141+
cp "$source_dir"/pyproject.toml "$wco_folder"
142+
cp "$source_dir"/poetry.lock "$wco_folder"
135143
cp -r "$source_dir"/workspaces_app "$wco_folder"
136144
cp -r "$source_dir"/docker "$wco_folder"
137145
}

deployment/run-unit-tests.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,13 @@ main() {
1010
root_dir=$(dirname "$(cd -P -- "$(dirname "$0")" && pwd -P)")
1111
local template_dir="$root_dir"/deployment
1212
local source_dir="$root_dir"/source
13-
local venv="$root_dir"/.venv
1413

15-
[[ ! -d "$venv" ]] && python3 -m venv "$venv"
16-
source "$venv"/bin/activate
17-
unset AWS_PROFILE
18-
python3 -m pip install --upgrade pip setuptools wheel
19-
20-
local requirements_files=(
21-
"$source_dir"/testing_requirements.txt
22-
)
23-
24-
for requirements_file in "${requirements_files[@]}"; do
25-
python3 -m pip install -r "$requirements_file"
26-
done
14+
echo "Installing python packages including development dependencies"
15+
cd "$source_dir"
16+
"$POETRY_HOME"/bin/poetry install --with dev
17+
18+
# Activate the virtual environment.
19+
source $("$POETRY_HOME"/bin/poetry env info --path)/bin/activate
2720

2821
local coverage_dir="$template_dir"/test/coverage-reports
2922
rm -rf "$coverage_dir"
@@ -53,6 +46,7 @@ main() {
5346
npm install
5447
npm run test
5548

49+
# Deactivate the virtual environment
5650
deactivate
5751
}
5852

source/Dockerfile

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
FROM public.ecr.aws/docker/library/python:3.12.7-slim-bookworm
2-
COPY workspaces_app /workspaces_app
32

4-
WORKDIR /workspaces_app
3+
# Set up a non-root user
54
RUN adduser -uid 1001 nonroot
5+
6+
# Set the working directory
7+
WORKDIR /workspaces_app
8+
9+
# Copy only the files needed to install dependencies
10+
COPY pyproject.toml poetry.lock ./
11+
12+
# Install poetry and dependencies
13+
RUN pip install poetry && \
14+
poetry config virtualenvs.create false && \
15+
poetry install --only main --no-root
16+
17+
# Copy the rest of the application code
18+
COPY workspaces_app ./workspaces_app
19+
20+
# Switch to non-root user
621
USER nonroot
722

8-
RUN pip install -r ./setup_requirements.txt
9-
RUN pip install -r ./requirements.txt
10-
CMD python3 ./main.py
23+
# Run the application
24+
CMD ["python", "./workspaces_app/main.py"]

source/lambda/requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

source/package-lock.json

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

source/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cost-optimizer-for-amazon-workspaces",
3-
"version": "2.7.3",
3+
"version": "2.7.4",
44
"description": "Cost Optimizer for Amazon Workspaces (SO0018)",
55
"license": "Apache-2.0",
66
"repository": {
@@ -18,10 +18,10 @@
1818
"test": "jest --coverage",
1919
"license-report": "license-report --output=csv --delimiter=' under ' --fields=name --fields=licenseType",
2020
"cdk": "cdk",
21-
"bootstrap": "SOLUTION_VERSION=v2.7.3 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces cdk bootstrap",
22-
"deploy": "SOLUTION_VERSION=v2.7.3 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces cdk deploy cost-optimizer-for-amazon-workspaces",
23-
"deploySpoke": "SOLUTION_VERSION=v2.7.3 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces cdk deploy cost-optimizer-for-amazon-workspaces-spoke",
24-
"synth": "SOLUTION_VERSION=v2.7.3 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces DIST_OUTPUT_BUCKET=solutions-reference cdk synth"
21+
"bootstrap": "SOLUTION_VERSION=v2.7.4 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces cdk bootstrap",
22+
"deploy": "SOLUTION_VERSION=v2.7.4 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces cdk deploy cost-optimizer-for-amazon-workspaces",
23+
"deploySpoke": "SOLUTION_VERSION=v2.7.4 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces cdk deploy cost-optimizer-for-amazon-workspaces-spoke",
24+
"synth": "SOLUTION_VERSION=v2.7.4 SOLUTION_NAME=cost-optimizer-for-amazon-workspaces SOLUTION_TRADEMARKEDNAME=cost-optimizer-for-amazon-workspaces DIST_OUTPUT_BUCKET=solutions-reference cdk synth"
2525
},
2626
"devDependencies": {
2727
"@aws-cdk/assert": "2.68.0",

0 commit comments

Comments
 (0)