Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ CHANGELOG
- Upgrade Flask to ~=3.1.0 (from >=2.2.5,<2.3).
- Upgrade Werkzeug to ~=3.1 (from ~=2.0) to address [CVE-2024-34069](https://nvd.nist.gov/vuln/detail/cve-2024-34069).

**BUG FIXES**
- Reduce EFA installation time for Ubuntu by ~20 minutes by only holding kernel packages for the installed kernel.
- Add GetFunction and GetPolicy permissions to PClusterBuildImageCleanupRole to prevent AccessDenied errors during build image stack deletion.


3.14.0
------

Expand Down
2 changes: 1 addition & 1 deletion cli/src/pcluster/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class Operation(Enum):

PCLUSTER_BUILD_IMAGE_CLEANUP_ROLE_PREFIX = "PClusterBuildImageCleanupRole"
# Tag key & expected revision (increment when policy widens)
PCLUSTER_BUILD_IMAGE_CLEANUP_ROLE_REVISION = 1
PCLUSTER_BUILD_IMAGE_CLEANUP_ROLE_REVISION = 2
PCLUSTER_BUILD_IMAGE_CLEANUP_ROLE_BOOTSTRAP_TAG_KEY = "parallelcluster:build-image-cleanup-role-bootstrapped"

P6E_GB200 = "p6e-gb200"
Expand Down
7 changes: 6 additions & 1 deletion cli/src/pcluster/imagebuilder_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ def _expected_inline_policy(account_id: str, partition: str):
{"Action": "ec2:CreateTags", "Resource": f"arn:{partition}:ec2:*::image/*", "Effect": "Allow"},
{"Action": "tag:TagResources", "Resource": "*", "Effect": "Allow"},
{
"Action": ["lambda:DeleteFunction", "lambda:RemovePermission"],
"Action": [
"lambda:DeleteFunction",
"lambda:RemovePermission",
"lambda:GetFunction",
"lambda:GetPolicy",
],
"Resource": f"arn:{partition}:lambda:*:{account_id}:function:ParallelClusterImage-*",
"Effect": "Allow",
},
Expand Down
24 changes: 20 additions & 4 deletions cli/tests/pcluster/cli/test_build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,26 +283,42 @@ def test_ensure_default_build_image_stack_cleanup_role_permission_denied(self, a
aws_api_mock.iam.tag_role.assert_not_called()

@pytest.mark.parametrize(
"account_id, partition",
"account_id, partition, actions",
[
("123456789012", "aws"),
("000000000000", "aws-us-gov"),
(
"123456789012",
"aws",
["lambda:DeleteFunction", "lambda:RemovePermission", "lambda:GetFunction", "lambda:GetPolicy"],
),
(
"000000000000",
"aws-us-gov",
["lambda:DeleteFunction", "lambda:RemovePermission", "lambda:GetFunction", "lambda:GetPolicy"],
),
],
)
def test_expected_inline_policy_dynamic_fields(self, account_id, partition):
def test_expected_inline_policy_dynamic_fields(self, account_id, partition, actions):
raw = _expected_inline_policy(account_id, partition)
policy = json.loads(raw)
assert policy["Version"] == "2012-10-17"
assert len(policy["Statement"]) == 13
for statement in policy["Statement"]:
resources = statement["Resource"]
action = statement["Action"]
action = action if isinstance(action, list) else [action]
for act in action:
if act in actions:
actions.remove(act)

resources = resources if isinstance(resources, list) else [resources]
for res in resources:
if res == "*":
continue
assert f"arn:{partition}" in res
if not res == f"arn:{partition}:ec2:*::image/*":
assert f":{account_id}:" in res
if len(actions) != 0:
raise AssertionError(f"Actions {actions} are not in the policy")

def _build_args(self, args):
args = [[k, v] if v is not None else [k] for k, v in args.items()]
Expand Down
Loading