Skip to content

Commit c5e6d22

Browse files
author
Kopas
committed
standardized cli arguments and expanded the README per the suggestions on the PR
1 parent 96bc35b commit c5e6d22

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ By default, the CodeBuild project will not run within a VPC, the image will be p
2525
These can be overridden with the relevant CLI options.
2626

2727
```bash
28-
sm-docker build . --repository mynewrepo:1.0 --role MyRoleName --bucket MyBucketName --vpc-id MyVpcId --subnets MySubnetId1,MySubnetId2 --security-groups MySecurityGroup1,MySecurityGroup2
29-
```
30-
31-
For instance, please see the sample command with additional argument listed below:
32-
33-
```bash
34-
sm-docker build . --repository mynewrepo:1.0 --role SampleDockerBuildRole --bucket sagemaker-us-east-1-326543455535 --vpc-id vpc-0c70e76ef1c603b94 --subnets subnet-0d984f080338960bb,subnet-0ac3e96808c8092f2 --security-groups sg-0d31b4042f2902cd0
28+
sm-docker build . --repository mynewrepo:1.0 --role SampleDockerBuildRole --bucket sagemaker-us-east-1-326543455535 --vpc-id vpc-0c70e76ef1c603b94 --subnet-ids subnet-0d984f080338960bb,subnet-0ac3e96808c8092f2 --security-group-ids sg-0d31b4042f2902cd0
3529
```
3630

3731
The CLI will take care of packaging the current directory and uploading to S3, creating a CodeBuild project, starting a build with the S3 artifacts, tailing the build logs, and uploading the built image to ECR.

sagemaker_studio_image_build/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def validate_args(args, extra_args):
1515
f'Error parsing reference: "{args.repository}" is not a valid repository/tag'
1616
)
1717

18-
vpc_config = [args.vpc_id, args.subnets, args.security_groups]
19-
none_arg_count = sum(arg is None for arg in [args.vpc_id, args.subnets, args.security_groups])
18+
vpc_config = [args.vpc_id, args.subnet_ids, args.security_group_ids]
19+
none_arg_count = sum(arg is None for arg in [args.vpc_id, args.subnet_ids, args.security_group_ids])
2020

2121
if none_arg_count > 0 and none_arg_count < 3:
2222
raise ValueError(
@@ -61,8 +61,8 @@ def construct_vpc_config(args):
6161
else:
6262
vpc_config = {
6363
'vpcId': args.vpc_id,
64-
'subnets': args.subnets.split(','),
65-
'securityGroupIds': args.security_groups.split(',')
64+
'subnets': args.subnet_ids.split(','),
65+
'securityGroupIds': args.security_group_ids.split(',')
6666
}
6767
return vpc_config
6868

@@ -112,11 +112,11 @@ def main():
112112
help="The Id of the VPC that will host the CodeBuild Project (such as vpc-05c09f91d48831c8c).",
113113
)
114114
build_parser.add_argument(
115-
"--subnets",
115+
"--subnet-ids",
116116
help="The comma-separated list of subnet ids for the CodeBuild Project (such as subnet-0b31f1863e9d31a67)",
117117
)
118118
build_parser.add_argument(
119-
"--security-groups",
119+
"--security-group-ids",
120120
help="The comma-separated list of security group ids for the CodeBuild Project (such as sg-0ce4ec0d0414d2ddc).",
121121
)
122122
build_parser.add_argument(

0 commit comments

Comments
 (0)