diff --git a/services/webhooks2tasks/Dockerfile b/services/webhooks2tasks/Dockerfile index 3b3d677f87..fe6730b0dc 100644 --- a/services/webhooks2tasks/Dockerfile +++ b/services/webhooks2tasks/Dockerfile @@ -2,16 +2,18 @@ ARG LAGOON_GIT_BRANCH ARG IMAGE_REPO ARG UPSTREAM_REPO ARG UPSTREAM_TAG -ARG ENABLE_DEPRECATED_TRIVY_INTEGRATION=false # STAGE 1: Loading Image lagoon-node-packages-builder which contains node packages shared by all Node Services FROM ${IMAGE_REPO:-lagoon}/yarn-workspace-builder as yarn-workspace-builder # STAGE 2: specific service Image FROM ${UPSTREAM_REPO:-uselagoon}/node-20:${UPSTREAM_TAG:-latest} +ARG ENABLE_DEPRECATED_TRIVY_INTEGRATION="false" +ARG ENABLE_DEPRECATED_DRUTINY_INTEGRATION="false" ARG LAGOON_VERSION ENV LAGOON_VERSION=$LAGOON_VERSION ENV ENABLE_DEPRECATED_TRIVY_INTEGRATION=$ENABLE_DEPRECATED_TRIVY_INTEGRATION +ENV ENABLE_DEPRECATED_DRUTINY_INTEGRATION=$ENABLE_DEPRECATED_DRUTINY_INTEGRATION # Copying generated node_modules from the first stage COPY --from=yarn-workspace-builder /app /app diff --git a/services/webhooks2tasks/src/webhooks/problems.ts b/services/webhooks2tasks/src/webhooks/problems.ts index f52188c124..3939bb4e3f 100644 --- a/services/webhooks2tasks/src/webhooks/problems.ts +++ b/services/webhooks2tasks/src/webhooks/problems.ts @@ -22,6 +22,17 @@ const enableHarborIntegration = (() => { return false; })(); + +// NOTE: Here we are going through the process of deprecating the Drutiny webhook +const enableDrutinyIntegration = (() => { + if(process.env.ENABLE_DEPRECATED_DRUTINY_INTEGRATION && process.env.ENABLE_DEPRECATED_DRUTINY_INTEGRATION == "true") { + console.log("ENABLE_DEPRECATED_DRUTINY_INTEGRATION is 'true' -- enabling Drutiny webhook"); + return true; + } + console.log("ENABLE_DEPRECATED_DRUTINY_INTEGRATION is not 'true' -- Drutiny webhook integration is not enabled"); + return false; +})(); + export async function processProblems( rabbitMsg, channelWrapperWebhooks @@ -51,7 +62,12 @@ export async function processProblems( } break; case 'drutiny:resultset' : - await handle(processDrutinyResultset, webhook, `${webhooktype}:${event}`, channelWrapperWebhooks); + if(enableDrutinyIntegration == true) { + console.log("NOTE: Drutiny webhook integration for Problems is deprecated and will be removed from Lagoon in an upcoming release"); + await handle(processDrutinyResultset, webhook, `${webhooktype}:${event}`, channelWrapperWebhooks); + } else { + console.log("NOTE: Drutiny webhook scan recieved but not processed because Drutiny webhook integration is disabled"); + } break; } channelWrapperWebhooks.ack(rabbitMsg);