-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReport.mjs
28 lines (26 loc) · 849 Bytes
/
Report.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env zx
import { writeFileSync } from 'fs'
import { exitWithError, getEnvOrFail, appEnv, colour, manifestS3Path, deployedConfigS3Path } from './Shared.mjs'
const triggerFunctionName = getEnvOrFail("TRIGGER_FUNCTION_NAME")
const payloadFileName = "payload.json"
const outputFileName = "output.json"
const payload = {
type: "deployed",
appEnv,
colour,
manifestS3Path,
deployedConfigS3Path
}
const json = JSON.stringify(payload, null, 2)
console.log(json)
try {
writeFileSync(payloadFileName, json)
} catch (error) {
exitWithError("Write file failed")
}
try {
await $`aws lambda invoke --function-name ${triggerFunctionName} --cli-binary-format raw-in-base64-out --payload file://${payloadFileName} ${outputFileName}`
await $`cat ${outputFileName}`
} catch (error) {
exitWithError("Invoke failed")
}