Skip to content

Commit fef18a7

Browse files
committed
Migrate azure monitor hook to esm and task
1 parent 4d9a8a6 commit fef18a7

9 files changed

Lines changed: 11 additions & 6295 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ jobs:
575575
hook:
576576
- cascading-scans
577577
- generic-webhook
578-
# - persistence-azure-monitor
578+
- persistence-azure-monitor
579579
# - persistence-elastic # Fails on the CI due to insufficient cpu as mentioned in issue #1165
580580
# - persistence-dependencytrack
581581
# - update-field-hook
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: "3"
2+
3+
includes:
4+
hook:
5+
taskfile: ../Taskfile.yaml
6+
flatten: true
7+
vars:
8+
hookName: persistence-azure-monitor

hooks/persistence-azure-monitor/hook/Dockerfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44

55
ARG baseImageTag
66
ARG namespace
7-
FROM node:22-alpine AS build
8-
RUN mkdir -p /home/app
9-
WORKDIR /home/app
10-
COPY package.json package-lock.json ./
11-
RUN npm ci --omit=dev
127

138
FROM ${namespace:-securecodebox}/hook-sdk-nodejs:${baseImageTag:-latest}
149
WORKDIR /home/app/hook-wrapper/hook/
15-
COPY --from=build --chown=root:root --chmod=755 /home/app/node_modules/ ./node_modules/
1610
COPY --chown=root:root --chmod=755 ./hook.js ./hook.js

hooks/persistence-azure-monitor/hook/hook.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Fixed settings for the script
66
const monitorApiVersion = "2016-04-01";
77

8-
async function handle({
8+
export async function handle({
99
getFindings,
1010
scan,
1111
workspaceId = process.env["MONITOR_WORKSPACE_ID"],
@@ -106,4 +106,3 @@ async function handle({
106106
},
107107
);
108108
}
109-
module.exports.handle = handle;

hooks/persistence-azure-monitor/hook/hook.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ process.env["MONITOR_WORKSPACE_ID"] = "123123";
66
process.env["MONITOR_SHARED_KEY"] = "aGVsbG8taS1hbS1hLXRlc3Qta2V5";
77
process.env["MONITOR_LOGTYPE_PREFIX"] = "SCB";
88

9-
const { handle } = require("./hook");
9+
import { handle } from "./hook";
1010

1111
// Mock the fetch function
1212
const fetch = jest.fn(

0 commit comments

Comments
 (0)