Skip to content

Commit d71bc4b

Browse files
authored
fix(nvd): Allow num worker to be set in kubernetes for nvd conversion (#4751)
1 parent c759b42 commit d71bc4b

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

deployment/clouddeploy/gke-workers/environments/oss-vdb-test/nvd-cve-osv.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ spec:
1818
value: gs://osv-test-cve-osv-conversion/cpe_repos/cpe_product_to_repo.json
1919
- name: OSV_OUTPUT_GCS_PATH
2020
value: gs://osv-test-cve-osv-conversion/nvd-osv
21+
- name: NUM_WORKERS
22+
value: "10"

deployment/clouddeploy/gke-workers/environments/oss-vdb/nvd-cve-osv.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ spec:
1818
value: gs://cve-osv-conversion/cpe_repos/cpe_product_to_repo.json
1919
- name: OSV_OUTPUT_GCS_PATH
2020
value: gs://cve-osv-conversion/nvd-osv
21+
- name: NUM_WORKERS
22+
value: "10"

vulnfeeds/cmd/converters/cve/nvd-cve-osv/run_cve_to_osv_generation.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ gcloud --no-user-output-enabled storage -q cp "${CPEREPO_GCS_PATH}" "${WORK_DIR}
4343

4444
mkdir -p "${WORK_DIR}/nvd2osv/gcs_stage"
4545

46+
NUM_WORKERS="${NUM_WORKERS:=10}"
47+
4648
# Convert NVD CVE records to OSV.
4749

4850
for (( YEAR = $(date +%Y) ; YEAR >= ${FIRST_INSCOPE_YEAR} ; YEAR-- )); do
@@ -52,7 +54,8 @@ for (( YEAR = $(date +%Y) ; YEAR >= ${FIRST_INSCOPE_YEAR} ; YEAR-- )); do
5254
--cpe-repos "${WORK_DIR}/cpe_product_to_repo.json" \
5355
--nvd-json "${WORK_DIR}/nvd/nvdcve-2.0-${YEAR}.json" \
5456
--out-dir "${WORK_DIR}/nvd2osv/${YEAR}" \
55-
--out-format OSV
57+
--out-format OSV \
58+
--workers "${NUM_WORKERS}"
5659

5760
# Copy results to staging area.
5861
echo "Copying NVD CVE records from ${YEAR} successfully converted to OSV to aggregated staging"

0 commit comments

Comments
 (0)