Skip to content

Commit ba257af

Browse files
committed
Release: 1.5.0
1 parent 2464d8c commit ba257af

File tree

8 files changed

+98
-14
lines changed

8 files changed

+98
-14
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ runs:
4444
steps:
4545
- name: Evaluate
4646
id: evaluate
47-
uses: sonatype/actions/evaluate@v1.4.3
47+
uses: sonatype/actions/evaluate@v1.5.0
4848
with:
4949
iq-server-url: ${{ inputs.iq-server-url }}
5050
username: ${{ inputs.username }}

evaluate/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ runs:
139139
steps:
140140
- name: Setup IQ CLI Action
141141
id: setup-iq-cli
142-
uses: sonatype/actions/setup-iq-cli@v1.4.3
142+
uses: sonatype/actions/setup-iq-cli@v1.5.0
143143
with:
144144
iq-cli-version: 'latest'
145145

@@ -150,7 +150,7 @@ runs:
150150

151151
- name: Run IQ CLI Action
152152
id: run-iq-cli
153-
uses: sonatype/actions/run-iq-cli@v1.4.3
153+
uses: sonatype/actions/run-iq-cli@v1.5.0
154154
with:
155155
iq-cli-version: ${{ steps.setup-iq-cli.outputs.iq-cli-version }}
156156
username: ${{ inputs.username }}

fetch-sbom/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171

7272
> **sbom-version**\
7373
> The version of the SBOM standard.\
74-
> Available CycloneDX versions: `1.2`, `1.3`, `1.4`, `1.5`, `1.6` (1.6 as default value). Available SPDX versions: `2.3`
74+
> Available CycloneDX versions: `1.2`, `1.3`, `1.4`, `1.5`, `1.6` (1.6 as default value). Available SPDX versions: `2.2 and 2.3`
7575
> (2.3 as default value). `Optional`
7676

7777
> **sbom-format**\

fetch-sbom/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ inputs:
3232
sbom-version:
3333
description:
3434
'The version of the SBOM (- Available CycloneDX Versions: 1.2, 1.3, 1.4, 1.5, 1.6. Default version for CycloneDX
35-
is 1.6 - Available SPDX version: 2.3)'
35+
is 1.6 - Available SPDX versions: 2.2, 2.3, Default for SPDX is 2.3)'
3636
required: false
3737
artifact-name:
3838
description: 'The name of the artifact to be uploaded.'

fetch-sbom/dist/cleanup/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25066,6 +25066,16 @@ function getAndValidateInputs() {
2506625066
if (!validStandards.includes(sbomStandard)) {
2506725067
throw new Error(`Invalid SBOM standard: ${sbomStandard}. Valid options are SPDX or CycloneDX.`);
2506825068
}
25069+
if (sbomVersion) {
25070+
const supportedCycloneDxVersions = ['1.2', '1.3', '1.4', '1.5', '1.6'];
25071+
if (sbomStandard.toLowerCase() === constants_1.CYCLONEDX_FORMAT && !supportedCycloneDxVersions.includes(sbomVersion)) {
25072+
throw new Error(`Supported versions for CycloneDX is: ${supportedCycloneDxVersions}`);
25073+
}
25074+
const supportedSpdxVersions = ['2.2', '2.3'];
25075+
if (sbomStandard.toLowerCase() === constants_1.SPDX_FORMAT && !supportedSpdxVersions.includes(sbomVersion)) {
25076+
throw new Error(`Supported versions for SPDX is: ${supportedSpdxVersions}`);
25077+
}
25078+
}
2506925079
if (sbomStandard?.toLowerCase() === constants_1.CYCLONEDX_FORMAT && !sbomVersion) {
2507025080
sbomVersion = constants_1.CYCLONEDX_16_VERSION;
2507125081
}

fetch-sbom/dist/main/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119182,6 +119182,16 @@ function getAndValidateInputs() {
119182119182
if (!validStandards.includes(sbomStandard)) {
119183119183
throw new Error(`Invalid SBOM standard: ${sbomStandard}. Valid options are SPDX or CycloneDX.`);
119184119184
}
119185+
if (sbomVersion) {
119186+
const supportedCycloneDxVersions = ['1.2', '1.3', '1.4', '1.5', '1.6'];
119187+
if (sbomStandard.toLowerCase() === constants_1.CYCLONEDX_FORMAT && !supportedCycloneDxVersions.includes(sbomVersion)) {
119188+
throw new Error(`Supported versions for CycloneDX is: ${supportedCycloneDxVersions}`);
119189+
}
119190+
const supportedSpdxVersions = ['2.2', '2.3'];
119191+
if (sbomStandard.toLowerCase() === constants_1.SPDX_FORMAT && !supportedSpdxVersions.includes(sbomVersion)) {
119192+
throw new Error(`Supported versions for SPDX is: ${supportedSpdxVersions}`);
119193+
}
119194+
}
119185119195
if (sbomStandard?.toLowerCase() === constants_1.CYCLONEDX_FORMAT && !sbomVersion) {
119186119196
sbomVersion = constants_1.CYCLONEDX_16_VERSION;
119187119197
}
@@ -143692,7 +143702,7 @@ module.exports = index;
143692143702
/***/ ((module) => {
143693143703

143694143704
"use strict";
143695-
module.exports = JSON.parse('{"name":"fetch-sbom","description":"GitHub Action for obtaining an SBOM","version":"1.4.3","author":"sonatype","private":true,"homepage":"https://github.com/sonatype/actions/fetch-sbom","repository":{"type":"git","url":"git+https://github.com/sonatype/actions/fetch-sbom.git"},"bugs":{"url":"https://github.com/sonatype/actions/fetch-sbom/issues"},"keywords":["actions","node","setup"],"exports":{".":"./dist/index.js"},"engines":{"node":">=20"},"scripts":{"bundle":"npm run format:write && npm run package","ci-test":"npx jest","coverage":"npx make-coverage-badge --output-path ./badges/coverage.svg","format:write":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --write .","format:check":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --check .","lint":"npx eslint . -c ../.github/linters/.eslintrc.yml --ignore-path ../.eslintignore","package":"npx ncc build src/index.ts -o dist/main --license licenses.txt && npx ncc build src/cleanup.ts -o dist/cleanup --license licenses.txt","package:watch":"npm run package -- --watch","test":"npx jest","all":"npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"},"license":"SEE LICENSE IN LICENSE","jest":{"preset":"ts-jest","verbose":true,"clearMocks":true,"testEnvironment":"node","moduleFileExtensions":["js","ts"],"testMatch":["**/*.test.ts"],"testPathIgnorePatterns":["/node_modules/","/dist/"],"transform":{"^.+\\\\.ts$":"ts-jest"},"coverageReporters":["json-summary","text","lcov"],"collectCoverage":true,"collectCoverageFrom":["./src/**"],"reporters":["default",["jest-junit",{"suiteName":"fetch-sbom unit tests","titleTemplate":"{title}","outputName":"fetch-sbom-test-results.xml","ancestorSeparator":" > "}]]},"dependencies":{"@actions/artifact":"^2.1.7","@actions/github":"^6.0.0","@actions/tool-cache":"^2.0.1","@github/dependency-submission-toolkit":"^2.0.4","axios":"^1.7.2"}}');
143705+
module.exports = JSON.parse('{"name":"fetch-sbom","description":"GitHub Action for obtaining an SBOM","version":"1.5.0","author":"sonatype","private":true,"homepage":"https://github.com/sonatype/actions/fetch-sbom","repository":{"type":"git","url":"git+https://github.com/sonatype/actions/fetch-sbom.git"},"bugs":{"url":"https://github.com/sonatype/actions/fetch-sbom/issues"},"keywords":["actions","node","setup"],"exports":{".":"./dist/index.js"},"engines":{"node":">=20"},"scripts":{"bundle":"npm run format:write && npm run package","ci-test":"npx jest","coverage":"npx make-coverage-badge --output-path ./badges/coverage.svg","format:write":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --write .","format:check":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --check .","lint":"npx eslint . -c ../.github/linters/.eslintrc.yml --ignore-path ../.eslintignore","package":"npx ncc build src/index.ts -o dist/main --license licenses.txt && npx ncc build src/cleanup.ts -o dist/cleanup --license licenses.txt","package:watch":"npm run package -- --watch","test":"npx jest","all":"npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"},"license":"SEE LICENSE IN LICENSE","jest":{"preset":"ts-jest","verbose":true,"clearMocks":true,"testEnvironment":"node","moduleFileExtensions":["js","ts"],"testMatch":["**/*.test.ts"],"testPathIgnorePatterns":["/node_modules/","/dist/"],"transform":{"^.+\\\\.ts$":"ts-jest"},"coverageReporters":["json-summary","text","lcov"],"collectCoverage":true,"collectCoverageFrom":["./src/**"],"reporters":["default",["jest-junit",{"suiteName":"fetch-sbom unit tests","titleTemplate":"{title}","outputName":"fetch-sbom-test-results.xml","ancestorSeparator":" > "}]]},"dependencies":{"@actions/artifact":"^2.1.7","@actions/github":"^6.0.0","@actions/tool-cache":"^2.0.1","@github/dependency-submission-toolkit":"^2.0.4","axios":"^1.7.2"}}');
143696143706

143697143707
/***/ }),
143698143708

run-iq-cli/dist/main/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141073,7 +141073,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
141073141073
/***/ ((module) => {
141074141074

141075141075
"use strict";
141076-
module.exports = JSON.parse('{"name":"run-iq-cli","description":"GitHub Action to run IQ cli","version":"1.4.3","author":"sonatype","private":true,"homepage":"https://github.com/sonatype/actions/run-iq-cli","repository":{"type":"git","url":"git+https://github.com/sonatype/actions/run-iq-cli.git"},"bugs":{"url":"https://github.com/sonatype/actions/run-iq-cli/issues"},"keywords":["actions","node","setup"],"exports":{".":"./dist/index.js"},"engines":{"node":">=20"},"scripts":{"bundle":"npm run format:write && npm run package","ci-test":"npx jest","coverage":"npx make-coverage-badge --output-path ./badges/coverage.svg","format:write":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --write .","format:check":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --check .","lint":"npx eslint . -c ../.github/linters/.eslintrc.yml --ignore-path ../.eslintignore","package":"npx ncc build src/index.ts -o dist/main --license licenses.txt && npx ncc build src/cleanup.ts -o dist/cleanup --license licenses.txt","package:watch":"npm run package -- --watch","test":"npx jest","all":"npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"},"license":"SEE LICENSE IN LICENSE","jest":{"preset":"ts-jest","verbose":true,"clearMocks":true,"testEnvironment":"node","moduleFileExtensions":["js","ts"],"testMatch":["**/*.test.ts"],"testPathIgnorePatterns":["/node_modules/","/dist/"],"transform":{"^.+\\\\.ts$":"ts-jest"},"coverageReporters":["json-summary","text","lcov"],"collectCoverage":true,"collectCoverageFrom":["./src/**"],"reporters":["default",["jest-junit",{"suiteName":"run-iq-cli unit tests","titleTemplate":"{title}","outputName":"run-iq-cli-test-results.xml","ancestorSeparator":" > "}]]},"dependencies":{"@actions/artifact":"^2.1.7","@actions/exec":"^1.1.1","@actions/glob":"^0.4.0","@actions/tool-cache":"^2.0.1","axios":"^1.7.7","semver":"^7.6.3"}}');
141076+
module.exports = JSON.parse('{"name":"run-iq-cli","description":"GitHub Action to run IQ cli","version":"1.5.0","author":"sonatype","private":true,"homepage":"https://github.com/sonatype/actions/run-iq-cli","repository":{"type":"git","url":"git+https://github.com/sonatype/actions/run-iq-cli.git"},"bugs":{"url":"https://github.com/sonatype/actions/run-iq-cli/issues"},"keywords":["actions","node","setup"],"exports":{".":"./dist/index.js"},"engines":{"node":">=20"},"scripts":{"bundle":"npm run format:write && npm run package","ci-test":"npx jest","coverage":"npx make-coverage-badge --output-path ./badges/coverage.svg","format:write":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --write .","format:check":"npx prettier --config ../.prettierrc.json --ignore-path ../.prettierignore --check .","lint":"npx eslint . -c ../.github/linters/.eslintrc.yml --ignore-path ../.eslintignore","package":"npx ncc build src/index.ts -o dist/main --license licenses.txt && npx ncc build src/cleanup.ts -o dist/cleanup --license licenses.txt","package:watch":"npm run package -- --watch","test":"npx jest","all":"npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"},"license":"SEE LICENSE IN LICENSE","jest":{"preset":"ts-jest","verbose":true,"clearMocks":true,"testEnvironment":"node","moduleFileExtensions":["js","ts"],"testMatch":["**/*.test.ts"],"testPathIgnorePatterns":["/node_modules/","/dist/"],"transform":{"^.+\\\\.ts$":"ts-jest"},"coverageReporters":["json-summary","text","lcov"],"collectCoverage":true,"collectCoverageFrom":["./src/**"],"reporters":["default",["jest-junit",{"suiteName":"run-iq-cli unit tests","titleTemplate":"{title}","outputName":"run-iq-cli-test-results.xml","ancestorSeparator":" > "}]]},"dependencies":{"@actions/artifact":"^2.1.7","@actions/exec":"^1.1.1","@actions/glob":"^0.4.0","@actions/tool-cache":"^2.0.1","axios":"^1.7.7","semver":"^7.6.3"}}');
141077141077

141078141078
/***/ })
141079141079

setup-iq-cli/dist/main/index.js

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31343,11 +31343,34 @@ exports.IQ_CLI_JAR = 'sonatype-iq-cli.jar';
3134331343
exports.IQ_VERSION_TO_COMPLETE = '1.{iq-cli-version}.0-01';
3134431344
exports.DOWNLOAD_URL = 'https://download.sonatype.com/clm/scanner/nexus-iq-cli-{iq-cli-version}.jar';
3134531345
exports.MINIMUM_SUPPORTED_IQ_VERSION = 137;
31346-
exports.LATEST_IQ_CLI_VERSION = '2.4.2-01'; // This should be updated to the latest IQ CLI version with each release
31346+
exports.LATEST_IQ_CLI_VERSION = '2.4.3-01'; // This should be updated to the latest IQ CLI version with each release
3134731347
exports.IQ_CLI_VERSION = 'iq-cli-version';
3134831348
exports.IQ_CLI_DOWNLOAD_URL = 'iq-cli-download-url';
3134931349

3135031350

31351+
/***/ }),
31352+
31353+
/***/ 848:
31354+
/***/ ((__unused_webpack_module, exports) => {
31355+
31356+
"use strict";
31357+
31358+
/*
31359+
* Copyright (c) 2023-present Sonatype, Inc. All rights reserved.
31360+
* Includes the third-party code listed at https://links.sonatype.com/products/clm/attributions.
31361+
* "Sonatype" is a trademark of Sonatype, Inc.
31362+
*/
31363+
Object.defineProperty(exports, "__esModule", ({ value: true }));
31364+
exports.getNextDownloadUrl = getNextDownloadUrl;
31365+
// Given a url like: download.sonatype.com/scanner/nexus-iq-cli-1.178.0-05.jar
31366+
// returns download.sonatype.com/scanner/nexus-iq-cli-1.178.0-06.jar
31367+
function getNextDownloadUrl(url) {
31368+
const currentBuildNumber = url.substring(url.length - 6, url.length - 4);
31369+
const nextBuildNumber = (parseInt(currentBuildNumber) + 1).toString().padStart(2, '0');
31370+
return url.replace(currentBuildNumber, nextBuildNumber);
31371+
}
31372+
31373+
3135131374
/***/ }),
3135231375

3135331376
/***/ 8917:
@@ -31439,13 +31462,37 @@ function getValidatedIQCLIVersion() {
3143931462
if (input === 'latest') {
3144031463
return constants_1.LATEST_IQ_CLI_VERSION;
3144131464
}
31465+
// Here only for backwards compatibility, see docs on function
3144231466
if (/^\d+$/.test(input)) {
31443-
if (parseInt(input) < constants_1.MINIMUM_SUPPORTED_IQ_VERSION) {
31444-
throw Error(`IQ minimum supported version is ${constants_1.MINIMUM_SUPPORTED_IQ_VERSION}`);
31445-
}
31446-
return constants_1.IQ_VERSION_TO_COMPLETE.replace('{iq-cli-version}', input);
31467+
return getIqFromMinorVersion(input);
31468+
}
31469+
// This is similar to 2.1.0-01, just return..
31470+
// Here the user provided a full version (major.minor.patch-build-number)
31471+
// This is what we are trying to build anyway so no need for any additional logic..
31472+
if (/^\d\.\d+\.\d+-\d+$/.test(input)) {
31473+
return input;
31474+
}
31475+
// If the provided value does not match 2.1.0 (or similar) - warn and return
31476+
// This can happen when user provides 2.10 or similar (which is insufficient)
31477+
if (!/^\d+\.\d+\.\d+$/.test(input)) {
31478+
throw Error(`Provided IQ CLI version must be in the form of major.minor.patch`);
31479+
}
31480+
// At this point we are handling a provided input that is major.minor.patch
31481+
// Concat the build number -01 and return
31482+
// We will handle other possibilities later (-02, -03) if needed
31483+
return input.concat('-01');
31484+
}
31485+
// The logic within this function is *deprecated* and *not* documented.
31486+
// If the provided input is a single decimal (like 180, 185 and so on..),
31487+
// this returns 1.{provided-version}.0-01
31488+
// This works if all IQ CLI versions were 1.x but we also have 2.x so the provided value is ambiguous.
31489+
function getIqFromMinorVersion(input) {
31490+
core.warning('Providing a minor version only is deprecated and only works for IQ CLI 1.x');
31491+
core.warning('Input the desired CLI version in the major.minor.patch form.');
31492+
if (parseInt(input) < constants_1.MINIMUM_SUPPORTED_IQ_VERSION) {
31493+
throw Error(`IQ minimum supported version is ${constants_1.MINIMUM_SUPPORTED_IQ_VERSION}`);
3144731494
}
31448-
return input;
31495+
return constants_1.IQ_VERSION_TO_COMPLETE.replace('{iq-cli-version}', input);
3144931496
}
3145031497

3145131498

@@ -31495,6 +31542,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
3149531542
const fs_1 = __nccwpck_require__(7147);
3149631543
const constants_1 = __nccwpck_require__(9733);
3149731544
const get_validated_iq_cli_version_1 = __nccwpck_require__(3391);
31545+
const get_next_download_url_1 = __nccwpck_require__(848);
3149831546
const get_semver_version_1 = __nccwpck_require__(8917);
3149931547
/**
3150031548
* The main function for the action.
@@ -31543,7 +31591,23 @@ async function run() {
3154331591
else {
3154431592
core.debug(`Downloading IQ CLI version ${iqCliVersion}`);
3154531593
}
31546-
const iqCliPath = await tc.downloadTool(validatedDownloadUrl, constants_1.IQ_CLI_JAR);
31594+
let iqCliPath;
31595+
for (let i = 1; i < 10; i++) {
31596+
try {
31597+
core.debug(`Attempting to download IQ CLI from: ${validatedDownloadUrl}`);
31598+
iqCliPath = await tc.downloadTool(validatedDownloadUrl, constants_1.IQ_CLI_JAR);
31599+
core.info(`IQ CLI downloaded from: ${validatedDownloadUrl}`);
31600+
break;
31601+
}
31602+
catch (error) {
31603+
core.debug(`Failed to download from: ${validatedDownloadUrl}`);
31604+
validatedDownloadUrl = (0, get_next_download_url_1.getNextDownloadUrl)(validatedDownloadUrl);
31605+
}
31606+
}
31607+
if (!iqCliPath) {
31608+
core.warning(`Failed to download the custom IQ version: ${iqCliVersion}`);
31609+
throw Error(`Failed to download the custom IQ version: ${iqCliVersion}`);
31610+
}
3154731611
core.debug(`Download path is: ${iqCliPath}`);
3154831612
cachedPath = await tc.cacheFile(iqCliPath, constants_1.IQ_CLI_JAR, 'iq-cli', semverVersion);
3154931613
// Delete the downloaded file after caching

0 commit comments

Comments
 (0)