| Pavel Glazov | 26dcac0 | 2022-09-29 23:20:00 +0400 | [diff] [blame] | 1 | node('sre-team-infra') {
 | 
 | 2 |     timestamps() {
 | 
 | 3 |         ansiColor('xterm') {
 | 
 | 4 |             tmp_jenkins_config = '/dev/shm/sre-jenkins-job-builder.ini'
 | 
 | 5 |             stage('Checkout') {
 | 
 | 6 |                 checkout scm
 | 
 | 7 |             }
 | 
 | 8 |             stage('Codenarc') {
 | 
 | 9 |                 try {
 | 
 | 10 |                     sh '''#!/bin/bash -ex
 | 
 | 11 |                     docker run --rm \
 | 
 | 12 |                     -t --user "\$(id -u):\$(id -g)" \
 | 
| Pavel Glazov | 7317966 | 2022-10-05 14:29:37 +0400 | [diff] [blame] | 13 |                     -v ${WORKSPACE}:/ws \
 | 
| Pavel Glazov | 26dcac0 | 2022-09-29 23:20:00 +0400 | [diff] [blame] | 14 |                     docker-prod-local.docker.mirantis.net/infra/codenarc:latest \
 | 
 | 15 |                     -rulesetfiles="rulesets/basic.xml" \
 | 
 | 16 |                     -maxPriority1Violations=0 \
 | 
 | 17 |                     -maxPriority2Violations=0 \
 | 
 | 18 |                     -maxPriority3Violations=0 \
 | 
 | 19 |                     -report=console \
 | 
| Pavel Glazov | 7317966 | 2022-10-05 14:29:37 +0400 | [diff] [blame] | 20 |                     -report=html:/ws/report.html 2>&1 \
 | 
| Pavel Glazov | 26dcac0 | 2022-09-29 23:20:00 +0400 | [diff] [blame] | 21 |                     | tee report.log
 | 
 | 22 |                     if [ "${PIPESTATUS[0]}" != '0' ]; then
 | 
 | 23 |                         exit 1
 | 
 | 24 |                     fi
 | 
 | 25 |                     '''
 | 
 | 26 |                 }
 | 
 | 27 |                 finally {
 | 
 | 28 |                     archiveArtifacts \
 | 
 | 29 |                     artifacts: "**/report.html",
 | 
 | 30 |                     allowEmptyArchive: false
 | 
 | 31 |                 }
 | 
 | 32 |             }
 | 
 | 33 |             stage ("Test python with pep8"){
 | 
 | 34 |                 sh """
 | 
 | 35 |                 set -e
 | 
 | 36 |                 tox
 | 
 | 37 |                 """
 | 
 | 38 |             }
 | 
 | 39 |         }
 | 
 | 40 |     }
 | 
 | 41 | } |