@ossy/deployment-tools 0.0.31 → 0.0.32

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.31",
3
+ "version": "0.0.32",
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",
@@ -6,7 +6,7 @@ import { Credentials } from '@aws-sdk/types'
6
6
 
7
7
  export class AwsCredentialsClient {
8
8
 
9
- static resolveAwsCredentials({ awsAccountId, awsRegion, awsRoleToAssume }: DeploymentPlatform): Promise<Credentials | undefined> {
9
+ static resolveAwsCredentials({ awsAccountId, awsRegion, awsRoleToAssume }: DeploymentPlatform) {
10
10
  // If awsRoleToAssume is present, then we assume we run in a github workflow
11
11
  // If awsRoleToAssume is not present, then we assume they are resolved localy by aws-sdk
12
12
  if (!awsRoleToAssume) {
@@ -20,6 +20,7 @@ export class AwsCredentialsClient {
20
20
  return core.getIDToken('sts.amazonaws.com')
21
21
  .then(webIdentityToken => {
22
22
  logInfo({ message: `[AwsCredentialsClient] Attempting to resolve aws credentials by assuming the role: ${awsRoleToAssume}` })
23
+ logDebug({ message: '[AwsCredentialsClient] webIdentityToken', data: webIdentityToken })
23
24
  return stsClient.send(new AssumeRoleWithWebIdentityCommand({
24
25
  RoleArn: `arn:aws:iam::${awsAccountId}:role/${awsRoleToAssume}`,
25
26
  RoleSessionName: 'GitHubActions',
@@ -27,12 +28,15 @@ export class AwsCredentialsClient {
27
28
  WebIdentityToken: webIdentityToken
28
29
  }))
29
30
  })
30
- // .then(responseData => ({
31
- // AccessKeyId: responseData.Credentials.AccessKeyId,
32
- // SessionToken: responseData.Credentials.SessionToken,
33
- // SecretAccessKey: responseData.Credentials.SecretAccessKey,
34
- // }))
35
- .then(responseData => responseData.Credentials)
31
+ .then(responseData => ({
32
+ AccessKeyId: responseData.Credentials.AccessKeyId,
33
+ SessionToken: responseData.Credentials.SessionToken,
34
+ SecretAccessKey: responseData.Credentials.SecretAccessKey,
35
+ accessKeyId: responseData.Credentials.AccessKeyId,
36
+ sessionToken: responseData.Credentials.SessionToken,
37
+ secretAccessKey: responseData.Credentials.SecretAccessKey,
38
+ }))
39
+ // .then(responseData => responseData.Credentials)
36
40
  .then(data => {
37
41
  logDebug({ message: '[AwsCredentialsClient] AssumeRoleWithWebIdentityCommand responseData.Credentials', data })
38
42
  return data
package/src/log/index.ts CHANGED
@@ -11,13 +11,8 @@ enum TypeOfMessage {
11
11
  Debug = 'DEBUG'
12
12
  }
13
13
 
14
- const log = (...params) => {
15
- console.log(...params)
16
- }
17
-
18
- function prefixTo(prefix: string, message: string) {
19
- `[${prefix}]${message.startsWith('[') ? '' : ': '}`
20
- }
14
+ const log = (...params) => { console.log(...params) }
15
+ const prefixTo = (prefix: string, message: string) => `[${prefix}]${message.startsWith('[') ? '' : ': '}`
21
16
 
22
17
  export const logInfo = logInput => {
23
18
  const messagePrefix = prefixTo(TypeOfMessage.Info, logInput.message)