-
Notifications
You must be signed in to change notification settings - Fork 358
No way to configure CODEQL_THREADS with an environment variable #2890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Spiked up a PR for this #2891 |
I think there's a key misunderstanding here: the comment in codeql-action/src/init-action.ts Lines 538 to 542 in 5eb3ed6
That said, I am unsure why we respect the existing value of |
For your use case, if you are able to, ensure that you set the |
Thank you for the quick response! More concrete details: name: "GHAS JS CodeQL"
on:
push:
branches: [ "master" ]
paths:
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- '**.html'
- '.github/workflows/ghas-js-codeql.yaml'
pull_request:
branches: [ "master" ]
paths:
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- '**.html'
- '.github/workflows/ghas-js-codeql.yaml'
workflow_dispatch: {}
jobs:
analyze:
name: Analyze
runs-on: 'mxpnl-arc-32' # needs upsized runner or will OOM
container:
image: '<an ubuntu 24.04 base image>'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 30
permissions:
security-events: write
packages: read
actions: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Node
uses: actions/[email protected]
with:
node-version-file: .nvmrc
# Initializes the CodeQL tools for scanning.
- name: print env vars
run: |
echo "CODEQL_THREADS=$CODEQL_THREADS"
echo "CODEQL_RAM=$CODEQL_RAM"
- name: Initialize CodeQL
uses: github/codeql-action/[email protected]
with:
languages: javascript-typescript
build-mode: none
config-file: ./.github/codeql-config.yaml
- name: Perform CodeQL Analysis
uses: github/codeql-action/[email protected]
with:
category: "/language:javascript-typescript" mxpnl-arc-32 is a actions-runner-controller autoscaling runner set in kubernetes mode where the workflow pods have these env vars set nets me So it's correctly picking up the ram variable but ignoring the threads env var. The CLI is not respecting the global env var because it is being overridden by the action |
Like I said, you would need to set the environment variable(s) for the - name: Perform CodeQL Analysis
uses: github/codeql-action/[email protected]
with:
category: "/language:javascript-typescript"
env:
CODEQL_THREADS: # your value or expression here |
The source says this action respects both CODEQL_RAM and CODEQL_THREADS
https://github.com/github/codeql-action/blob/5eb3ed6614230b1931d5c08df9e096e4ba524f21/lib/init-action.js#L315C12-L319
this is true for CODEQL_RAM
codeql-action/lib/init-action.js
Line 320 in 5eb3ed6
but not true for CODEQL_THREADS
codeql-action/lib/init-action.js
Line 322 in 5eb3ed6
Is this an oversight or is there a good reason for this?
My use case is I'm running this on a big 48 core kubernetes but the codeql runner pod is only allowed to use 16 cores. The autodetection is not factoring in the pod limits, it's looking at the node's available resources. I want to hint to codeql that it only has 16 threads available via the CODEQL_THREADS env var.
The text was updated successfully, but these errors were encountered: