diff --git a/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.js b/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.js index 7246fef0b6..609dbae9ad 100644 --- a/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.js +++ b/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.js @@ -16,7 +16,14 @@ async function bitbucketPullRequestUpdated(webhook: WebhookRequestData, project: body, } = webhook; - console.log(body); + const meta = { + projectName: project.name, + pullrequestTitle: body.pullrequest.title, + pullrequestNumber: body.pullrequest.id, + pullrequestUrl: body.pullrequest.destination.repository.links.html.href, + repoName: body.repository.full_name, + repoUrl: body.repository.links.html.href, + } const headBranchName = body.pullrequest.source.branch.name const headSha = body.pullrequest.source.commit.hash @@ -51,7 +58,7 @@ async function bitbucketPullRequestUpdated(webhook: WebhookRequestData, project: case "UnknownActiveSystem": // These are not real errors and also they will happen many times. We just log them locally but not throw an error sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:handledButNoTask`, meta, - `*[${project.name}]* PR ${body.object_attributes.id} opened. No remove task created, reason: ${error}` + `*[${project.name}]* PR ${body.object_attributes.id} updated. No deploy task created, reason: ${error}` ) return; diff --git a/services/webhooks2tasks/src/handlers/githubPullRequestOpened.js b/services/webhooks2tasks/src/handlers/githubPullRequestOpened.js index aa5eeecab4..05e326eb77 100644 --- a/services/webhooks2tasks/src/handlers/githubPullRequestOpened.js +++ b/services/webhooks2tasks/src/handlers/githubPullRequestOpened.js @@ -21,6 +21,14 @@ async function githubPullRequestOpened(webhook: WebhookRequestData, project: Pro const baseBranchName = body.pull_request.base.ref const baseSha = body.pull_request.base.sha + const meta = { + projectName: project.name, + pullrequestTitle: body.pull_request.title, + pullrequestNumber: body.number, + pullrequestUrl: body.pull_request.html_url, + repoName: body.repository.full_name, + repoUrl: body.repository.html_url, + } const data: deployData = { repoUrl: body.repository.html_url, @@ -50,7 +58,7 @@ async function githubPullRequestOpened(webhook: WebhookRequestData, project: Pro case "UnknownActiveSystem": // These are not real errors and also they will happen many times. We just log them locally but not throw an error sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:handledButNoTask`, meta, - `*[${project.name}]* PR ${body.number} opened. No remove task created, reason: ${error}` + `*[${project.name}]* PR ${body.number} opened. No deploy task created, reason: ${error}` ) return; diff --git a/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.js b/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.js index f78d202d80..d6624cd618 100644 --- a/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.js +++ b/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.js @@ -27,9 +27,18 @@ async function githubPullRequestSynchronize(webhook: WebhookRequestData, project body, } = webhook; + const meta = { + projectName: project.name, + pullrequestTitle: body.pull_request.title, + pullrequestNumber: body.number, + pullrequestUrl: body.pull_request.html_url, + repoName: body.repository.full_name, + repoUrl: body.repository.html_url, + } + // Don't trigger deploy if only the PR body was edited. if (skipRedeploy(body)) { - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:handledButNoTask`, {}, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:handledButNoTask`, meta, `*[${project.name}]* PR ${body.number} updated. No deploy task created, reason: Only body changed` ) return; @@ -68,7 +77,7 @@ async function githubPullRequestSynchronize(webhook: WebhookRequestData, project case "UnknownActiveSystem": // These are not real errors and also they will happen many times. We just log them locally but not throw an error sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:handledButNoTask`, meta, - `*[${project.name}]* PR ${body.number} opened. No remove task created, reason: ${error}` + `*[${project.name}]* PR ${body.number} opened. No deploy task created, reason: ${error}` ) return; diff --git a/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.js b/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.js index 1bcc309f32..56be74f813 100644 --- a/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.js +++ b/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.js @@ -16,6 +16,15 @@ async function gitlabPullRequestOpened(webhook: WebhookRequestData, project: Pro body, } = webhook; + const meta = { + projectName: project.name, + pullrequestNumber: body.object_attributes.id, + pullrequestTitle: body.object_attributes.title, + pullrequestUrl: body.object_attributes.url, + repoName: body.object_attributes.target.name, + repoUrl: body.object_attributes.target.web_url, + } + const headBranchName = body.object_attributes.source_branch const headSha = body.object_attributes.last_commit.id const baseBranchName = body.object_attributes.target_branch @@ -50,7 +59,7 @@ async function gitlabPullRequestOpened(webhook: WebhookRequestData, project: Pro case "UnknownActiveSystem": // These are not real errors and also they will happen many times. We just log them locally but not throw an error sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:handledButNoTask`, meta, - `*[${project.name}]* PR ${body.object_attributes.id} opened. No remove task created, reason: ${error}` + `*[${project.name}]* PR ${body.object_attributes.id} opened. No deploy task created, reason: ${error}` ) return; diff --git a/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.js b/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.js index 4fb9d49401..d62535c9e2 100644 --- a/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.js +++ b/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.js @@ -16,6 +16,15 @@ async function gitlabPullRequestUpdated(webhook: WebhookRequestData, project: Pr body, } = webhook; + const meta = { + projectName: project.name, + pullrequestNumber: body.object_attributes.id, + pullrequestTitle: body.object_attributes.title, + pullrequestUrl: body.object_attributes.url, + repoName: body.object_attributes.target.name, + repoUrl: body.object_attributes.target.web_url, + } + const headBranchName = body.object_attributes.source_branch const headSha = body.object_attributes.last_commit.id const baseBranchName = body.object_attributes.target_branch @@ -51,7 +60,7 @@ async function gitlabPullRequestUpdated(webhook: WebhookRequestData, project: Pr case "UnknownActiveSystem": // These are not real errors and also they will happen many times. We just log them locally but not throw an error sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:handledButNoTask`, meta, - `*[${project.name}]* PR ${body.object_attributes.id} opened. No remove task created, reason: ${error}` + `*[${project.name}]* PR ${body.object_attributes.id} updated. No deploy task created, reason: ${error}` ) return;