@agilecustoms/envctl 0.28.2 → 0.29.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.
@@ -53,6 +53,10 @@ export class TerraformAdapter {
53
53
  }
54
54
  return key;
55
55
  }
56
+ async lockProviders(cwd) {
57
+ console.log('Update lock file');
58
+ await this.processRunner.run('terraform', ['providers', 'lock', '-platform=linux_amd64'], cwd);
59
+ }
56
60
  printTime() {
57
61
  const now = new Date();
58
62
  const utc = now.toISOString();
@@ -12,12 +12,11 @@ async function handler() {
12
12
  const answers = await inquirer.prompt([
13
13
  {
14
14
  type: 'input',
15
- name: 'owner',
16
- message: 'owner is required to deploy any env\n'
17
- + 'this value will be used as default - if not provided via --owner key in "deploy" command\n'
15
+ name: 'userName',
16
+ message: 'userName is required to deploy any env\n'
18
17
  + '(prefer GitHub username)\n'
19
- + 'owner:',
18
+ + 'userName:',
20
19
  },
21
20
  ]);
22
- configService.saveConfig({ owner: answers.owner });
21
+ configService.saveConfig({ userName: answers.userName });
23
22
  }
@@ -23,11 +23,11 @@ export class ConfigService {
23
23
  }
24
24
  return this.config;
25
25
  }
26
- getOwner() {
27
- const owner = this.loadConfig()?.owner;
28
- if (!owner) {
29
- throw new KnownException('please first set owner via calling \'envctl configure\'');
26
+ getUserName() {
27
+ const userName = this.loadConfig()?.userName;
28
+ if (!userName) {
29
+ throw new KnownException('please first set userName via calling \'envctl configure\'');
30
30
  }
31
- return owner;
31
+ return userName;
32
32
  }
33
33
  }
@@ -59,9 +59,9 @@ export class EnvCtl {
59
59
  checkInput(env, cwd) {
60
60
  if (env.ephemeral)
61
61
  return;
62
- const owner = this.configService.getOwner();
63
- if (env.owner !== owner) {
64
- throw new KnownException(`Can not change env owner ${env.owner} -> ${owner}`);
62
+ const userName = this.configService.getUserName();
63
+ if (env.owner !== userName) {
64
+ throw new KnownException(`Can not change env owner ${env.owner} -> ${userName}`);
65
65
  }
66
66
  if (env.kind) {
67
67
  const kind = this.cliHelper.getKind(cwd);
@@ -81,7 +81,7 @@ export class EnvCtl {
81
81
  }
82
82
  async plan(tfArgs, cwd) {
83
83
  const key = this.terraformAdapter.getKey(cwd);
84
- const owner = this.configService.getOwner();
84
+ const userName = this.configService.getUserName();
85
85
  const env = await this.tryGetEnv(key);
86
86
  let vars = undefined;
87
87
  if (env) {
@@ -93,7 +93,7 @@ export class EnvCtl {
93
93
  }
94
94
  vars = env.vars;
95
95
  }
96
- const envTerraform = { key, ephemeral: false, owner, args: tfArgs, vars };
96
+ const envTerraform = { key, ephemeral: false, owner: userName, args: tfArgs, vars };
97
97
  await this.terraformAdapter.plan(envTerraform, cwd);
98
98
  }
99
99
  async createEphemeral(key) {
@@ -110,19 +110,21 @@ export class EnvCtl {
110
110
  if (env === null) {
111
111
  const kind = this.cliHelper.getKind(cwd);
112
112
  console.log('Creating env metadata');
113
- const owner = this.configService.getOwner();
114
- const createEnv = { key, owner, kind };
113
+ const userName = this.configService.getUserName();
114
+ await this.terraformAdapter.lockProviders(cwd);
115
+ const createEnv = { key, owner: userName, kind };
115
116
  env = await this.envApi.create(createEnv);
116
117
  }
117
118
  else {
118
119
  this.checkInput(env, cwd);
119
120
  this.checkStatus(env);
121
+ await this.terraformAdapter.lockProviders(cwd);
120
122
  if (env.status === EnvStatus.Init) {
121
123
  await this.envApi.lockForUpdate(env);
122
124
  }
123
125
  else if (env.status == EnvStatus.Updating) {
124
- const answerYes = await this.cliHelper.promptYesNo(`Env status is ${env.status},
125
- likely to be an error from a previous run\nDo you want to proceed with deployment?`);
126
+ const answerYes = await this.cliHelper.promptYesNo(`Env status is ${env.status}, likely due to an error from a previous run\n
127
+ Do you want to proceed with deployment?`);
126
128
  if (!answerYes) {
127
129
  console.log('Aborting deployment');
128
130
  return;
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.28.2",
4
+ "version": "0.29.0",
5
5
  "author": "Alex Chekulaev",
6
6
  "type": "module",
7
7
  "bin": {