Skip to content

Commit 6bde97e

Browse files
Taniya Mathurgudivt
authored andcommitted
Add --no-validate option to bypass CloudFormation template validation
1 parent f75e6ed commit 6bde97e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

publish.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(self, verbose=False):
5757
self.s3_client = None
5858
self.cf_client = None
5959
self._is_lib_changed = False
60+
self.skip_validation = False
6061

6162
def log_verbose(self, message, style="dim"):
6263
"""Log verbose messages if verbose mode is enabled"""
@@ -119,7 +120,7 @@ def print_usage(self):
119120
"""Print usage information with Rich formatting"""
120121
self.console.print("\n[bold cyan]Usage:[/bold cyan]")
121122
self.console.print(
122-
" python3 publish.py <cfn_bucket_basename> <cfn_prefix> <region> [public] [--max-workers N] [--verbose] [--no-validate] [--clean-build]"
123+
" python3 publish.py <cfn_bucket_basename> <cfn_prefix> <region> [public] [--max-workers N] [--verbose] [--no-validate]"
123124
)
124125

125126
self.console.print("\n[bold cyan]Parameters:[/bold cyan]")
@@ -143,9 +144,6 @@ def print_usage(self):
143144
self.console.print(
144145
" [yellow][--no-validate][/yellow]: Optional. Skip CloudFormation template validation"
145146
)
146-
self.console.print(
147-
" [yellow][--clean-build][/yellow]: Optional. Delete all .checksum files to force full rebuild"
148-
)
149147

150148
def check_parameters(self, args):
151149
"""Check and validate input parameters"""
@@ -208,8 +206,6 @@ def check_parameters(self, args):
208206
self.console.print(
209207
"[yellow]CloudFormation template validation will be skipped[/yellow]"
210208
)
211-
elif arg == "--clean-build":
212-
self.clean_checksums()
213209
else:
214210
self.console.print(
215211
f"[yellow]Warning: Unknown argument '{arg}' ignored[/yellow]"
@@ -1287,10 +1283,15 @@ def build_main_template(self, webui_zipfile, components_needing_rebuild):
12871283
)
12881284

12891285
# Validate the template
1290-
template_url = f"https://s3.{self.region}.amazonaws.com/{self.bucket}/{templates[0][0]}"
1291-
self.console.print(f"[cyan]Validating template: {template_url}[/cyan]")
1292-
self.cf_client.validate_template(TemplateURL=template_url)
1293-
self.console.print("[green]✅ Template validation passed[/green]")
1286+
if self.skip_validation:
1287+
self.console.print(
1288+
"[yellow]⚠️ Skipping CloudFormation template validation[/yellow]"
1289+
)
1290+
else:
1291+
template_url = f"https://s3.{self.region}.amazonaws.com/{self.bucket}/{templates[0][0]}"
1292+
self.console.print(f"[cyan]Validating template: {template_url}[/cyan]")
1293+
self.cf_client.validate_template(TemplateURL=template_url)
1294+
self.console.print("[green]✅ Template validation passed[/green]")
12941295

12951296
except ClientError as e:
12961297
# Delete checksum on template validation failure

0 commit comments

Comments
 (0)