Skip to content

Commit

Permalink
options to not remove image
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Goina committed Aug 16, 2022
1 parent c21bd04 commit 9f643f0
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions scripts/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ function destroy(argv) {
cwd: "./admin_api_stack/",
});

console.log(chalk.yellow("⚠️ Removing Workstation stack"));
exec(`npm run cdk -- destroy -f --require-approval never Workstation`, {
cwd: "./workstation_stack/",
});
if (!argv.keepWorkstation) {
console.log(chalk.yellow("⚠️ Removing Workstation stack"));
exec(`npm run cdk -- destroy -f --require-approval never Workstation`, {
cwd: "./workstation_stack/",
});
}

if (!argv.keepBackend) {
console.log(chalk.yellow("⚠️ Removing VPC stack."));
Expand All @@ -65,6 +67,8 @@ function destroy(argv) {
}

if (argv.undeployCognito) {
// cognito has to be explicitly removed
// by default we keep it because we don't want to recreate users
console.log(chalk.yellow("⚠️ Removing Cognito stack."));
exec(
`npm run cdk -- destroy -f --all --require-approval never`,
Expand All @@ -73,7 +77,12 @@ function destroy(argv) {
}

console.log(chalk.green("✅ All stacks have been removed."));
removeAppStreamImage();
if (!argv.keepHortaImage && !argv.keepWorkstation) {
// if we keep the workstation fleet
// the image cannot be removed anyway
// because it is still associated with the fleet
removeAppStreamImage();
}
}

let missingVarsCount = 0;
Expand Down Expand Up @@ -108,6 +117,14 @@ const argv = require("yargs/yargs")(process.argv.slice(2))
type: 'boolean',
describe: 'If set keep the JACS stack'
})
.option('keep-workstation', {
type: 'boolean',
describe: 'Do not remove the workstation appstream stack and fleet.',
})
.option('keep-horta-image', {
type: 'boolean',
describe: 'Do not remove Horta AppStream image',
})
.argv;

(async () => {
Expand Down

0 comments on commit 9f643f0

Please sign in to comment.