@adobe/helix-deploy 8.0.2 → 8.1.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [8.1.0](https://github.com/adobe/helix-deploy/compare/v8.0.2...v8.1.0) (2023-01-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * add aws-update-secrets command ([#488](https://github.com/adobe/helix-deploy/issues/488)) ([70d0e2b](https://github.com/adobe/helix-deploy/commit/70d0e2bb2c2b907dbae41b7e988bb389d530348b))
7
+
1
8
  ## [8.0.2](https://github.com/adobe/helix-deploy/compare/v8.0.1...v8.0.2) (2023-01-21)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "8.0.2",
3
+ "version": "8.1.0",
4
4
  "description": "Library and Commandline Tools to build and deploy OpenWhisk Actions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/adobe/helix-deploy#readme",
@@ -28,6 +28,7 @@ export default class AWSConfig {
28
28
  arch: 'x86_64',
29
29
  identitySources: ['$request.header.Authorization'],
30
30
  deployBucket: '',
31
+ updateSecrets: undefined,
31
32
  });
32
33
  }
33
34
 
@@ -44,7 +45,8 @@ export default class AWSConfig {
44
45
  .withAWSCleanUpIntegrations(argv.awsCleanupIntegrations)
45
46
  .withAWSCreateRoutes(argv.awsCreateRoutes)
46
47
  .withAWSParamsManager(argv.awsParameterManager)
47
- .withAWSDeployBucket(argv.awsDeployBucket);
48
+ .withAWSDeployBucket(argv.awsDeployBucket)
49
+ .withAWSUpdateSecrets(argv.awsUpdateSecrets);
48
50
  }
49
51
 
50
52
  withAWSRegion(value) {
@@ -110,11 +112,16 @@ export default class AWSConfig {
110
112
  return this;
111
113
  }
112
114
 
115
+ withAWSUpdateSecrets(value) {
116
+ this.updateSecrets = value;
117
+ return this;
118
+ }
119
+
113
120
  static yarg(yargs) {
114
121
  return yargs
115
122
  .group(['aws-region', 'aws-api', 'aws-role', 'aws-cleanup-buckets', 'aws-cleanup-integrations',
116
123
  'aws-create-routes', 'aws-create-authorizer', 'aws-attach-authorizer', 'aws-lambda-format',
117
- 'aws-parameter-manager', 'aws-deploy-template', 'aws-arch'], 'AWS Deployment Options')
124
+ 'aws-parameter-manager', 'aws-deploy-template', 'aws-arch', 'aws-update-secrets'], 'AWS Deployment Options')
118
125
  .option('aws-region', {
119
126
  description: 'the AWS region to deploy lambda functions to',
120
127
  type: 'string',
@@ -146,6 +153,10 @@ export default class AWSConfig {
146
153
  default: ['secret'],
147
154
  array: true,
148
155
  })
156
+ .option('aws-update-secrets', {
157
+ description: 'Uploads the function specific secrets with the params. defaults to /helix-deploy/{pkg}/{name}',
158
+ type: 'string',
159
+ })
149
160
  .option('aws-lambda-format', {
150
161
  description: 'Format to use to create lambda functions (note that all dots (\'.\') will be replaced with underscores.',
151
162
  type: 'string',
@@ -475,6 +475,21 @@ export default class AWSDeployer extends BaseDeployer {
475
475
  return this._functionURL;
476
476
  }
477
477
 
478
+ async updateSecrets() {
479
+ const { cfg } = this;
480
+ const SecretId = cfg.updateSecrets || `/helix-deploy/${cfg.packageName}/${cfg.baseName}`;
481
+ this.log.info(`--: updating app parameters in secrets manager at '${SecretId}'...`);
482
+ try {
483
+ await this._sm.send(new PutSecretValueCommand({
484
+ SecretId,
485
+ SecretString: JSON.stringify(cfg.params),
486
+ }));
487
+ } catch (e) {
488
+ this.log.error(chalk`{red error:} unable to update value of '${SecretId}'`);
489
+ throw e;
490
+ }
491
+ }
492
+
478
493
  async updatePackage() {
479
494
  const { cfg } = this;
480
495
  let found = false;
@@ -827,7 +842,7 @@ export default class AWSDeployer extends BaseDeployer {
827
842
  }
828
843
 
829
844
  async validateAdditionalTasks() {
830
- if (this._cfg.cleanUpIntegrations) {
845
+ if (this._cfg.cleanUpIntegrations || this._cfg.updateSecrets !== undefined) {
831
846
  // disable auto build if no deploy
832
847
  if (!this.cfg.deploy) {
833
848
  this.cfg.build = false;
@@ -840,6 +855,9 @@ export default class AWSDeployer extends BaseDeployer {
840
855
  if (this._cfg.cleanUpIntegrations) {
841
856
  await this.cleanUpIntegrations();
842
857
  }
858
+ if (this._cfg.updateSecrets !== undefined) {
859
+ await this.updateSecrets();
860
+ }
843
861
  }
844
862
 
845
863
  async deploy() {