@@ -15,33 +15,22 @@ pipeline {
1515 script : ' echo $BRANCH_NAME | sed -e "s#/#-#g"' ,
1616 returnStdout : true
1717 ). trim()
18+ // spawns GITHUB_USR and GITHUB_PSW environment variables
19+ GITHUB = credentials(' 38b2e4a6-167a-40b2-be6f-d69be42c8190' )
1820 }
1921 stages {
20- stage(' Build, Format & Lint' ) {
21- // Build a Docker image containing the Precise application and all
22- // prerequisites. Use git to determine the list of files changed.
23- // Filter the list of changed files into a list of Python modules.
24- // Pass the list of Python files changed into the Black code
25- // formatter. Build will fail if Black finds any changes to make.
26- // If Black check passes, run PyLint against the same set of Python
27- // modules. Build will fail if lint is found in code.
22+ stage(' Lint & Format' ) {
23+ // Run PyLint and Black to check code quality.
2824 when {
2925 changeRequest target : ' dev'
3026 }
3127 steps {
32- sh ' docker build -f test/Dockerfile -t precise:${BRANCH_ALIAS} .'
33- sh ' git fetch origin dev'
34- sh ' git --no-pager diff --name-only FETCH_HEAD > $HOME/code-quality/change-set.txt'
35- sh ' docker run \
36- -v $HOME/code-quality/:/root/code-quality \
37- --entrypoint /bin/bash \
38- precise:${BRANCH_ALIAS} \
39- -x -c "grep -F .py /root/code-quality/change-set.txt | xargs black --check"'
40- sh ' docker run \
41- -v $HOME/code-quality/:/root/code-quality \
42- --entrypoint /bin/bash \
43- precise:${BRANCH_ALIAS} \
44- -x -c "grep -F .py /root/code-quality/change-set.txt | xargs pylint"'
28+ sh ' docker build \
29+ --build-arg github_api_key=$GITHUB_PSW \
30+ --file test/Dockerfile \
31+ --target code-checker \
32+ -t precise:${BRANCH_ALIAS} .'
33+ sh ' docker run precise:${BRANCH_ALIAS}'
4534 }
4635 }
4736 stage(' Run Tests' ) {
@@ -55,7 +44,11 @@ pipeline {
5544 }
5645 steps {
5746 echo ' Building Precise Testing Docker Image'
58- sh ' docker build -f test/Dockerfile -t precise:${BRANCH_ALIAS} .'
47+ sh ' docker build \
48+ --build-arg github_api_key=$GITHUB_PSW \
49+ --file test/Dockerfile \
50+ --target test-runner \
51+ -t precise:${BRANCH_ALIAS} .'
5952 echo ' Precise Test Suite'
6053 timeout(time : 5 , unit : ' MINUTES' )
6154 {
0 commit comments