Skip to content

Commit d0c40c2

Browse files
authored
feat(cron): dockerfile and cron job for CVEList conversion (#3906)
merge this after #3905
1 parent 897d3b4 commit d0c40c2

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

deployment/build-and-stage.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,20 @@ steps:
180180
args: ['push', '--all-tags', 'gcr.io/oss-vdb/combine-to-osv']
181181
waitFor: ['build-combine-to-osv', 'cloud-build-queue']
182182

183+
- name: 'gcr.io/cloud-builders/docker'
184+
entrypoint: 'bash'
185+
args: ['-c', 'docker pull gcr.io/oss-vdb/cve5-to-osv:latest || exit 0']
186+
id: 'pull-cve5-to-osv'
187+
waitFor: ['setup']
188+
- name: gcr.io/cloud-builders/docker
189+
args: ['build', '-t', 'gcr.io/oss-vdb/cve5-to-osv:latest', '-t', 'gcr.io/oss-vdb/cve5-to-osv:$COMMIT_SHA', '-f', 'cmd/cve-bulk-converter/Dockerfile', '--cache-from', 'gcr.io/oss-vdb/cve5-to-osv:latest', '--pull', '.']
190+
dir: 'vulnfeeds'
191+
id: 'build-cve5-to-osv'
192+
waitFor: ['pull-cve5-to-osv']
193+
- name: gcr.io/cloud-builders/docker
194+
args: ['push', '--all-tags', 'gcr.io/oss-vdb/cve5-to-osv']
195+
waitFor: ['build-cve5-to-osv', 'cloud-build-queue']
196+
183197
# Build/push indexer image
184198
- name: 'gcr.io/cloud-builders/docker'
185199
entrypoint: 'bash'
@@ -301,7 +315,8 @@ steps:
301315
cpe-repo-gen=gcr.io/oss-vdb/cpe-repo-gen:$COMMIT_SHA,\
302316
nvd-cve-osv=gcr.io/oss-vdb/nvd-cve-osv:$COMMIT_SHA,\
303317
nvd-mirror=gcr.io/oss-vdb/nvd-mirror:$COMMIT_SHA,\
304-
recoverer=gcr.io/oss-vdb/recoverer:$COMMIT_SHA"
318+
recoverer=gcr.io/oss-vdb/recoverer:$COMMIT_SHA,\
319+
cve5-to-osv=gcr.io/oss-vdb/cve5-to-osv:$COMMIT_SHA"
305320
]
306321
dir: deployment/clouddeploy/gke-workers
307322

@@ -358,3 +373,4 @@ images:
358373
- 'gcr.io/oss-vdb-test/staging-api-test:$COMMIT_SHA'
359374
- 'gcr.io/oss-vdb-test/osv-linter:$COMMIT_SHA'
360375
- 'gcr.io/oss-vdb/recoverer:$COMMIT_SHA'
376+
- 'gcr.io/oss-vdb/cve5-to-osv:$COMMIT_SHA'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: batch/v1
2+
kind: CronJob
3+
metadata:
4+
name: cve5-to-osv
5+
labels:
6+
cronLastSuccessfulTimeMins: "2160"
7+
spec:
8+
timeZone: Australia/Sydney
9+
schedule: "0 6,13 * * *"
10+
concurrencyPolicy: Forbid
11+
jobTemplate:
12+
spec:
13+
activeDeadlineSeconds: 86400
14+
template:
15+
spec:
16+
containers:
17+
- name: cve5-to-osv
18+
image: cve5-to-osv
19+
imagePullPolicy: Always
20+
securityContext:
21+
privileged: true
22+
resources:
23+
requests:
24+
cpu: "1"
25+
memory: "2G"
26+
limits:
27+
cpu: "1"
28+
memory: "4G"
29+
env:
30+
- name: WORK_DIR
31+
value: /tmp
32+
restartPolicy: Never
33+
volumes:
34+
- name: "ssd"
35+
hostPath:
36+
path: "/mnt/disks/ssd0"

deployment/clouddeploy/gke-workers/environments/oss-vdb-test/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ resources:
22
- ../../base
33
- staging-api-test.yaml
44
- osv-linter.yaml
5+
- cve5-to-osv.yaml
56
patches:
67
- path: workers.yaml
78
- path: scaler.yaml
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM golang:1.25.0-alpine@sha256:f18a072054848d87a8077455f0ac8a25886f2397f88bfdd222d6fafbb5bba440 AS go_build
16+
17+
WORKDIR /go/src
18+
19+
COPY go.mod go.sum ./
20+
RUN go mod download && go mod verify
21+
22+
COPY . .
23+
RUN CGO_ENABLED=0 go build -v -o /usr/local/bin ./cmd/cve-bulk-converter
24+
25+
FROM gcr.io/google.com/cloudsdktool/google-cloud-cli:alpine@sha256:f2b7bf7556ac1d266c3b4563507d3c7aec1464ec3f6d3cbd114f01011d02f1c3
26+
RUN apk --no-cache add jq
27+
28+
COPY --from=go_build /usr/local/bin/cve-bulk-converter ./usr/local/bin/cve-bulk-converter
29+
COPY --from=go_build /go/src/cmd/cve-bulk-converter/run-cvelist-converter.sh ./usr/local/bin/cve-bulk-converter
30+
31+
CMD ["/usr/local/bin/run_cvelist-converter.sh"]

0 commit comments

Comments
 (0)