Skip to content

Commit 0f79e0b

Browse files
committed
fix: global PVTR_VERSION arg and structured error fields in runBinary
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
1 parent 5924bdd commit 0f79e0b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

scripts/services/docker/Dockerfile.security_best_practices_worker

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
ARG PVTR_VERSION=v0.23.2
2+
13
FROM alpine:3.21 AS core
24
RUN apk add --no-cache wget tar unzip
35

@@ -12,7 +14,7 @@ FROM golang:1.26.3-alpine3.23 AS plugin
1214
RUN apk add --no-cache make git
1315
WORKDIR /plugin
1416
ARG PVTR_COMMIT=c7bd9538d64f7eaab94a05c9b5fd05458a387b1c
15-
ARG PVTR_VERSION=v0.23.2
17+
ARG PVTR_VERSION
1618
# To run the latest version of the plugin, we need to use the latest commit of the pvtr-github-repo-scanner repository.
1719
# Currently using v0.23.2: https://github.com/ossf/pvtr-github-repo-scanner/commit/c7bd9538d64f7eaab94a05c9b5fd05458a387b1c
1820
RUN git clone https://github.com/ossf/pvtr-github-repo-scanner.git && cd pvtr-github-repo-scanner && git checkout ${PVTR_COMMIT}
@@ -36,7 +38,7 @@ FROM node:20-bookworm-slim as runner
3638
RUN mkdir -p /.privateer/bin
3739
WORKDIR /.privateer/bin
3840
COPY --from=core /app/pvtr ./privateer
39-
ARG PVTR_VERSION=v0.23.2
41+
ARG PVTR_VERSION
4042
COPY --from=plugin /plugin/github-repo /root/.privateer/bin/github-repo
4143
RUN echo "{\"plugins\":[{\"name\":\"github-repo\",\"version\":\"${PVTR_VERSION}\",\"binaryPath\":\"github-repo\"}]}" > /root/.privateer/bin/plugins.json
4244
COPY ./services/apps/security_best_practices_worker/example-config.yml /.privateer/example-config.yml

services/apps/security_best_practices_worker/src/activities/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,13 @@ async function runBinary(
226226
resolve({ stdout, stderr })
227227
} else {
228228
const truncated = (s: string) => (s.length > 500 ? s.slice(0, 500) + '…' : s)
229-
reject(
229+
const err = Object.assign(
230230
new Error(
231-
`Binary exited with code ${code}\nStderr:\n${truncated(stderr)}Stdout:\n${truncated(stdout)}`,
231+
`Binary exited with code ${code}\nStderr:\n${truncated(stderr)}\nStdout:\n${truncated(stdout)}`,
232232
),
233+
{ stdout, stderr },
233234
)
235+
reject(err)
234236
}
235237
})
236238
})

0 commit comments

Comments
 (0)