Skip to content

Commit 7e21a89

Browse files
committed
style: fix prettier and ruff formatting for CI
1 parent 7d3bcd5 commit 7e21a89

7 files changed

Lines changed: 38 additions & 17 deletions

File tree

modules/sagemaker/sagemaker-model-cicd/lib/code-pipeline/mlops-code-pipeline-stack.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export class MLOpsCodePipelineStack extends cdk.Stack {
7979
// this pipeline will already be updated during `seedfarmer apply`
8080
selfMutation: false,
8181
crossAccountKeys: true,
82-
artifactBucket: utils.createPipelineArtifactsBucket(this, s3AccessLogsBucketArn, `${projectName}-infra-pipeline-artifacts/`),
82+
artifactBucket: utils.createPipelineArtifactsBucket(
83+
this,
84+
s3AccessLogsBucketArn,
85+
`${projectName}-infra-pipeline-artifacts/`,
86+
),
8387
synth: new cdk.pipelines.CodeBuildStep('Synth', {
8488
input: cdk.pipelines.CodePipelineSource.codeCommit(
8589
this.infraRepo,

modules/sagemaker/sagemaker-model-cicd/lib/code-pipeline/model-build-support/model-build-support-stack.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,17 @@ export class ModelBuildSupportStack extends cdk.Stack {
101101
autoDeleteObjects: true,
102102
enforceSSL: true,
103103
serverAccessLogsBucket: accessLogsBucket,
104-
serverAccessLogsPrefix: accessLogsBucket ? `${sagemakerArtifactsBucketName}-logs/` : undefined,
104+
serverAccessLogsPrefix: accessLogsBucket
105+
? `${sagemakerArtifactsBucketName}-logs/`
106+
: undefined,
105107
});
106108

107109
if (!accessLogsBucket) {
108110
NagSuppressions.addResourceSuppressions(logsBucket, [
109111
{
110112
id: 'AwsSolutions-S1',
111-
reason: 'This is itself a logging bucket; enabling access logs would create a circular dependency.',
113+
reason:
114+
'This is itself a logging bucket; enabling access logs would create a circular dependency.',
112115
},
113116
]);
114117
}

modules/sagemaker/sagemaker-model-cicd/lib/code-pipeline/model-build/model-build-code-pipeline-stack.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ export class ModelBuildCodePipelineStack extends cdk.Stack {
119119

120120
const buildPipeline = new codepipeline.Pipeline(this, 'BuildPipeline', {
121121
pipelineName,
122-
artifactBucket: utils.createPipelineArtifactsBucket(this, props.s3AccessLogsBucketArn, `${pipelineName}-artifacts/`),
122+
artifactBucket: utils.createPipelineArtifactsBucket(
123+
this,
124+
props.s3AccessLogsBucketArn,
125+
`${pipelineName}-artifacts/`,
126+
),
123127
});
124128
this.pipeline = buildPipeline;
125129

modules/sagemaker/sagemaker-model-cicd/lib/code-pipeline/model-deploy/model-deploy-code-pipeline-stack.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ export class ModelDeployCodePipelineStack extends cdk.Stack {
9090
// this pipeline will be updated by project-infra pipeline
9191
selfMutation: false,
9292
crossAccountKeys: true,
93-
artifactBucket: utils.createPipelineArtifactsBucket(this, props.s3AccessLogsBucketArn, `${pipelineName}-artifacts/`),
93+
artifactBucket: utils.createPipelineArtifactsBucket(
94+
this,
95+
props.s3AccessLogsBucketArn,
96+
`${pipelineName}-artifacts/`,
97+
),
9498
synth: new cdk.pipelines.CodeBuildStep('Synth', {
9599
input: cdk.pipelines.CodePipelineSource.codeCommit(
96100
infraRepo,

modules/sagemaker/sagemaker-model-cicd/lib/utils/pipeline-artifacts-bucket.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export function createPipelineArtifactsBucket(
2222
);
2323

2424
const accessLogsBucket = s3AccessLogsBucketArn
25-
? s3.Bucket.fromBucketArn(scope, 'PipelineAccessLogsBucket', s3AccessLogsBucketArn)
25+
? s3.Bucket.fromBucketArn(
26+
scope,
27+
'PipelineAccessLogsBucket',
28+
s3AccessLogsBucketArn,
29+
)
2630
: undefined;
2731

2832
const pipelineArtifactsBucket = new s3.Bucket(
@@ -35,7 +39,9 @@ export function createPipelineArtifactsBucket(
3539
bucketKeyEnabled: true,
3640
enforceSSL: true,
3741
serverAccessLogsBucket: accessLogsBucket,
38-
serverAccessLogsPrefix: accessLogsBucket ? (logsPrefix || 'pipeline-artifacts/') : undefined,
42+
serverAccessLogsPrefix: accessLogsBucket
43+
? logsPrefix || 'pipeline-artifacts/'
44+
: undefined,
3945
},
4046
);
4147
if (!accessLogsBucket) {

modules/sagemaker/sagemaker-model-cicd/test/model-build-support-stack.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,7 @@ test('ModelBuildSupportStack without s3AccessLogsBucketArn has no LoggingConfigu
6161
const logsBucket = Object.values(buckets).find(
6262
(b: any) => !b.Properties.BucketName,
6363
);
64-
expect(logsBucket?.Properties.LoggingConfiguration?.DestinationBucketName).toBeUndefined();
64+
expect(
65+
logsBucket?.Properties.LoggingConfiguration?.DestinationBucketName,
66+
).toBeUndefined();
6567
});

modules/sagemaker/sagemaker-templates/tests/test_stack.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ def test_s3_access_logging_configured(stack_with_logging: cdk.Stack, project_tem
249249
if logging_config:
250250
prefix = logging_config.get("LogFilePrefix", "")
251251
assert prefix, f"Bucket {logical_id} has empty log prefix"
252-
assert "xgboost-1" in prefix, (
253-
f"Bucket {logical_id} log prefix missing project name: {prefix}"
254-
)
252+
assert "xgboost-1" in prefix, f"Bucket {logical_id} log prefix missing project name: {prefix}"
255253
buckets_with_logging.append(logical_id)
256254

257255
assert len(buckets_with_logging) == expected_count, (
@@ -377,9 +375,9 @@ def check_statement_for_duplicates(statement: dict, logical_id: str, statement_s
377375
aws_principals = principal.get("AWS", [])
378376
if isinstance(aws_principals, list):
379377
principal_strs = [stringify_principal(p) for p in aws_principals]
380-
assert len(principal_strs) == len(
381-
set(principal_strs)
382-
), f"Duplicate principals in {logical_id} statement '{statement_sid}': {aws_principals}"
378+
assert len(principal_strs) == len(set(principal_strs)), (
379+
f"Duplicate principals in {logical_id} statement '{statement_sid}': {aws_principals}"
380+
)
383381

384382
template = Template.from_stack(stack_single_account)
385383
model_package_groups = template.find_resources("AWS::SageMaker::ModelPackageGroup")
@@ -432,9 +430,9 @@ def check_statement_for_duplicates(statement: dict, logical_id: str, statement_s
432430
aws_principals = principal.get("AWS", [])
433431
if isinstance(aws_principals, list):
434432
principal_strs = [stringify_principal(p) for p in aws_principals]
435-
assert len(principal_strs) == len(
436-
set(principal_strs)
437-
), f"Duplicate principals in KMS key {logical_id} statement '{statement_sid}': {aws_principals}"
433+
assert len(principal_strs) == len(set(principal_strs)), (
434+
f"Duplicate principals in KMS key {logical_id} statement '{statement_sid}': {aws_principals}"
435+
)
438436

439437
template = Template.from_stack(stack_single_account)
440438
kms_keys = template.find_resources("AWS::KMS::Key")

0 commit comments

Comments
 (0)