From 2cc5f0dbb18fa29ad4c6120e651f4d694ec745f5 Mon Sep 17 00:00:00 2001 From: tiulpin Date: Tue, 15 Feb 2022 23:20:30 +0300 Subject: [PATCH] :children_crossing: Handle the deprecated parameters in the action --- README.md | 22 ++++----- action.yaml | 76 +++++++++++++++++++++++++++---- common/qodana.ts | 8 ++-- scan/__tests__/main.test.ts | 13 ++++-- scan/dist/index.js | 91 +++++++++++++++++++++++++++++++------ scan/package.json | 2 +- scan/src/main.ts | 6 +-- scan/src/utils.ts | 87 +++++++++++++++++++++++++++++++---- vsts/QodanaScan/index.js | 10 ++-- vsts/README.md | 14 +++--- vsts/src/main.ts | 2 +- vsts/src/utils.ts | 2 +- vsts/vss-extension.json | 4 +- 13 files changed, 265 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 79c89b06..04f8b510 100644 --- a/README.md +++ b/README.md @@ -172,17 +172,17 @@ To do it, follow these steps: Most likely you won't need other options than `args`: all other options can be useful if you are configuring multiple Qodana Scan jobs in one workflow. -| Name | Description | Default Value | -|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------| -| `args` | Additional [Qodana CLI `scan` command](https://github.com/jetbrains/qodana-cli#scan) arguments, split the arguments with commas (`,`), e.g. `-i,frontend,--print-problems`. Optional. | - | -| `resultsDir` | Directory to store the analysis results. Optional. | `${{ runner.temp }}/qodana/results` | -| `uploadResults` | Upload Qodana results as an artifact to the job. Optional. | `true` | -| `artifactName` | Specify Qodana results artifact name, used for results uploading. Optional. | `qodana-report` | -| `cacheDir` | Directory to store Qodana cache. Optional. | `${{ runner.temp }}/qodana/caches` | -| `syncCache` | Utilize GitHub caches for Qodana runs. Optional. | `true` | -| `additionalCacheHash` | Allows customizing the generated cache hash. Optional. | `${{ github.sha }}` | -| `useAnnotations` | Use annotation to mark the results in the GitHub user interface. Optional. | `true` | -| `githubToken` | GitHub token to be used for uploading results. Optional. | `${{ github.token }}` | +| Name | Description | Default Value | +|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------| +| `args` | Additional [Qodana CLI `scan` command](https://github.com/jetbrains/qodana-cli#scan) arguments, split the arguments with commas (`,`), e.g. `-i,frontend,--print-problems`. Optional. | - | +| `results-dir` | Directory to store the analysis results. Optional. | `${{ runner.temp }}/qodana/results` | +| `upload-result` | Upload Qodana results as an artifact to the job. Optional. | `true` | +| `artifact-name` | Specify Qodana results artifact name, used for results uploading. Optional. | `qodana-report` | +| `cache-dir` | Directory to store Qodana cache. Optional. | `${{ runner.temp }}/qodana/caches` | +| `use-caches` | Utilize GitHub caches for Qodana runs. Optional. | `true` | +| `additional-cache-hash` | Allows customizing the generated cache hash. Optional. | `${{ github.sha }}` | +| `use-annotations` | Use annotation to mark the results in the GitHub user interface. Optional. | `true` | +| `github-token` | GitHub token to be used for uploading results. Optional. | `${{ github.token }}` | ## Issue Tracker diff --git a/action.yaml b/action.yaml index 0a308765..74133bfa 100644 --- a/action.yaml +++ b/action.yaml @@ -9,38 +9,96 @@ inputs: description: 'Additional Qodana CLI arguments. Separate multiple arguments with commas (`,`).' required: false default: "" - resultsDir: + results-dir: description: 'Directory to store the analysis results' required: false default: "${{ runner.temp }}/qodana/results" - cacheDir: + cache-dir: description: 'Directory to store Qodana caches' required: false default: "${{ runner.temp }}/qodana/caches" - syncCache: + use-caches: description: 'Automatically restore and save Qodana caches using GitHub caches' required: false default: "true" - additionalCacheHash: + additional-cache-hash: description: 'Pass additional cache hash extension' required: false default: "${{ github.sha }}" - uploadResults: + upload-result: description: 'Upload Qodana results as an artifact to the job' required: false default: "true" - artifactName: + artifact-name: description: 'Specify Qodana results artifact name, used for results uploading' required: false default: "qodana-report" - useAnnotations: - description: 'Use annotation to mark the results in the GitHub user interface' + use-annotations: + description: 'Use annotations to mark the results in the GitHub user interface' required: false default: "true" - githubToken: + github-token: description: 'GitHub token to be used for uploading annotations' required: false default: ${{ github.token }} + # deprecated options + linter: + description: '[DEPRECATED] Qodana linter – [official Qodana Docker image](#supported-qodana-docker-images).' + required: false + deprecationMessage: 'Use `args` (e.g. `args: -linter,`) instead' + project-dir: + description: '[DEPRECATED] Root directory of the project to be analyzed' + required: false + deprecationMessage: 'Use `args` (e.g. `args: --project-dir,`) instead' + idea-config-dir: + description: '[DEPRECATED] IntelliJ IDEA configuration directory' + required: false + deprecationMessage: 'Use `args` to mount the directory (e.g. `args: -v,:/root/.config/idea`) instead' + gradle-settings-path: + description: '[DEPRECATED] Provide path to gradle.properties file. An example: "/your/custom/path/gradle.properties"' + required: false + deprecationMessage: 'Use `args` to mount the file (e.g. `args: -v,:/root/.gradle/gradle.properties`) instead' + additional-volumes: + description: '[DEPRECATED] Mount additional volumes to Docker container' + required: false + deprecationMessage: 'Use `args` to mount any directory (e.g. `args: -v,:,-v,:`) instead' + additional-env-variables: + description: '[DEPRECATED] Pass additional environment variables to docker container' + required: false + deprecationMessage: 'Use `args` to pass any environment variable (e.g. `args: -e,=,-e,=`) instead' + fail-threshold: + description: '[DEPRECATED] Set the number of problems that will serve as a quality gate. If this number is reached, the pipeline run is terminated' + required: false + deprecationMessage: 'Use `args` to pass the threshold (e.g. `args: --fail-threshold,`) instead' + inspected-dir: + description: '[DEPRECATED] Directory to be inspected. If not specified, the whole project is inspected by default' + required: false + deprecationMessage: 'Use `args` to pass the directory (e.g. `args: -d,`) instead' + baseline-path: + description: '[DEPRECATED] Run in baseline mode. Provide the path to an existing SARIF report to be used in the baseline state calculation' + required: false + deprecationMessage: 'Use `args` to pass the baseline path (e.g. `args: -b,`) instead' + baseline-include-absent: + description: '[DEPRECATED] Include the results from the baseline absent in the current Qodana run in the output report' + required: false + deprecationMessage: 'Use `args` to pass the baseline include absent flag (e.g. `args: --baseline-include-absent`) instead' + changes: + description: '[DEPRECATED] Inspect uncommitted changes and report new problems' + required: false + deprecationMessage: 'Use `args` to pass the changes flag (e.g. `args: --changes`) instead' + script: + description: '[DEPRECATED] Override the default docker scenario' + required: false + deprecationMessage: 'Use `args` to pass the script (e.g. `args: --script,`) instead' + profile-name: + description: '[DEPRECATED] Name of a profile defined in the project' + required: false + deprecationMessage: 'Use `args` to pass the profile name (e.g. `args: --profile-name,`) instead' + profile-path: + description: '[DEPRECATED] Absolute path to the profile file' + required: false + deprecationMessage: 'Use `args` to pass the profile path (e.g. `args: --profile-path,`) instead' + runs: using: 'node12' main: 'scan/dist/index.js' diff --git a/common/qodana.ts b/common/qodana.ts index 81ecde10..8a16e883 100644 --- a/common/qodana.ts +++ b/common/qodana.ts @@ -1,6 +1,6 @@ // noinspection JSUnusedGlobalSymbols -export const VERSION = '0.7.4' +export const VERSION = '0.7.5' export const EXECUTABLE = 'qodana' export const FAIL_THRESHOLD_OUTPUT = 'The number of problems exceeds the failThreshold' @@ -29,7 +29,7 @@ export interface Inputs { resultsDir: string cacheDir: string additionalCacheHash: string - uploadResults: boolean + uploadResult: boolean artifactName: string useCaches: boolean githubToken: string @@ -107,13 +107,13 @@ export function getQodanaScanArgs( args: string[], resultsDir: string, cacheDir: string, - env = 'cli' + env = `cli` ): string[] { const cliArgs: string[] = [ 'scan', '--skip-pull', '-e', - `QODANA_ENV=${env}`, + `QODANA_ENV=${env}:${VERSION}`, '--cache-dir', cacheDir, '--results-dir', diff --git a/scan/__tests__/main.test.ts b/scan/__tests__/main.test.ts index d76326b4..a6272f67 100644 --- a/scan/__tests__/main.test.ts +++ b/scan/__tests__/main.test.ts @@ -5,7 +5,7 @@ import { QODANA_HELP_STRING, QODANA_CHECK_NAME } from '../src/annotations' -import {getQodanaScanArgs, Inputs} from '../../common/qodana' +import {getQodanaScanArgs, Inputs, VERSION} from '../../common/qodana' function outputEmptyFixture(): Output { return { @@ -62,7 +62,7 @@ function inputsDefaultFixture(): Inputs { resultsDir: '${{ runner.temp }}/qodana-results', cacheDir: '${{ runner.temp }}/qodana-caches', additionalCacheHash: '', - uploadResults: true, + uploadResult: true, artifactName: 'Qodana report', useCaches: true, useAnnotations: true, @@ -75,7 +75,7 @@ function defaultDockerRunCommandFixture(): string[] { 'scan', '--skip-pull', '-e', - 'QODANA_ENV=github', + `QODANA_ENV=github:${VERSION}`, '--cache-dir', '${{ runner.temp }}/qodana-caches', '--results-dir', @@ -87,7 +87,12 @@ function defaultDockerRunCommandFixture(): string[] { test('qodana scan command args', () => { const inputs = inputsDefaultFixture() - const result = getQodanaScanArgs(inputs.args, inputs.resultsDir, inputs.cacheDir, 'github') + const result = getQodanaScanArgs( + inputs.args, + inputs.resultsDir, + inputs.cacheDir, + 'github' + ) expect(result).toEqual(defaultDockerRunCommandFixture()) }) diff --git a/scan/dist/index.js b/scan/dist/index.js index e99dcae5..2c1f6498 100644 --- a/scan/dist/index.js +++ b/scan/dist/index.js @@ -1815,12 +1815,12 @@ function getQodanaPullArgs(args) { } return pullArgs; } -function getQodanaScanArgs(args, resultsDir, cacheDir, env = "cli") { +function getQodanaScanArgs(args, resultsDir, cacheDir, env = `cli`) { const cliArgs = [ "scan", "--skip-pull", "-e", - `QODANA_ENV=${env}`, + `QODANA_ENV=${env}:${VERSION}`, "--cache-dir", cacheDir, "--results-dir", @@ -1834,7 +1834,7 @@ function getQodanaScanArgs(args, resultsDir, cacheDir, env = "cli") { var VERSION, EXECUTABLE, FAIL_THRESHOLD_OUTPUT, QODANA_SARIF_NAME, QodanaExitCode; var init_qodana = __esm({ "../common/qodana.ts"() { - VERSION = "0.7.4"; + VERSION = "0.7.5"; EXECUTABLE = "qodana"; FAIL_THRESHOLD_OUTPUT = "The number of problems exceeds the failThreshold"; QODANA_SARIF_NAME = "qodana.sarif.json"; @@ -66902,17 +66902,82 @@ var require_utils5 = __commonJS({ var tc = __importStar2(require_tool_cache()); var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports)); var path_1 = __importDefault(require("path")); + function getDeprecatedInputs(args) { + const deprecatedInputs = { + linter: core2.getInput("linter"), + projectDir: core2.getInput("project-dir"), + additionalVolumes: core2.getMultilineInput("additional-volumes"), + additionalEnvVars: core2.getMultilineInput("additional-env-variables"), + inspectedDir: core2.getInput("inspected-dir"), + ideaConfigDir: core2.getInput("idea-config-dir"), + baselinePath: core2.getInput("baseline-path"), + baselineIncludeAbsent: core2.getBooleanInput("baseline-include-absent"), + failThreshold: core2.getInput("fail-threshold"), + profileName: core2.getInput("profile-name"), + profilePath: core2.getInput("profile-path"), + gradleSettingsPath: core2.getInput("gradle-settings-path"), + changes: core2.getBooleanInput("changes"), + script: core2.getInput("script") + }; + if (deprecatedInputs.linter) { + args.push("-l", deprecatedInputs.linter); + } + if (deprecatedInputs.projectDir) { + args.push("-i", deprecatedInputs.projectDir); + } + if (deprecatedInputs.additionalVolumes) { + for (const volume of deprecatedInputs.additionalVolumes) { + args.push("-v", volume); + } + } + if (deprecatedInputs.additionalEnvVars) { + for (const envVar of deprecatedInputs.additionalEnvVars) { + args.push("-e", envVar); + } + } + if (deprecatedInputs.inspectedDir) { + args.push("-d", deprecatedInputs.inspectedDir); + } + if (deprecatedInputs.ideaConfigDir) { + args.push("-v", `${deprecatedInputs.ideaConfigDir}:/root/.config/idea`); + } + if (deprecatedInputs.baselinePath) { + args.push("-b", deprecatedInputs.baselinePath); + } + if (deprecatedInputs.baselineIncludeAbsent) { + args.push("--baseline-include-absent"); + } + if (deprecatedInputs.failThreshold) { + args.push("--fail-threshold", deprecatedInputs.failThreshold); + } + if (deprecatedInputs.profileName) { + args.push("--profile-name", deprecatedInputs.profileName); + } + if (deprecatedInputs.profilePath) { + args.push("--profile-path", deprecatedInputs.profilePath); + } + if (deprecatedInputs.gradleSettingsPath) { + args.push("-v", `${deprecatedInputs.gradleSettingsPath}:/root/.gradle/gradle.properties`); + } + if (deprecatedInputs.changes) { + args.push("--changes"); + } + if (deprecatedInputs.script) { + args.push("--script", deprecatedInputs.script); + } + return args; + } function getInputs() { return { - args: core2.getInput("args").split(","), - resultsDir: core2.getInput("resultsDir"), - cacheDir: core2.getInput("cacheDir"), - additionalCacheHash: core2.getInput("additionalCacheHash"), - uploadResults: core2.getBooleanInput("uploadResults"), - artifactName: core2.getInput("artifactName"), - useCaches: core2.getBooleanInput("useCaches"), - githubToken: core2.getInput("githubToken"), - useAnnotations: core2.getBooleanInput("useAnnotations") + args: getDeprecatedInputs(core2.getInput("args").split(",")), + resultsDir: core2.getInput("results-dir"), + cacheDir: core2.getInput("cache-dir"), + additionalCacheHash: core2.getInput("additional-cache-hash"), + uploadResult: core2.getBooleanInput("upload-result"), + artifactName: core2.getInput("artifact-name"), + useCaches: core2.getBooleanInput("use-caches"), + githubToken: core2.getInput("github-token"), + useAnnotations: core2.getBooleanInput("use-annotations") }; } exports2.getInputs = getInputs; @@ -69671,7 +69736,7 @@ function main() { ]); const exitCode = yield (0, utils_1.qodana)(); yield Promise.all([ - (0, utils_1.uploadReport)(inputs.resultsDir, inputs.artifactName, inputs.uploadResults), + (0, utils_1.uploadReport)(inputs.resultsDir, inputs.artifactName, inputs.uploadResult), (0, utils_1.uploadCaches)(inputs.cacheDir, inputs.additionalCacheHash, inputs.useCaches && (0, qodana_1.isExecutionSuccessful)(exitCode)), (0, annotations_1.publishAnnotations)(exitCode === qodana_1.QodanaExitCode.FailThreshold, inputs.githubToken, `${inputs.resultsDir}/${qodana_1.QODANA_SARIF_NAME}`, inputs.useAnnotations && (0, qodana_1.isExecutionSuccessful)(exitCode)) ]); diff --git a/scan/package.json b/scan/package.json index e72bc6f2..0293893b 100644 --- a/scan/package.json +++ b/scan/package.json @@ -4,7 +4,7 @@ "description": "Qodana is a code quality monitoring tool that identifies bugs, duplications, and imperfections.", "main": "lib/main.js", "scripts": { - "build": "rm -rf lib && tsc --build .", + "build": "rm -rf lib && rm -rf ../common/lib && tsc --build .", "format": "prettier --write '**/*.ts'", "format-check": "prettier --check '**/*.ts'", "lint": "eslint src/**/*.ts", diff --git a/scan/src/main.ts b/scan/src/main.ts index 89ef83e0..d0fbfb02 100644 --- a/scan/src/main.ts +++ b/scan/src/main.ts @@ -51,11 +51,7 @@ async function main(): Promise { ]) const exitCode = await qodana() await Promise.all([ - uploadReport( - inputs.resultsDir, - inputs.artifactName, - inputs.uploadResults - ), + uploadReport(inputs.resultsDir, inputs.artifactName, inputs.uploadResult), uploadCaches( inputs.cacheDir, inputs.additionalCacheHash, diff --git a/scan/src/utils.ts b/scan/src/utils.ts index c66024a4..256180b8 100644 --- a/scan/src/utils.ts +++ b/scan/src/utils.ts @@ -14,21 +14,90 @@ import { } from '../../common/qodana' import path from 'path' +function getDeprecatedInputs(args: string[]): string[] { + const deprecatedInputs = { + linter: core.getInput('linter'), + projectDir: core.getInput('project-dir'), + additionalVolumes: core.getMultilineInput('additional-volumes'), + additionalEnvVars: core.getMultilineInput('additional-env-variables'), + inspectedDir: core.getInput('inspected-dir'), + ideaConfigDir: core.getInput('idea-config-dir'), + baselinePath: core.getInput('baseline-path'), + baselineIncludeAbsent: core.getBooleanInput('baseline-include-absent'), + failThreshold: core.getInput('fail-threshold'), + profileName: core.getInput('profile-name'), + profilePath: core.getInput('profile-path'), + gradleSettingsPath: core.getInput('gradle-settings-path'), + changes: core.getBooleanInput('changes'), + script: core.getInput('script') + } + if (deprecatedInputs.linter) { + args.push('-l', deprecatedInputs.linter) + } + if (deprecatedInputs.projectDir) { + args.push('-i', deprecatedInputs.projectDir) + } + if (deprecatedInputs.additionalVolumes) { + for (const volume of deprecatedInputs.additionalVolumes) { + args.push('-v', volume) + } + } + if (deprecatedInputs.additionalEnvVars) { + for (const envVar of deprecatedInputs.additionalEnvVars) { + args.push('-e', envVar) + } + } + if (deprecatedInputs.inspectedDir) { + args.push('-d', deprecatedInputs.inspectedDir) + } + if (deprecatedInputs.ideaConfigDir) { + args.push('-v', `${deprecatedInputs.ideaConfigDir}:/root/.config/idea`) + } + if (deprecatedInputs.baselinePath) { + args.push('-b', deprecatedInputs.baselinePath) + } + if (deprecatedInputs.baselineIncludeAbsent) { + args.push('--baseline-include-absent') + } + if (deprecatedInputs.failThreshold) { + args.push('--fail-threshold', deprecatedInputs.failThreshold) + } + if (deprecatedInputs.profileName) { + args.push('--profile-name', deprecatedInputs.profileName) + } + if (deprecatedInputs.profilePath) { + args.push('--profile-path', deprecatedInputs.profilePath) + } + if (deprecatedInputs.gradleSettingsPath) { + args.push( + '-v', + `${deprecatedInputs.gradleSettingsPath}:/root/.gradle/gradle.properties` + ) + } + if (deprecatedInputs.changes) { + args.push('--changes') + } + if (deprecatedInputs.script) { + args.push('--script', deprecatedInputs.script) + } + return args +} + /** * The context for the action. * @returns The action inputs. */ export function getInputs(): Inputs { return { - args: core.getInput('args').split(','), - resultsDir: core.getInput('resultsDir'), - cacheDir: core.getInput('cacheDir'), - additionalCacheHash: core.getInput('additionalCacheHash'), - uploadResults: core.getBooleanInput('uploadResults'), - artifactName: core.getInput('artifactName'), - useCaches: core.getBooleanInput('useCaches'), - githubToken: core.getInput('githubToken'), - useAnnotations: core.getBooleanInput('useAnnotations') + args: getDeprecatedInputs(core.getInput('args').split(',')), + resultsDir: core.getInput('results-dir'), + cacheDir: core.getInput('cache-dir'), + additionalCacheHash: core.getInput('additional-cache-hash'), + uploadResult: core.getBooleanInput('upload-result'), + artifactName: core.getInput('artifact-name'), + useCaches: core.getBooleanInput('use-caches'), + githubToken: core.getInput('github-token'), + useAnnotations: core.getBooleanInput('use-annotations') } } /** diff --git a/vsts/QodanaScan/index.js b/vsts/QodanaScan/index.js index a46a50b1..4a6ed525 100644 --- a/vsts/QodanaScan/index.js +++ b/vsts/QodanaScan/index.js @@ -82,12 +82,12 @@ function getQodanaPullArgs(args) { } return pullArgs; } -function getQodanaScanArgs(args, resultsDir, cacheDir, env = "cli") { +function getQodanaScanArgs(args, resultsDir, cacheDir, env = `cli`) { const cliArgs = [ "scan", "--skip-pull", "-e", - `QODANA_ENV=${env}`, + `QODANA_ENV=${env}:${VERSION}`, "--cache-dir", cacheDir, "--results-dir", @@ -101,7 +101,7 @@ function getQodanaScanArgs(args, resultsDir, cacheDir, env = "cli") { var VERSION, EXECUTABLE, FAIL_THRESHOLD_OUTPUT, QODANA_SARIF_NAME, QodanaExitCode; var init_qodana = __esm({ "../common/qodana.ts"() { - VERSION = "0.7.4"; + VERSION = "0.7.5"; EXECUTABLE = "qodana"; FAIL_THRESHOLD_OUTPUT = "The number of problems exceeds the failThreshold"; QODANA_SARIF_NAME = "qodana.sarif.json"; @@ -4358,7 +4358,7 @@ var require_utils2 = __commonJS({ args: (tl2.getInput("args", false) || "").split(","), resultsDir: tl2.getInput("resultsDir", false) || path.join(home, "results"), cacheDir: tl2.getInput("cacheDir", false) || path.join(home, "cache"), - uploadResults: tl2.getBoolInput("uploadResults", false) || true, + uploadResult: tl2.getBoolInput("uploadResult", false) || true, artifactName: tl2.getInput("artifactName", false) || "qodana-report", additionalCacheHash: "", githubToken: "", @@ -4463,7 +4463,7 @@ function main() { tl.mkdirP(inputs.cacheDir); yield (0, utils_1.prepareAgent)(inputs.args); const exitCode = yield (0, utils_1.qodana)(); - yield (0, utils_1.uploadReport)(inputs.resultsDir, inputs.artifactName, inputs.uploadResults); + yield (0, utils_1.uploadReport)(inputs.resultsDir, inputs.artifactName, inputs.uploadResult); if (!(0, qodana_1.isExecutionSuccessful)(exitCode)) { (0, utils_1.setFailed)(`qodana scan failed with exit code ${exitCode}`); } else if (exitCode === qodana_1.QodanaExitCode.FailThreshold) { diff --git a/vsts/README.md b/vsts/README.md index b64f0e1e..0682083a 100644 --- a/vsts/README.md +++ b/vsts/README.md @@ -55,13 +55,13 @@ The task can be run on any OS and x86_64/arm64 CPUs, but it requires the agent t You probably won't need other options than `args`: all other options can be helpful if you are configuring multiple Qodana Scan jobs in one workflow. -| Name | Description | Default Value | -|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------| -| `args` | Additional [Qodana CLI `scan` command](https://github.com/jetbrains/qodana-cli#scan) arguments, split the arguments with commas (`,`), e.g. `-i,frontend`, . Optional. | - | -| `resultsDir` | Directory to store the analysis results. Optional. | `$(Agent.TempDirectory)/qodana/results` | -| `uploadResults` | Upload Qodana results as an artifact to the job. Optional. | `true` | -| `artifactName` | Specify Qodana results artifact name, used for results uploading. Optional. | `qodana-report` | -| `cacheDir` | Directory to store Qodana caches. Optional. | `$(Agent.TempDirectory)/qodana/cache` | +| Name | Description | Default Value | +|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------| +| `args` | Additional [Qodana CLI `scan` command](https://github.com/jetbrains/qodana-cli#scan) arguments, split the arguments with commas (`,`), e.g. `-i,frontend`. Optional. | - | +| `resultsDir` | Directory to store the analysis results. Optional. | `$(Agent.TempDirectory)/qodana/results` | +| `uploadResult` | Upload Qodana results as an artifact to the job. Optional. | `true` | +| `artifactName` | Specify Qodana results artifact name, used for results uploading. Optional. | `qodana-report` | +| `cacheDir` | Directory to store Qodana caches. Optional. | `$(Agent.TempDirectory)/qodana/cache` | ## Issue Tracker diff --git a/vsts/src/main.ts b/vsts/src/main.ts index 077f4d72..0ebbb1bc 100644 --- a/vsts/src/main.ts +++ b/vsts/src/main.ts @@ -21,7 +21,7 @@ async function main(): Promise { await uploadReport( inputs.resultsDir, inputs.artifactName, - inputs.uploadResults + inputs.uploadResult ) if (!isExecutionSuccessful(exitCode)) { setFailed(`qodana scan failed with exit code ${exitCode}`) diff --git a/vsts/src/utils.ts b/vsts/src/utils.ts index ffff8495..7fc04ee8 100644 --- a/vsts/src/utils.ts +++ b/vsts/src/utils.ts @@ -28,7 +28,7 @@ export function getInputs(): Inputs { args: (tl.getInput('args', false) || '').split(','), resultsDir: tl.getInput('resultsDir', false) || path.join(home, 'results'), cacheDir: tl.getInput('cacheDir', false) || path.join(home, 'cache'), - uploadResults: tl.getBoolInput('uploadResults', false) || true, + uploadResult: tl.getBoolInput('uploadResult', false) || true, artifactName: tl.getInput('artifactName', false) || 'qodana-report', // Not used by the task additionalCacheHash: '', diff --git a/vsts/vss-extension.json b/vsts/vss-extension.json index d357f451..80beec44 100644 --- a/vsts/vss-extension.json +++ b/vsts/vss-extension.json @@ -2,8 +2,8 @@ "manifestVersion": 1, "id": "qodana", "name": "Qodana", - "version": "1.0.0", - "publisher": "tiulpin", + "version": "0.9.1", + "publisher": "JetBrains", "targets": [ { "id": "Microsoft.VisualStudio.Services"