SAP / jenkins-library

Jenkins shared library for Continuous Delivery pipelines.
https://www.project-piper.io
Apache License 2.0
781 stars 594 forks source link

when I execute the codeql upload function the parameter commit is n/a #4851

Closed wuyongmax closed 6 months ago

wuyongmax commented 8 months ago

we use a pipeline repo to execute the codeql scan job for the application repo, and I transfer the commitid in the codeqlExecuteScan but the commit is n/a:

20:30:36 info codeqlExecuteScan - [2024-02-28 13:30:35] [build-stdout] PIPER_parametersJSON={"uploadResults":true,"ram":8000,"githubTokenCredentialsId":"githubToolsCredentials","codeqlQuery":"java-security-extended.qls","buildCommand":"./build_codeql.sh","dockerImage":"piper.int.repositories.cloud.sap/piper/codeql:jdk17","modulePath":"./","commitId":"b1874a69fb4a093681694c27d659008c49692340"} running command: codeql github upload-results --sarif=target/codeqlReport.sarif -a=** --commit=n/a* --github-url=https://github.tools.sap/ --repository=bn-catalog/bn-commerce-cloud --ref=refs/heads/add_codeql 20:47:43 error codeqlExecuteScan - A fatal error occurred: Error uploading SARIF to 'https://github.tools.sap/api/v3/repos/bn-catalog/bn-commerce-cloud/code-scanning/sarifs' from '/home/jenkins/agent/workspace/CodeqlTest2_add_codeql/target/codeqlReport.sarif'. REASON: HTTP/1.1 422 unknown:::{"message":"Invalid request.\n\nAt least 40 characters are required; only 3 were supplied.\nn/a does not match /^[0-9a-f]+$/.","documentation_url":"https://docs.github.com/enterprise-server@3.9/rest/reference/code-scanning#upload-an-analysis-as-sarif-data"} stage('CodeQL Scan') { commit_id = returnCommitId() codeqlExecuteScan(script:this, uploadResults: true, ram:8000, githubTokenCredentialsId:'githubToolsCredentials', codeqlQuery: 'java-security-extended.qls', buildCommand:'./build_codeql.sh', // buildCommand:"env", // buildCommand:'/hybris/bin/platform/apache-ant/bin', dockerImage: '.repositories.cloud.sap/piper/codeql:jdk17', modulePath:'./', commitId:commit_id // targetGithubBranchName:"develop" ) } } Could you please give some advice

github-actions[bot] commented 6 months ago

Thank you for your contribution! This issue is stale because it has been open 60 days with no activity. In order to keep it open, please remove stale label or add a comment within the next 10 days. If you need a Piper team member to remove the stale label make sure to add @SAP/jenkins-library-team to your comment.

github-actions[bot] commented 6 months ago

Issue got stale and no further activity happened. It has automatically been closed. Please re-open in case you still consider it relevant.