diff --git a/entrypoint.sh b/entrypoint.sh index 10e6305..b8e6be2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,6 +24,7 @@ set -- [[ ! -z "$INPUT_EXCLUDE_QUERIES" ]] && EXCLUDE_QUERIES_PARAM="--exclude-queries $INPUT_EXCLUDE_QUERIES" [[ ! -z "$INPUT_EXCLUDE_CATEGORIES" ]] && EXCLUDE_CATEGORIES_PARAM="--exclude-categories $INPUT_EXCLUDE_CATEGORIES" [[ "$INPUT_EXCLUDE_GITIGNORE" == "true" ]] && EXCLUDE_GITIGNORE="--exclude-gitignore" +INPUT_PLATFORM_TYPE="${INPUT_PLATFORM_TYPE:-$INPUT_TYPE}" [[ ! -z "$INPUT_PLATFORM_TYPE" ]] && PLATFORM_TYPE_PARAM="--type $INPUT_PLATFORM_TYPE" [[ ! -z "$INPUT_FAIL_ON" ]] && FAIL_ON_PARAM="--fail-on $INPUT_FAIL_ON" [[ ! -z "$INPUT_TIMEOUT" ]] && TIMEOUT_PARAM="--timeout $INPUT_TIMEOUT" diff --git a/test/e2e/action-contract.test.js b/test/e2e/action-contract.test.js index 910ef31..d607ec1 100644 --- a/test/e2e/action-contract.test.js +++ b/test/e2e/action-contract.test.js @@ -16,7 +16,6 @@ const consumed = new Set([ ]) consumed.delete('INPUT_PARAM') // entrypoint.sh's own "-p " variable, not an action input -const KNOWN_UNUSED_INPUTS = { type: 'declared in action.yml but entrypoint.sh only reads platform_type, so `type:` is silently ignored' } test('action.yml parsing assumptions hold', async (t) => { await t.test('declares inputs and the runs.env mappings the tests rely on', () => { diff --git a/test/e2e/entrypoint.test.js b/test/e2e/entrypoint.test.js index a58e547..0e12016 100644 --- a/test/e2e/entrypoint.test.js +++ b/test/e2e/entrypoint.test.js @@ -63,6 +63,7 @@ test('inputs mapped to KICS flags', async (t) => { ['exclude_queries', '11111111-2222-3333-4444-555555555555', '--exclude-queries'], ['exclude_categories', 'Observability,Backup', '--exclude-categories'], ['platform_type', 'Terraform,Dockerfile', '--type'], + ['type', 'Ansible,Dockerfile', '--type'], ['fail_on', 'high,medium', '--fail-on'], ['timeout', '60', '--timeout'], ['profiling', 'CPU', '--profiling'], @@ -79,6 +80,11 @@ test('inputs mapped to KICS flags', async (t) => { }) } + await t.test('platform_type wins when type is set as well', async (t) => { + const run = await runEntrypoint(t, { inputs: { platform_type: 'Terraform', type: 'Ansible' } }) + assert.equal(flagValue(run.args, '--type'), 'Terraform') + }) + const withSpaces = [ ['payload_path', 'my dir/payload file.json', '-d'], ['config_path', 'my dir/kics config.json', '--config'],