-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Allow failure tolerance to be set to 0 on validate-tasks command (allows CI/CD processes to fail on validation) - Added support for `Mappings` section / `!FindInMap` / `!Select` for task files. - Added functions `!MD5` / `!ReadFile` that can be used in task files. - Added function `!JsonString` that can be used in task files. - Added support for `!Ref OrganizationRoot` (and other types) in task files. - Fixed bug on `org-formation init` where tags on the MasterAccount where not added to generated template. - Updating stacks that have state `ROLLBACK_FAILED` will be retried. - Support for large (> 512000 byte) templates
- Loading branch information
1 parent
66a64d2
commit e7522cc
Showing
49 changed files
with
2,804 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Command } from 'commander'; | ||
import { ConsoleUtil } from '../util/console-util'; | ||
import { BaseCliCommand } from './base-command'; | ||
import { IUpdateOrganizationCommandArgs } from './update-organization'; | ||
import { TemplateRoot } from '~parser/parser'; | ||
import { GlobalState } from '~util/global-state'; | ||
|
||
|
||
const commandName = 'validate <templateFile>'; | ||
const commandDescription = 'validate organization resources'; | ||
|
||
export class ValidateOrganizationCommand extends BaseCliCommand<IUpdateOrganizationCommandArgs> { | ||
|
||
static SkipValidationForTasks = false; | ||
|
||
constructor(command?: Command) { | ||
super(command, commandName, commandDescription, 'templateFile'); | ||
} | ||
|
||
public static async Perform(command: IUpdateOrganizationCommandArgs): Promise<void> { | ||
const x = new ValidateOrganizationCommand(); | ||
await x.performCommand(command); | ||
} | ||
|
||
protected async performCommand(command: IUpdateOrganizationCommandArgs): Promise<void> { | ||
const template = TemplateRoot.create(command.templateFile); | ||
const state = await this.getState(command); | ||
const templateHash = template.hash; | ||
|
||
GlobalState.Init(state, template); | ||
|
||
const lastHash = state.getTemplateHash(); | ||
if (command.forceDeploy === true) { | ||
ConsoleUtil.LogInfo('organization validation forced.'); | ||
} else if (lastHash === templateHash) { | ||
ConsoleUtil.LogInfo('organization up to date, no work to be done.'); | ||
return; | ||
} | ||
|
||
const binder = await this.getOrganizationBinder(template, state); | ||
const tasks = binder.enumBuildTasks(); | ||
const createTasks = tasks.filter(x=>x.action === 'Create'); | ||
if (createTasks.length > 0) { | ||
ConsoleUtil.LogWarning('Accounts where added to the organization model.'); | ||
ConsoleUtil.LogWarning('Tasks might depend on updating the organization.'); | ||
ConsoleUtil.LogWarning('validation of tasks will be skipped.'); | ||
ValidateOrganizationCommand.SkipValidationForTasks = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.