Skip to content

Commit ca73db4

Browse files
author
Apurva
authored
Merge pull request #1564 from ajantrania/starling/deploy-fix
Fix(AppComposer): Enable sync's lambda validation check to be skipped
2 parents 4a614c5 + f2bb69a commit ca73db4

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/applicationcomposer/messageHandlers/deployMessageHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function deployMessageHandler(message: DeployRequestMessage, contex
1717
* so we instead check for an undefined response to determine failure. The downside is that
1818
* we don't get failure reasons.
1919
*/
20-
const result = (await vscode.commands.executeCommand('aws.samcli.sync', args)) as SamSyncResult
20+
const result = (await vscode.commands.executeCommand('aws.samcli.sync', args, false)) as SamSyncResult
2121
if (result?.isSuccess) {
2222
vscode.window.showInformationMessage('SAM Sync succeeded!')
2323
telemetry.appcomposer_deployCompleted.emit({ result: 'Succeeded' })

src/shared/sam/sync.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,10 @@ function getSyncParamsFromConfig(config: SamConfig) {
491491
return params
492492
}
493493

494-
export async function prepareSyncParams(arg: vscode.Uri | AWSTreeNodeBase | undefined): Promise<Partial<SyncParams>> {
494+
export async function prepareSyncParams(
495+
arg: vscode.Uri | AWSTreeNodeBase | undefined,
496+
validate?: boolean
497+
): Promise<Partial<SyncParams>> {
495498
// Skip creating dependency layers by default for backwards compat
496499
const baseParams: Partial<SyncParams> = { skipDependencyLayer: true }
497500

@@ -519,7 +522,7 @@ export async function prepareSyncParams(arg: vscode.Uri | AWSTreeNodeBase | unde
519522

520523
const template = {
521524
uri: arg,
522-
data: await CloudFormation.load(arg.fsPath),
525+
data: await CloudFormation.load(arg.fsPath, validate),
523526
}
524527

525528
return { ...baseParams, template, projectRoot: getWorkspaceUri(template) }
@@ -533,7 +536,11 @@ export type SamSyncResult = {
533536
}
534537

535538
export function registerSync() {
536-
async function runSync(deployType: SyncParams['deployType'], arg?: unknown): Promise<SamSyncResult> {
539+
async function runSync(
540+
deployType: SyncParams['deployType'],
541+
arg?: unknown,
542+
validate?: boolean
543+
): Promise<SamSyncResult> {
537544
telemetry.record({ syncedResources: deployType === 'infra' ? 'AllResources' : 'CodeOnly' })
538545

539546
const connection = Auth.instance.activeConnection
@@ -547,7 +554,10 @@ export function registerSync() {
547554

548555
await confirmDevStack()
549556
const registry = await globals.templateRegistry
550-
const params = await new SyncWizard({ deployType, ...(await prepareSyncParams(input)) }, registry).run()
557+
const params = await new SyncWizard(
558+
{ deployType, ...(await prepareSyncParams(input, validate)) },
559+
registry
560+
).run()
551561
if (params === undefined) {
552562
throw new CancellationError('user')
553563
}
@@ -567,7 +577,7 @@ export function registerSync() {
567577
id: 'aws.samcli.sync',
568578
autoconnect: true,
569579
},
570-
(arg?: unknown) => telemetry.sam_sync.run(() => runSync('infra', arg))
580+
(arg?: unknown, validate?: boolean) => telemetry.sam_sync.run(() => runSync('infra', arg, validate))
571581
)
572582

573583
const settings = SamCliSettings.instance
@@ -608,11 +618,11 @@ async function confirmDevStack() {
608618
}
609619

610620
const message = `
611-
The SAM CLI will use the AWS Lambda, Amazon API Gateway, and AWS StepFunctions APIs to upload your code without
621+
The SAM CLI will use the AWS Lambda, Amazon API Gateway, and AWS StepFunctions APIs to upload your code without
612622
performing a CloudFormation deployment. This will cause drift in your CloudFormation stack.
613-
**The sync command should only be used against a development stack**.
623+
**The sync command should only be used against a development stack**.
614624
615-
Confirm that you are synchronizing a development stack.
625+
Confirm that you are synchronizing a development stack.
616626
`.trim()
617627

618628
const okDontShow = "OK, and don't show this again"

0 commit comments

Comments
 (0)