Skip to content

Commit 567b916

Browse files
authored
Merge branch 'aws:develop' into wip/group-test-starccm-and-openfoam
2 parents 00ca668 + 35899aa commit 567b916

File tree

17 files changed

+231
-12
lines changed

17 files changed

+231
-12
lines changed

.github/workflows/bump_version.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Bump Version workflow that is triggered manually
2+
name: Bump Version
3+
4+
on:
5+
workflow_dispatch:
6+
# Inputs the workflow accepts.
7+
inputs:
8+
pcluster-version:
9+
description: 'The target version of ParallelCluster CLI'
10+
required: true
11+
type: string
12+
branch:
13+
description: 'The Github branch name'
14+
required: true
15+
type: string
16+
17+
jobs:
18+
create-pull-requests:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
fetch-depth: 0
24+
ref: ${{ inputs.branch }}
25+
- uses: actions/setup-java@v1
26+
with:
27+
java-version: 11
28+
- run: |
29+
sudo npm install -g redoc-cli
30+
sudo snap install yq
31+
- name: Modifiy Code to Change version
32+
run: ./util/bump-version.sh --version ${{ inputs.pcluster-version }}
33+
34+
- name: Create a Pull Request
35+
uses: peter-evans/create-pull-request@v6
36+
with:
37+
commit-message: 'Bump version to ${{ inputs.pcluster-version }}'
38+
title: 'Bump version to ${{ inputs.pcluster-version }}'
39+
body: |
40+
This PR contains version bump.
41+
Auto-generated by Github Action
42+
branch: versionbump${{ inputs.branch }}${{ inputs.pcluster-version }}
43+
delete-branch: true
44+
labels: skip-changelog-update
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Bump Version workflow that is triggered manually
2+
name: Bump Version for AWSBatch CLI
3+
4+
on:
5+
workflow_dispatch:
6+
# Inputs the workflow accepts.
7+
inputs:
8+
awsbatch-cli-version:
9+
description: 'The target version of AWSBatch CLI'
10+
required: true
11+
type: string
12+
branch:
13+
description: 'The Github branch name'
14+
required: true
15+
type: string
16+
17+
jobs:
18+
create-pull-requests:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
fetch-depth: 0
24+
ref: ${{ inputs.branch }}
25+
- name: Modifiy Code to Change version
26+
run: ./util/bump-awsbatch-cli-version.sh ${{ inputs.awsbatch-cli-version }}
27+
28+
- name: Create a Pull Request
29+
uses: peter-evans/create-pull-request@v6
30+
with:
31+
commit-message: 'Bump version for awsbatch-cli to ${{ inputs.awsbatch-cli-version }}'
32+
title: 'Bump version for awsbatch-cli to ${{ inputs.awsbatch-cli-version }}'
33+
body: |
34+
This PR contains version bump for awsbatch-cli.
35+
Auto-generated by Github Action
36+
branch: versionbumpbatch${{ inputs.branch }}${{ inputs.awsbatch-cli-version }}
37+
delete-branch: true
38+
labels: skip-changelog-update

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
CHANGELOG
22
=========
33

4+
3.11.0
5+
------
6+
7+
**ENHANCEMENTS**
8+
9+
- Add support for custom actions on login nodes.
10+
411
3.10.0
512
------
613

cli/src/pcluster/config/cluster_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ def __init__(
13461346
networking: LoginNodesNetworking = None,
13471347
count: int = None,
13481348
ssh: LoginNodesSsh = None,
1349+
custom_actions: CustomActions = None,
13491350
iam: LoginNodesIam = None,
13501351
gracetime_period: int = None,
13511352
**kwargs,
@@ -1357,6 +1358,7 @@ def __init__(
13571358
self.networking = networking
13581359
self.count = Resource.init_param(count, default=1)
13591360
self.ssh = ssh
1361+
self.custom_actions = custom_actions
13601362
self.iam = iam or LoginNodesIam(implied=True)
13611363
self.gracetime_period = Resource.init_param(gracetime_period, default=10)
13621364

cli/src/pcluster/schemas/cluster_schema.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,19 @@ def make_resource(self, data, **kwargs):
13151315
return CustomActions(**data)
13161316

13171317

1318+
class LoginNodesCustomActionsSchema(BaseSchema):
1319+
"""Represent the schema for all available custom actions in a login node pool."""
1320+
1321+
on_node_start = OneOrManyCustomActionField(metadata={"update_policy": UpdatePolicy.UNSUPPORTED})
1322+
on_node_configured = OneOrManyCustomActionField(metadata={"update_policy": UpdatePolicy.UNSUPPORTED})
1323+
on_node_updated = OneOrManyCustomActionField(metadata={"update_policy": UpdatePolicy.UNSUPPORTED})
1324+
1325+
@post_load
1326+
def make_resource(self, data, **kwargs):
1327+
"""Generate resource."""
1328+
return CustomActions(**data)
1329+
1330+
13181331
class InstanceTypeSchema(BaseSchema):
13191332
"""Schema of a compute resource that supports a pool of instance types."""
13201333

@@ -1422,6 +1435,7 @@ class LoginNodesPoolSchema(BaseSchema):
14221435
metadata={"update_policy": UpdatePolicy.SUPPORTED},
14231436
)
14241437
ssh = fields.Nested(LoginNodesSshSchema, metadata={"update_policy": UpdatePolicy.LOGIN_NODES_STOP})
1438+
custom_actions = fields.Nested(LoginNodesCustomActionsSchema, metadata={"update_policy": UpdatePolicy.IGNORED})
14251439
iam = fields.Nested(LoginNodesIamSchema, metadata={"update_policy": UpdatePolicy.LOGIN_NODES_STOP})
14261440
gracetime_period = fields.Int(
14271441
validate=validate.Range(

cli/src/pcluster/templates/cdk_builder_utils.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,18 @@ def _build_policy(self) -> List[iam.PolicyStatement]:
934934
sid="CloudFormation",
935935
actions=[
936936
"cloudformation:DescribeStackResource",
937+
"cloudformation:DescribeStacks",
937938
],
938939
effect=iam.Effect.ALLOW,
939-
resources=[core.Aws.STACK_ID],
940+
resources=[
941+
self._format_arn(
942+
service="cloudformation",
943+
resource=f"stack/{Stack.of(self).stack_name}/*",
944+
region=Stack.of(self).region,
945+
account=Stack.of(self).account,
946+
),
947+
core.Aws.STACK_ID,
948+
],
940949
),
941950
iam.PolicyStatement(
942951
sid="DynamoDBTable",

cli/src/pcluster/templates/login_nodes_stack.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def _add_login_nodes_pool_launch_template(self):
258258
"hosted_zone": (str(self._cluster_hosted_zone.ref) if self._cluster_hosted_zone else ""),
259259
"log_group_name": self._log_group.log_group_name,
260260
"log_rotation_enabled": "true" if self._config.is_log_rotation_enabled else "false",
261+
"pool_name": self._pool.name,
261262
"node_type": "LoginNode",
262263
"proxy": self._pool.networking.proxy.http_proxy_address if self._pool.networking.proxy else "NONE",
263264
"raid_shared_dir": to_comma_separated_string(

cli/tests/pcluster/example_configs/slurm.full.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ LoginNodes:
1717
- subnet-12345678
1818
Ssh:
1919
KeyName: ec2-key-name
20+
CustomActions:
21+
OnNodeStart:
22+
Script: https://test.tgz # s3:// | https://
23+
Args:
24+
- arg1
25+
- arg2
26+
OnNodeConfigured:
27+
Script: https://test.tgz # s3:// | https://
28+
Args:
29+
- arg1
30+
- arg2
31+
OnNodeUpdated:
32+
Script: https://test.tgz # s3:// | https://
33+
Args:
34+
- arg1
35+
- arg2
2036
Iam:
2137
InstanceRole: arn:aws:iam::aws:role/LoginNodeRole
2238
HeadNode:

cli/tests/pcluster/schemas/test_cluster_schema.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
HeadNodeIamSchema,
2626
HeadNodeRootVolumeSchema,
2727
ImageSchema,
28+
LoginNodesCustomActionsSchema,
2829
QueueCustomActionsSchema,
2930
QueueIamSchema,
3031
QueueTagSchema,
@@ -259,14 +260,18 @@ def test_head_node_root_volume_schema(mocker, config_dict, failure_message):
259260
),
260261
],
261262
)
262-
def test_head_node_custom_actions_schema(mocker, config_dict, failure_message):
263+
def test_head_login_node_custom_actions_schema(mocker, config_dict, failure_message):
263264
mock_aws_api(mocker)
264265
if failure_message:
265266
with pytest.raises(ValidationError, match=failure_message):
266267
HeadNodeCustomActionsSchema().load(config_dict)
268+
LoginNodesCustomActionsSchema().load(config_dict)
267269
else:
268-
conf = HeadNodeCustomActionsSchema().load(config_dict)
269-
HeadNodeCustomActionsSchema().dump(conf)
270+
head_conf = HeadNodeCustomActionsSchema().load(config_dict)
271+
login_conf = LoginNodesCustomActionsSchema().load(config_dict)
272+
273+
HeadNodeCustomActionsSchema().dump(head_conf)
274+
LoginNodesCustomActionsSchema().dump(login_conf)
270275

271276

272277
@pytest.mark.parametrize(

cli/tests/pcluster/templates/test_cluster_stack.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,25 @@ def assert_iam_policy_properties(self, template, resource_name: str):
756756
"Sid": "Autoscaling",
757757
},
758758
{
759-
"Action": "cloudformation:DescribeStackResource",
759+
"Action": ["cloudformation:DescribeStackResource", "cloudformation:DescribeStacks"],
760760
"Effect": "Allow",
761-
"Resource": {
762-
"Ref": "AWS::StackId",
763-
},
761+
"Resource": [
762+
{
763+
"Fn::Join": [
764+
"",
765+
[
766+
"arn:",
767+
{"Ref": "AWS::Partition"},
768+
":cloudformation:",
769+
{"Ref": "AWS::Region"},
770+
":",
771+
{"Ref": "AWS::AccountId"},
772+
":stack/clustername/*",
773+
],
774+
]
775+
},
776+
{"Ref": "AWS::StackId"},
777+
],
764778
"Sid": "CloudFormation",
765779
},
766780
{

0 commit comments

Comments
 (0)