Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Drutiny integration #3197

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion services/webhooks2tasks/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion services/webhooks2tasks/src/webhooks/problems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down