File tree Expand file tree Collapse file tree 1 file changed +21
-19
lines changed
Expand file tree Collapse file tree 1 file changed +21
-19
lines changed Original file line number Diff line number Diff line change 11pipeline {
2- agent {
3- docker {
4- image ' python:3.11' // Python comes pre-installed
5- args " -u root"
6- }
7- }
2+ agent any
83
94 environment {
105 GITHUB_TOKEN = credentials(' codeql-wrapper-token' )
@@ -19,26 +14,33 @@ pipeline {
1914
2015 stage(' Setup Python' ) {
2116 steps {
22- sh ''' #!/bin/bash
17+ sh ''' #!/bin/bash
18+ # Upgrade pip, setuptools, and wheel
19+ python3 -m venv venv
20+ . venv/bin/activate
21+
22+ pip uninstall codeql-wrapper -y
2323
24- python3 -m pip install --upgrade pip
25- pip3 install codeql-wrapper
24+ echo "Upgrading pip, setuptools, and wheel..."
25+ python3 -m pip install --upgrade --force-reinstall pip setuptools wheel packaging gitpython==3.1.45
26+ pip install --extra-index-url https://test.pypi.org/simple/ codeql-wrapper==0.2.15
2627 '''
2728 }
2829 }
2930
3031 stage(' CodeQL Analysis' ) {
3132 steps {
32- sh ''' #!/bin/bash
33-
34- codeql-wrapper analyze ${WORKSPACE} \
35- --monorepo \
36- --verbose \
37- --upload-sarif \
38- --repository owner/repository \
39- --commit-sha ${GIT_COMMIT} \
40- --ref ${GIT_BRANCH}
41- '''
33+ withCredentials([string(credentialsId : ' PAT' , variable : ' GITHUB_TOKEN' )]) {
34+ sh ''' #!/bin/bash
35+ . venv/bin/activate
36+ echo "Base Ref (Target Branch): $CHANGE_TARGET"
37+ echo "Ref (Source Branch): $CHANGE_BRANCH"
38+
39+ curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user
40+
41+ codeql-wrapper --verbose analyze ./monorepo --monorepo --upload-sarif --ref $CHANGE_BRANCH --base-ref $CHANGE_TARGET
42+ '''
43+ }
4244 }
4345 }
4446 }
You can’t perform that action at this time.
0 commit comments