@ossy/deployment-tools 0.0.33 → 0.0.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/deployment-tools",
3
- "version": "0.0.33",
3
+ "version": "0.0.34",
4
4
  "description": "Collection of scripts and tools to aid deployment of containers and static files",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,8 +1,7 @@
1
1
  import * as core from '@actions/core'
2
2
  import { STSClient, AssumeRoleWithWebIdentityCommand } from '@aws-sdk/client-sts'
3
3
  import { DeploymentPlatform } from 'types'
4
- import { logDebug, logInfo, logError } from 'log'
5
- import { Credentials } from '@aws-sdk/types'
4
+ import { logInfo, logError } from 'log'
6
5
 
7
6
  export class AwsCredentialsClient {
8
7
 
@@ -20,7 +19,6 @@ export class AwsCredentialsClient {
20
19
  return core.getIDToken('sts.amazonaws.com')
21
20
  .then(webIdentityToken => {
22
21
  logInfo({ message: `[AwsCredentialsClient] Attempting to resolve aws credentials by assuming the role: ${awsRoleToAssume}` })
23
- logDebug({ message: '[AwsCredentialsClient] webIdentityToken', data: webIdentityToken })
24
22
  return stsClient.send(new AssumeRoleWithWebIdentityCommand({
25
23
  RoleArn: `arn:aws:iam::${awsAccountId}:role/${awsRoleToAssume}`,
26
24
  RoleSessionName: 'GitHubActions',
@@ -29,6 +27,7 @@ export class AwsCredentialsClient {
29
27
  }))
30
28
  })
31
29
  .then(responseData => ({
30
+ // Don't ask
32
31
  AccessKeyId: responseData.Credentials.AccessKeyId,
33
32
  SessionToken: responseData.Credentials.SessionToken,
34
33
  SecretAccessKey: responseData.Credentials.SecretAccessKey,
@@ -36,11 +35,6 @@ export class AwsCredentialsClient {
36
35
  sessionToken: responseData.Credentials.SessionToken,
37
36
  secretAccessKey: responseData.Credentials.SecretAccessKey,
38
37
  }))
39
- // .then(responseData => responseData.Credentials)
40
- .then(data => {
41
- logDebug({ message: '[AwsCredentialsClient] AssumeRoleWithWebIdentityCommand responseData.Credentials', data })
42
- return data
43
- })
44
38
  .catch(error => {
45
39
  logError({ message: '[AwsCredentialsClient] Could not resolve temporary credentials', error })
46
40
  return undefined
@@ -58,17 +58,19 @@ export class DeploymentPlatformClient {
58
58
 
59
59
  logInfo({ message: `[DeploymentPlatformClient]: Found deployment platforms [${platforms.map(x => x.platformName).join(', ')}]` })
60
60
 
61
- const deploymentPlatform = platforms.find(platform => platform.platformName === deploymentTemplate.targetDeploymentPlatform)
61
+ const deploymentPlatform = platforms
62
+ .map(platform => ({ ...platform, activeEnvironment: targetEnvironment }))
63
+ .find(platform => platform.platformName === deploymentTemplate.targetDeploymentPlatform)
62
64
 
63
65
  if (!deploymentPlatform) {
64
- logError({ message: `[DeploymentPlatformClient] Could not find a deployment platform with the name ${deploymentTemplate.targetDeploymentPlatform}` })
66
+ logError({ message: `[DeploymentPlatformClient] Could not find a deployment platform with the name ${deploymentTemplate.targetDeploymentPlatform}` })
65
67
  return Promise.reject()
66
68
  }
67
69
 
68
70
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
69
71
 
70
72
  if (deploymentTemplate.type !== SupportedDeploymentTypes.Container) {
71
- logError({ message: `[DeploymentPlatformClient] Unsupported deployment type of ${deploymentTemplate.type}` })
73
+ logError({ message: `[DeploymentPlatformClient] Unsupported deployment type of ${deploymentTemplate.type}` })
72
74
  return Promise.reject()
73
75
  }
74
76
 
@@ -83,7 +85,7 @@ export class DeploymentPlatformClient {
83
85
 
84
86
  })
85
87
  })
86
- .catch(error => logError({ message: '[DeploymentPlatformClient] Could not send deployment request', error }))
88
+ .catch(error => logError({ message: '[DeploymentPlatformClient] Could not send deployment request', error }))
87
89
  }
88
90
 
89
91
  static getDeploymentTemplates(pathToOssyFile: string): Promise<DeploymentTemplate[]> {