From ac38be8a63f9f8f30a848eba92be72c1d4ff15ba Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Wed, 5 Oct 2022 08:50:51 +1100 Subject: [PATCH 1/3] stop allocating userActivityLogger to projects --- .../api/src/resources/backup/resolvers.ts | 40 +++---- .../api/src/resources/deployment/resolvers.ts | 78 +++++-------- .../resources/deploytargetconfig/resolvers.ts | 8 +- .../src/resources/env-variables/resolvers.ts | 8 +- .../src/resources/environment/resolvers.ts | 8 +- services/api/src/resources/file/resolvers.ts | 4 +- services/api/src/resources/group/resolvers.ts | 2 +- .../src/resources/notification/resolvers.ts | 2 +- .../api/src/resources/problem/resolvers.ts | 2 +- .../api/src/resources/project/resolvers.ts | 7 +- services/api/src/resources/task/resolvers.ts | 109 +++++++----------- .../task/task_definition_resolvers.ts | 14 ++- .../api/src/resources/workflow/resolvers.ts | 4 +- 13 files changed, 124 insertions(+), 162 deletions(-) diff --git a/services/api/src/resources/backup/resolvers.ts b/services/api/src/resources/backup/resolvers.ts index ca707ab199..6ac4d1f117 100644 --- a/services/api/src/resources/backup/resolvers.ts +++ b/services/api/src/resources/backup/resolvers.ts @@ -190,20 +190,18 @@ export const addBackup: ResolverFn = async ( pubSub.publish(EVENTS.BACKUP.ADDED, backup); - userActivityLogger( - `User deployed backup '${backupId}' to '${environment.name}' on project '${environment.project}'`, - { + userActivityLogger(`User deployed backup '${backupId}' to '${environment.name}' on project '${environment.project}'`, { + project: '', + event: 'api:addBackup', + payload: { + id, + environment, project: environment.project, - event: 'api:addBackup', - payload: { - id, - environment, - source, - backupId, - created - } + source, + backupId, + created } - ); + }); return backup; }; @@ -310,18 +308,16 @@ export const addRestore: ResolverFn = async ( project: projectData }; - userActivityLogger( - `User restored a backup '${backupId}' for project ${projectData.name}`, - { + userActivityLogger(`User restored a backup '${backupId}' for project ${projectData.name}`, { + project: '', + event: 'api:addRestore', + payload: { + restoreId: restoreData.id, project: projectData.name, - event: 'api:addRestore', - payload: { - restoreId: restoreData.id, - backupId, - data - } + backupId, + data } - ); + }); try { await createMiscTask({ key: 'restic:backup:restore', data }); diff --git a/services/api/src/resources/deployment/resolvers.ts b/services/api/src/resources/deployment/resolvers.ts index 3aa8509270..a785bc12d9 100644 --- a/services/api/src/resources/deployment/resolvers.ts +++ b/services/api/src/resources/deployment/resolvers.ts @@ -482,17 +482,14 @@ export const cancelDeployment: ResolverFn = async ( project }; - userActivityLogger( - `User cancelled deployment for '${deployment.environment}'`, - { - project: '', - event: 'api:cancelDeployment', - payload: { - deploymentInput, - data: data.build - } + userActivityLogger(`User cancelled deployment for '${deployment.environment}'`, { + project: '', + event: 'api:cancelDeployment', + payload: { + deploymentInput, + data: data.build } - ); + }); try { await createMiscTask({ key: 'build:cancel', data }); @@ -653,16 +650,13 @@ export const deployEnvironmentLatest: ResolverFn = async ( return `Error: Unknown deploy type ${environment.deployType}`; } - userActivityLogger( - `User triggered a deployment on '${deployData.projectName}' for '${environment.name}'`, - { - project: deployData.projectName || '', - event: 'api:deployEnvironmentLatest', - payload: { - deployData - } + userActivityLogger(`User triggered a deployment on '${deployData.projectName}' for '${environment.name}'`, { + project: '', + event: 'api:deployEnvironmentLatest', + payload: { + deployData } - ); + }); try { await taskFunction(deployData); @@ -755,16 +749,13 @@ export const deployEnvironmentBranch: ResolverFn = async ( branchName: deployData.branchName }; - userActivityLogger( - `User triggered a deployment on '${deployData.projectName}' for '${deployData.branchName}'`, - { - project: deployData.projectName || '', - event: 'api:deployEnvironmentBranch', - payload: { - deployData - } + userActivityLogger(`User triggered a deployment on '${deployData.projectName}' for '${deployData.branchName}'`, { + project: '', + event: 'api:deployEnvironmentBranch', + payload: { + deployData } - ); + }); try { await createDeployTask(deployData); @@ -868,16 +859,13 @@ export const deployEnvironmentPullrequest: ResolverFn = async ( pullrequestTitle: deployData.pullrequestTitle }; - userActivityLogger( - `User triggered a pull-request deployment on '${deployData.projectName}' for '${deployData.branchName}'`, - { - project: deployData.projectName || '', - event: 'api:deployEnvironmentPullrequest', - payload: { - deployData - } + userActivityLogger(`User triggered a pull-request deployment on '${deployData.projectName}' for '${deployData.branchName}'`, { + project: '', + event: 'api:deployEnvironmentPullrequest', + payload: { + deployData } - ); + }); try { await createDeployTask(deployData); @@ -992,16 +980,14 @@ export const deployEnvironmentPromote: ResolverFn = async ( promoteSourceEnvironment: deployData.promoteSourceEnvironment }; - userActivityLogger( - `User promoted the environment on '${deployData.projectName}' from '${deployData.promoteSourceEnvironment}' to '${deployData.branchName}'`, - { - project: deployData.projectName || '', - event: 'api:deployEnvironmentPromote', - payload: { - deployData - } + userActivityLogger(`User promoted the environment on '${deployData.projectName}' + from '${deployData.promoteSourceEnvironment}' to '${deployData.branchName}'`, { + project: '', + event: 'api:deployEnvironmentPromote', + payload: { + deployData } - ); + }); try { await createPromoteTask(deployData); diff --git a/services/api/src/resources/deploytargetconfig/resolvers.ts b/services/api/src/resources/deploytargetconfig/resolvers.ts index 76f8eec760..06ebe3c02a 100644 --- a/services/api/src/resources/deploytargetconfig/resolvers.ts +++ b/services/api/src/resources/deploytargetconfig/resolvers.ts @@ -152,7 +152,7 @@ export const updateEnvironmentDeployTarget: ResolverFn = async ( ).getProjectByEnvironmentId(environment); userActivityLogger(`User changed DeployTarget for environment`, { - project: projectObj.name, + project: '', event: 'api:updateEnvironmentDeployTarget', payload: { ...input @@ -212,7 +212,7 @@ export const addDeployTargetConfig: ResolverFn = async ( const rows = await query(sqlClientPool, Sql.selectDeployTargetConfigById(insertId)); userActivityLogger(`User added DeployTargetConfig`, { - project: input.name || '', + project: '', event: 'api:addDeployTargetConfig', payload: { ...input @@ -248,8 +248,8 @@ export const deleteDeployTargetConfig: ResolverFn = async ( } userActivityLogger(`User deleted DeployTargetConfig'`, { - project: project || '', - event: 'api:deleteEnvironment', + project: '', + event: 'api:deleteDeployTargetConfig', payload: { id, project, diff --git a/services/api/src/resources/env-variables/resolvers.ts b/services/api/src/resources/env-variables/resolvers.ts index df94442cd4..fb1f7877d3 100644 --- a/services/api/src/resources/env-variables/resolvers.ts +++ b/services/api/src/resources/env-variables/resolvers.ts @@ -91,13 +91,12 @@ const addEnvVariableToProject = async ( const rows = await query(sqlClientPool, Sql.selectEnvVariable(insertId)); - userActivityLogger(`User added environment variable to project '${typeId}'`, { + userActivityLogger(`User added environment variable '${name}' with scope '${scope}' to project '${typeId}'`, { project: '', event: 'api:addEnvVariableToProject', payload: { id, name, - value, scope, typeId } @@ -136,13 +135,12 @@ const addEnvVariableToEnvironment = async ( const rows = await query(sqlClientPool, Sql.selectEnvVariable(insertId)); - userActivityLogger(`User added environment variable to environment '${environment.name}' on '${environment.project}'`, { + userActivityLogger(`User added environment variable '${name}' with scope '${scope}' to environment '${environment.name}' on '${environment.project}'`, { project: '', event: 'api:addEnvVariableToEnvironment', payload: { id, name, - value, scope, typeId, environment @@ -165,7 +163,7 @@ export const deleteEnvVariable: ResolverFn = async ( await query(sqlClientPool, Sql.deleteEnvVariable(id)); - userActivityLogger(`User deleted environment variable`, { + userActivityLogger(`User deleted environment variable '${name}' with scope '${scope}'`, { project: '', event: 'api:deleteEnvVariable', payload: { diff --git a/services/api/src/resources/environment/resolvers.ts b/services/api/src/resources/environment/resolvers.ts index 040ea38940..6382b4ae0d 100644 --- a/services/api/src/resources/environment/resolvers.ts +++ b/services/api/src/resources/environment/resolvers.ts @@ -392,7 +392,7 @@ export const addOrUpdateEnvironment: ResolverFn = async ( const rows = await query(sqlClientPool, Sql.selectEnvironmentById(insertId)); userActivityLogger(`User updated environment`, { - project: projectOpenshift.name || '', + project: '', event: 'api:addOrUpdateEnvironment', payload: { ...input @@ -445,7 +445,7 @@ export const addOrUpdateEnvironmentStorage: ResolverFn = async ( const { name: projectName } = await projectHelpers(sqlClientPool).getProjectByEnvironmentId(environment['environment']); userActivityLogger(`User updated environment storage on project '${projectName}'`, { - project: projectName || '', + project: '', event: 'api:addOrUpdateEnvironmentStorage', payload: { projectName, @@ -557,7 +557,7 @@ export const deleteEnvironment: ResolverFn = async ( } userActivityLogger(`User deleted environment '${environment.name}' on project '${projectName}'`, { - project: data.projectName || '', + project: '', event: 'api:deleteEnvironment', payload: { projectName, @@ -634,7 +634,7 @@ export const updateEnvironment: ResolverFn = async ( const withK8s = Helpers(sqlClientPool).aliasOpenshiftToK8s(rows); userActivityLogger(`User updated environment '${curEnv.name}' on project '${curEnv.project}'`, { - project: curEnv.project || '', + project: '', event: 'api:updateEnvironment', payload: { openshiftProjectName, diff --git a/services/api/src/resources/file/resolvers.ts b/services/api/src/resources/file/resolvers.ts index 82bd793a3d..e8fad62391 100644 --- a/services/api/src/resources/file/resolvers.ts +++ b/services/api/src/resources/file/resolvers.ts @@ -67,8 +67,8 @@ export const uploadFilesForTask: ResolverFn = async ( const rows = await query(sqlClientPool, taskSql.selectTask(task)); - userActivityLogger( - `User uploaded files for task '${task}' on project '${R.path( + userActivityLogger(`User uploaded files for task '${task}' on project + '${R.path( ['0', 'pid'], rowsPerms )}'`, diff --git a/services/api/src/resources/group/resolvers.ts b/services/api/src/resources/group/resolvers.ts index 88b4361921..d123ef8ad4 100644 --- a/services/api/src/resources/group/resolvers.ts +++ b/services/api/src/resources/group/resolvers.ts @@ -431,7 +431,7 @@ export const addGroupsToProject: ResolverFn = async ( } userActivityLogger(`User synced groups to a project`, { - project: project.name || '', + project: '', event: 'api:addGroupsToProject', payload: { input: { diff --git a/services/api/src/resources/notification/resolvers.ts b/services/api/src/resources/notification/resolvers.ts index 8cea3a4254..adcbc72ea2 100644 --- a/services/api/src/resources/notification/resolvers.ts +++ b/services/api/src/resources/notification/resolvers.ts @@ -108,7 +108,7 @@ export const addNotificationToProject: ResolverFn = async ( userActivityLogger(`User added a notification to project '${pid}'`, { - project: input.project || '', + project: '', event: 'api:addNotificationToProject', payload: { projectNotification diff --git a/services/api/src/resources/problem/resolvers.ts b/services/api/src/resources/problem/resolvers.ts index 69d51bc589..569c299d7a 100644 --- a/services/api/src/resources/problem/resolvers.ts +++ b/services/api/src/resources/problem/resolvers.ts @@ -303,7 +303,7 @@ export const addProblemHarborScanMatch: ResolverFn = async ( ); userActivityLogger(`User added harbor scan regex matcher`, { - project: defaultLagoonProject || '', + project: '', event: 'api:addProblemHarborScanMatch', payload: { input: { diff --git a/services/api/src/resources/project/resolvers.ts b/services/api/src/resources/project/resolvers.ts index 318c027090..1be960c6ba 100644 --- a/services/api/src/resources/project/resolvers.ts +++ b/services/api/src/resources/project/resolvers.ts @@ -424,7 +424,7 @@ export const addProject = async ( } userActivityLogger(`User added a project '${project.name}'`, { - project: project.name, + project: '', event: 'api:addProject', payload: { input, @@ -496,7 +496,7 @@ export const deleteProject: ResolverFn = async ( // } userActivityLogger(`User deleted a project '${project.name}'`, { - project: project.name, + project: '', event: 'api:deleteProject', payload: { input: { @@ -714,9 +714,10 @@ export const updateProject: ResolverFn = async ( // } userActivityLogger(`User updated project '${oldProject.name}'`, { - project: oldProject.name, + project: '', event: 'api:updateProject', payload: { + project: oldProject.name, patch: { name, gitUrl, diff --git a/services/api/src/resources/task/resolvers.ts b/services/api/src/resources/task/resolvers.ts index 4d60eb466c..32345f87f6 100644 --- a/services/api/src/resources/task/resolvers.ts +++ b/services/api/src/resources/task/resolvers.ts @@ -413,16 +413,13 @@ TOKEN="$(ssh -p $TASK_SSH_PORT -t lagoon@$TASK_SSH_HOST token)" && curl -sS "$TA -F 0=@$file; rm -rf $file; `; - userActivityLogger( - `User triggered a Drush Archive Dump task on environment '${environmentId}'`, - { - project: '', - event: 'api:taskDrushArchiveDump', - payload: { - environment: environmentId - } + userActivityLogger(`User triggered a Drush Archive Dump task on environment '${environmentId}'`, { + project: '', + event: 'api:taskDrushArchiveDump', + payload: { + environment: environmentId } - ); + }); const taskData = await Helpers(sqlClientPool).addTask({ name: 'Drush archive-dump', @@ -462,16 +459,13 @@ TOKEN="$(ssh -p $TASK_SSH_PORT -t lagoon@$TASK_SSH_HOST token)" && curl -sS "$TA -F 0=@$file.gz; rm -rf $file.gz `; - userActivityLogger( - `User triggered a Drush SQL Dump task on environment '${environmentId}'`, - { - project: '', - event: 'api:taskDrushSqlDump', - payload: { - environment: environmentId - } + userActivityLogger(`User triggered a Drush SQL Dump task on environment '${environmentId}'`, { + project: '', + event: 'api:taskDrushSqlDump', + payload: { + environment: environmentId } - ); + }); const taskData = await Helpers(sqlClientPool).addTask({ name: 'Drush sql-dump', @@ -513,16 +507,13 @@ export const taskDrushCacheClear: ResolverFn = async ( exit 1; \ fi'; - userActivityLogger( - `User triggered a Drush cache clear task on environment '${environmentId}'`, - { - project: '', - event: 'api:taskDrushCacheClear', - payload: { - environment: environmentId - } + userActivityLogger(`User triggered a Drush cache clear task on environment '${environmentId}'`, { + project: '', + event: 'api:taskDrushCacheClear', + payload: { + environment: environmentId } - ); + }); const taskData = await Helpers(sqlClientPool).addTask({ name: 'Drush cache-clear', @@ -553,16 +544,13 @@ export const taskDrushCron: ResolverFn = async ( project: envPerm.project }); - userActivityLogger( - `User triggered a Drush cron task on environment '${environmentId}'`, - { - project: '', - event: 'api:taskDrushCron', - payload: { - environment: environmentId - } + userActivityLogger(`User triggered a Drush cron task on environment '${environmentId}'`, { + project: '', + event: 'api:taskDrushCron', + payload: { + environment: environmentId } - ); + }); const taskData = await Helpers(sqlClientPool).addTask({ name: 'Drush cron', @@ -619,17 +607,14 @@ export const taskDrushSqlSync: ResolverFn = async ( } ); - userActivityLogger( - `User triggered a Drush SQL sync task from '${sourceEnvironmentId}' to '${destinationEnvironmentId}'`, - { - project: '', - event: 'api:taskDrushSqlSync', - payload: { - sourceEnvironment: sourceEnvironmentId, - destinationEnvironment: destinationEnvironmentId - } + userActivityLogger(`User triggered a Drush SQL sync task from '${sourceEnvironmentId}' to '${destinationEnvironmentId}'`, { + project: '', + event: 'api:taskDrushSqlSync', + payload: { + sourceEnvironment: sourceEnvironmentId, + destinationEnvironment: destinationEnvironmentId } - ); + }); const command = `LAGOON_ALIAS_PREFIX="" && \ @@ -691,17 +676,14 @@ export const taskDrushRsyncFiles: ResolverFn = async ( } ); - userActivityLogger( - `User triggered an rsync sync task from '${sourceEnvironmentId}' to '${destinationEnvironmentId}'`, - { - project: '', - event: 'api:taskDrushRsyncFiles', - payload: { - sourceEnvironment: sourceEnvironmentId, - destinationEnvironment: destinationEnvironmentId - } + userActivityLogger(`User triggered an rsync sync task from '${sourceEnvironmentId}' to '${destinationEnvironmentId}'`, { + project: '', + event: 'api:taskDrushRsyncFiles', + payload: { + sourceEnvironment: sourceEnvironmentId, + destinationEnvironment: destinationEnvironmentId } - ); + }); const command = `LAGOON_ALIAS_PREFIX="" && \ @@ -737,16 +719,13 @@ export const taskDrushUserLogin: ResolverFn = async ( project: envPerm.project }); - userActivityLogger( - `User triggered a Drush user login task on '${environmentId}'`, - { - project: '', - event: 'api:taskDrushUserLogin', - payload: { - environment: environmentId - } + userActivityLogger(`User triggered a Drush user login task on '${environmentId}'`, { + project: '', + event: 'api:taskDrushUserLogin', + payload: { + environment: environmentId } - ); + }); const taskData = await Helpers(sqlClientPool).addTask({ name: 'Drush uli', diff --git a/services/api/src/resources/task/task_definition_resolvers.ts b/services/api/src/resources/task/task_definition_resolvers.ts index 1d67c17a4b..31ed9c37a8 100644 --- a/services/api/src/resources/task/task_definition_resolvers.ts +++ b/services/api/src/resources/task/task_definition_resolvers.ts @@ -333,12 +333,13 @@ export const addAdvancedTaskDefinition = async ( } userActivityLogger(`User added advanced task definition '${name}'`, { + project: '', + event: 'api:addTaskDefinition', + payload: { project: project, - event: 'api:updateTaskDefinition', - payload: { - taskDef: insertId - } - }); + taskDef: insertId + } + }); return await atb.advancedTaskDefinitionById( insertId @@ -428,9 +429,10 @@ export const updateAdvancedTaskDefinition = async ( } userActivityLogger(`User updated advanced task definition '${id}'`, { - project: task.project, + project: '', event: 'api:updateTaskDefinition', payload: { + project: task.project, taskDef: id } }); diff --git a/services/api/src/resources/workflow/resolvers.ts b/services/api/src/resources/workflow/resolvers.ts index 6d1ae17bf1..a6fe9f9c1b 100644 --- a/services/api/src/resources/workflow/resolvers.ts +++ b/services/api/src/resources/workflow/resolvers.ts @@ -52,7 +52,7 @@ export const addWorkflow: ResolverFn = async ( ); userActivityLogger(`User added a workflow '${insertId}'`, { - project: input.project || '', + project: '', event: 'api:addWorkflow', payload: { data: { @@ -109,7 +109,7 @@ export const updateWorkflow: ResolverFn = async ( ); userActivityLogger(`User updated a workflow '${id}'`, { - project: project || '', + project: '', event: 'api:updateWorkflow', payload: { id: id, From 3da9594e86471bc190aa43400b62134a89d31b64 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Wed, 5 Oct 2022 08:51:25 +1100 Subject: [PATCH 2/3] use meta instead of data for PRs --- .../webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.ts | 2 +- services/webhooks2tasks/src/handlers/giteaPullRequestOpened.ts | 2 +- .../webhooks2tasks/src/handlers/giteaPullRequestSynchronize.ts | 2 +- services/webhooks2tasks/src/handlers/githubPullRequestOpened.ts | 2 +- .../webhooks2tasks/src/handlers/githubPullRequestSynchronize.ts | 2 +- services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.ts | 2 +- .../webhooks2tasks/src/handlers/gitlabPullRequestUpdated.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.ts b/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.ts index 815e2603be..85ba559594 100644 --- a/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.ts +++ b/services/webhooks2tasks/src/handlers/bitbucketPullRequestUpdated.ts @@ -59,7 +59,7 @@ export async function bitbucketPullRequestUpdated(webhook: WebhookRequestData, p try { await createDeployTask(data); - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, data, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, meta, `*[${project.name}]* PR <${body.pullrequest.destination.repository.links.html.href}|#${body.pullrequest.id} (${body.title})> updated in <${body.pullrequest.destination.repository.links.html.href}|${body.pullrequest.destination.branch.name}>` ) return; diff --git a/services/webhooks2tasks/src/handlers/giteaPullRequestOpened.ts b/services/webhooks2tasks/src/handlers/giteaPullRequestOpened.ts index 103493cc44..edb75d5772 100644 --- a/services/webhooks2tasks/src/handlers/giteaPullRequestOpened.ts +++ b/services/webhooks2tasks/src/handlers/giteaPullRequestOpened.ts @@ -59,7 +59,7 @@ export async function giteaPullRequestOpened(webhook: WebhookRequestData, projec try { await createDeployTask(data); - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, data, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, meta, `*[${project.name}]* PR <${body.pull_request.html_url}|#${body.number} (${body.pull_request.title})> opened in <${body.repository.html_url}|${body.repository.full_name}>` ) return; diff --git a/services/webhooks2tasks/src/handlers/giteaPullRequestSynchronize.ts b/services/webhooks2tasks/src/handlers/giteaPullRequestSynchronize.ts index 2d607d4d3c..0f8d5e94c9 100644 --- a/services/webhooks2tasks/src/handlers/giteaPullRequestSynchronize.ts +++ b/services/webhooks2tasks/src/handlers/giteaPullRequestSynchronize.ts @@ -77,7 +77,7 @@ export async function giteaPullRequestSynchronize(webhook: WebhookRequestData, p try { await createDeployTask(data); - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:synchronize:handled`, data, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:synchronize:handled`, meta, `*[${project.name}]* PR <${body.pull_request.html_url}|#${body.number} (${body.pull_request.title})> updated in <${body.repository.html_url}|${body.repository.full_name}>` ) return; diff --git a/services/webhooks2tasks/src/handlers/githubPullRequestOpened.ts b/services/webhooks2tasks/src/handlers/githubPullRequestOpened.ts index c168eebde2..ceaece2df6 100644 --- a/services/webhooks2tasks/src/handlers/githubPullRequestOpened.ts +++ b/services/webhooks2tasks/src/handlers/githubPullRequestOpened.ts @@ -59,7 +59,7 @@ export async function githubPullRequestOpened(webhook: WebhookRequestData, proje try { await createDeployTask(data); - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, data, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, meta, `*[${project.name}]* PR <${body.pull_request.html_url}|#${body.number} (${body.pull_request.title})> opened in <${body.repository.html_url}|${body.repository.full_name}>` ) return; diff --git a/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.ts b/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.ts index 8a64a34379..c4b1be2aa0 100644 --- a/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.ts +++ b/services/webhooks2tasks/src/handlers/githubPullRequestSynchronize.ts @@ -77,7 +77,7 @@ export async function githubPullRequestSynchronize(webhook: WebhookRequestData, try { await createDeployTask(data); - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:synchronize:handled`, data, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:synchronize:handled`, meta, `*[${project.name}]* PR <${body.pull_request.html_url}|#${body.number} (${body.pull_request.title})> updated in <${body.repository.html_url}|${body.repository.full_name}>` ) return; diff --git a/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.ts b/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.ts index 9d8021c053..f9d42819db 100644 --- a/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.ts +++ b/services/webhooks2tasks/src/handlers/gitlabPullRequestOpened.ts @@ -59,7 +59,7 @@ export async function gitlabPullRequestOpened(webhook: WebhookRequestData, proje try { await createDeployTask(data); - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, data, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:opened:handled`, meta, `*[${project.name}]* PR <${body.object_attributes.url}|#${body.object_attributes.iid} (${body.object_attributes.title})> opened in <${body.object_attributes.target.web_url}|${body.object_attributes.target.name}>` ) return; diff --git a/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.ts b/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.ts index 57b25c17cd..04d37c4ef8 100644 --- a/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.ts +++ b/services/webhooks2tasks/src/handlers/gitlabPullRequestUpdated.ts @@ -60,7 +60,7 @@ export async function gitlabPullRequestUpdated(webhook: WebhookRequestData, proj try { await createDeployTask(data); // gitlab does not identify well that this is an update to a merge request, so we manually set the event type here. - sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:updated:handled`, data, + sendToLagoonLogs('info', project.name, uuid, `${webhooktype}:${event}:updated:handled`, meta, `*[${project.name}]* PR <${body.object_attributes.url}|#${body.object_attributes.iid} (${body.object_attributes.title})> updated in <${body.object_attributes.target.web_url}|${body.object_attributes.target.name}>` ) return; From 531fb7be754c4bd01f5c65f435546de53ea60ea9 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Wed, 5 Oct 2022 09:55:33 +1100 Subject: [PATCH 3/3] remove name and scope from EV delete --- services/api/src/resources/env-variables/resolvers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/api/src/resources/env-variables/resolvers.ts b/services/api/src/resources/env-variables/resolvers.ts index fb1f7877d3..0e851271e7 100644 --- a/services/api/src/resources/env-variables/resolvers.ts +++ b/services/api/src/resources/env-variables/resolvers.ts @@ -163,7 +163,7 @@ export const deleteEnvVariable: ResolverFn = async ( await query(sqlClientPool, Sql.deleteEnvVariable(id)); - userActivityLogger(`User deleted environment variable '${name}' with scope '${scope}'`, { + userActivityLogger(`User deleted environment variable`, { project: '', event: 'api:deleteEnvVariable', payload: {