Compare commits

...

9 Commits

Author SHA1 Message Date
Julien HENRY
802bf88184 Revert test to show expected behavior (USER-933) 2025-09-08 09:24:24 +02:00
Julien HENRY
a6104e7ee4 Try with string-argv 2025-09-05 16:21:13 +02:00
Julien HENRY
42fef39f2a Another try 2025-09-05 16:18:24 +02:00
Julien HENRY
ef61b6021f Fix JS import 2025-09-05 15:32:19 +02:00
Julien HENRY
500f8e1411 Add support for Unix 2025-09-05 13:51:39 +02:00
Julien HENRY
4690589d97 Fix parsing 2025-09-05 13:49:53 +02:00
Julien HENRY
cdb14cba33 Experiment 2025-09-05 12:47:47 +02:00
Julien HENRY
3b1a0d504d Disable fail fast on matrix jobs 2025-09-05 11:39:53 +02:00
Julien HENRY
cdefb11fbe Fix test assertion 2025-09-05 11:23:26 +02:00
2 changed files with 24 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ jobs:
name: > name: >
No inputs No inputs
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ github-ubuntu-latest-s, macos-latest ] os: [ github-ubuntu-latest-s, macos-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -31,6 +32,7 @@ jobs:
name: > name: >
'args' input 'args' input
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ] os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -48,12 +50,13 @@ jobs:
- name: Assert - name: Assert
run: | run: |
./test/assertFileContains ./output.properties "sonar.someArg=aValue" ./test/assertFileContains ./output.properties "sonar.someArg=aValue"
./test/assertFileContains ./output.properties 'sonar.anotherArgWithSpaces="Another Value"' ./test/assertFileContains ./output.properties "sonar.anotherArgWithSpaces=Another Value"
./test/assertFileContains ./output.properties "sonar.argWithSingleQuotes='Another Value'" ./test/assertFileContains ./output.properties "sonar.argWithSingleQuotes=Another Value"
argsInputInjectionTest: argsInputInjectionTest:
name: > name: >
'args' input with command injection will fail 'args' input with command injection will fail
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ] os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ]
args: [ -Dsonar.someArg=aValue && echo "Injection", -Dsonar.someArg="value\"; whoami; echo \"" ] args: [ -Dsonar.someArg=aValue && echo "Injection", -Dsonar.someArg="value\"; whoami; echo \"" ]
@@ -63,6 +66,7 @@ jobs:
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Run action with args - name: Run action with args
id: runTest
uses: ./ uses: ./
continue-on-error: true continue-on-error: true
with: with:
@@ -80,6 +84,7 @@ jobs:
name: > name: >
'args' input with backticks injection does not execute command 'args' input with backticks injection does not execute command
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ] os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -380,6 +385,7 @@ jobs:
name: > name: >
'RUNNER_DEBUG' is used 'RUNNER_DEBUG' is used
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ] os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -439,6 +445,7 @@ jobs:
name: > name: >
'SONARCLOUD_URL' is used 'SONARCLOUD_URL' is used
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ] os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -578,6 +585,7 @@ jobs:
name: > name: >
'SONAR_ROOT_CERT' is converted to truststore 'SONAR_ROOT_CERT' is converted to truststore
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ] os: [ github-ubuntu-latest-s, github-windows-latest-s, macos-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}

View File

@@ -51,9 +51,19 @@ runs:
run: echo "${RUNNER_TEMP}/sonar-scanner-cli-${{ inputs.scannerVersion }}-${{ runner.os }}-${{ runner.arch }}/bin" >> $GITHUB_PATH run: echo "${RUNNER_TEMP}/sonar-scanner-cli-${{ inputs.scannerVersion }}-${{ runner.os }}-${{ runner.arch }}/bin" >> $GITHUB_PATH
shell: bash shell: bash
- name: Run SonarScanner - name: Run SonarScanner
run: ${GITHUB_ACTION_PATH}/scripts/run-sonar-scanner.sh uses: satackey/action-js-inline@v0.0.2
shell: bash with:
required-packages: "string-argv"
script: |
const core = require('@actions/core')
const exec = require('@actions/exec')
const { parseArgsStringToArgv } = require('string-argv');
const IS_WINDOWS = process.platform === 'win32'
const runnerTemp = process.env.RUNNER_TEMP
var args = parseArgsStringToArgv(core.getInput('args'));
exec.exec(IS_WINDOWS ? 'sonar-scanner.bat' : 'sonar-scanner', args);
env: env:
INPUT_ARGS: ${{ inputs.args }} INPUT_ARGS: ${{ inputs.args }}
INPUT_PROJECTBASEDIR: ${{ inputs.projectBaseDir }}
SONAR_SCANNER_JRE: ${{ runner.temp }}/sonar-scanner-cli-${{ inputs.scannerVersion }}-${{ runner.os }}-${{ runner.arch }}/jre