Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tarikdem committed Apr 5, 2024
1 parent b3595bd commit 2499011
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions code-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function build(sdk, params, config) {
// Invoke the lambda to start the build
const buildTime = (Date.now() / 1000).toString();
const imageTag = `${params.sourceVersion}-${Math.floor(buildTime)}`;
const { Payload } = await sdk.lambda.send(
const response = await sdk.lambda.send(
new InvokeCommand({
FunctionName: "GeneralDockerBuildPipelineLambdaFunction",
InvocationType: "Event",
Expand All @@ -64,9 +64,10 @@ async function build(sdk, params, config) {
}),
})
);
console.log(`Lambda command sent - Raw payload: ${Payload}`);
console.log(`Parsed: ${Buffer.from(Payload).toString()}`);
const start = JSON.parse(Buffer.from(Payload).toString());
console.log(`Response: ${response}`);
console.log(`Lambda command sent - Raw payload: ${response.Payload}`);
console.log(`Parsed: ${Buffer.from(response.Payload).toString()}`);
const start = JSON.parse(Buffer.from(response.Payload).toString());
console.log(start);

await core.notice(`Built image tag: ${imageTag}`);
Expand Down
9 changes: 5 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
// Invoke the lambda to start the build
const buildTime = (Date.now() / 1000).toString();
const imageTag = `${params.sourceVersion}-${Math.floor(buildTime)}`;
const { Payload } = await sdk.lambda.send(
const response = await sdk.lambda.send(
new InvokeCommand({
FunctionName: "GeneralDockerBuildPipelineLambdaFunction",
InvocationType: "Event",
Expand All @@ -74,9 +74,10 @@
}),
})
);
console.log(`Lambda command sent - Raw payload: ${Payload}`);
console.log(`Parsed: ${Buffer.from(Payload).toString()}`);
const start = JSON.parse(Buffer.from(Payload).toString());
console.log(`Response: ${response}`);
console.log(`Lambda command sent - Raw payload: ${response.Payload}`);
console.log(`Parsed: ${Buffer.from(response.Payload).toString()}`);
const start = JSON.parse(Buffer.from(response.Payload).toString());
console.log(start);

await core.notice(`Built image tag: ${imageTag}`);
Expand Down

0 comments on commit 2499011

Please sign in to comment.