@agilecustoms/envctl 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,6 @@ export class TerraformAdapter {
42
42
  }
43
43
  async deploy(envAttrs, tfArgs, cwd, attemptNo = 1) {
44
44
  const args = [
45
- `-var=project=${envAttrs.project}`,
46
45
  `-var=env=${envAttrs.env}`,
47
46
  `-var=owner=${envAttrs.owner}`,
48
47
  `-var=env_size=${envAttrs.size}`,
@@ -9,14 +9,15 @@ export function deploy(program) {
9
9
  .requiredOption('--env <env>', 'Environment name (can be git hash). {project}-{env} give env key used to store env state (s3 key in case of AWS)')
10
10
  .requiredOption('--owner <owner>', 'Environment owner (GH username)')
11
11
  .requiredOption('--size <size>', 'Environment size: min, small, full')
12
- .requiredOption('--type <type>', 'Environment type: dev, prod')
12
+ .option('--type <type>', 'Environment type: dev, prod', 'dev')
13
+ .option('--kind <kind>', 'Environment kind: complete project (default) or some slice such as tt-core + tt-web')
13
14
  .option('--cwd <cwd>', 'Working directory (default: current directory)')
14
15
  .allowUnknownOption(true)
15
16
  .argument('[args...]')
16
17
  .action(wrap(handler));
17
18
  }
18
19
  async function handler(tfArgs, options) {
19
- const { project, env, owner, size, type } = options;
20
- const envAttributes = { project, env, owner, size, type };
20
+ const { project, env, owner, size, type, kind } = options;
21
+ const envAttributes = { project, env, owner, size, type, kind };
21
22
  await envCtl.deploy(envAttributes, tfArgs, options.cwd);
22
23
  }
@@ -16,8 +16,8 @@ export class EnvCtl {
16
16
  console.log('First run terraform init to download providers, this doesn\'t create any resources in AWS even S3 object');
17
17
  await this.terraformAdapter.init(key, cwd);
18
18
  console.log('Creating env tracking record in DynamoDB');
19
- const { owner, size, type } = envDto;
20
- const createEnv = { key, ephemeral: false, owner, size, type };
19
+ const { owner, size, type, kind } = envDto;
20
+ const createEnv = { key, ephemeral: false, owner, size, type, kind };
21
21
  await this.envApi.create(createEnv);
22
22
  return await this.runDeploy(key, envDto, tfArgs, cwd);
23
23
  }
@@ -33,6 +33,9 @@ export class EnvCtl {
33
33
  if (env.type !== envDto.type) {
34
34
  throw new KnownException(`Can not change env type ${env.type} -> ${envDto.type}`);
35
35
  }
36
+ if (env.kind !== envDto.kind) {
37
+ throw new KnownException(`Can not change env kind ${env.kind} -> ${envDto.kind}`);
38
+ }
36
39
  if (env.status === 'CREATING') {
37
40
  const answerYes = await promptYesNo('Env status is CREATING, likely to error in previous run\nDo you want to proceed with deployment? (y/n) ');
38
41
  if (answerYes) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilecustoms/envctl",
3
3
  "description": "node.js CLI client for manage environments",
4
- "version": "0.7.0",
4
+ "version": "0.8.0",
5
5
  "author": "Alex Chekulaev",
6
6
  "type": "module",
7
7
  "bin": {
@@ -26,8 +26,8 @@
26
26
  "build": "tsc",
27
27
  "run": "node dist/index.js",
28
28
  "run-version": "tsc --sourceMap true && npm run run -- --version",
29
- "run-deploy": "tsc --sourceMap true && AWS_PROFILE=ac-tt-dev-deployer npm run run -- deploy --project tt-core --env alexc --owner laxa1986 --size min --type dev --cwd ../tt-core",
30
- "run-delete": "tsc --sourceMap true && AWS_PROFILE=ac-tt-dev-deployer npm run run -- delete --project tt-core --env alexc"
29
+ "run-deploy": "tsc --sourceMap true && AWS_PROFILE=ac-tt-dev-deployer npm run run -- deploy --project tt --env laxa1986 --owner laxa1986 --size min --kind tt-core --cwd ../tt-core",
30
+ "run-delete": "tsc --sourceMap true && AWS_PROFILE=ac-tt-dev-deployer npm run run -- delete --project tt --env laxa1986"
31
31
  },
32
32
  "dependencies": {
33
33
  "@aws-sdk/client-sts": "^3.716.0",