Skip to content
Snippets Groups Projects
Commit 5fd53714 authored by Erik Reid's avatar Erik Reid
Browse files

initial Jenkinsfile

parent f8eb2568
No related branches found
No related tags found
No related merge requests found
// make sure the pip cache is accessible
def container_args = "-v ${env.JENKINS_HOME}/.cache:/cache:rw,z -e XDG_CACHE_HOME=/cache"
pipeline {
agent none
stages {
stage('init') {
agent any
steps {
script {
def matcher = env.GIT_URL =~ /\/(.*)\.git/
if(matcher.find()) {
gitProjectId = matcher[0][1];
}
}
echo gitProjectId
}
}
stage('test') {
parallel {
stage('test Python 3.6.8 (Centos 7)') {
agent {
docker {
image 'python:3.6.8'
args container_args
}
}
steps {
run_unit_tests('py36')
}
}
stage('test Python 3.7.6') {
agent {
docker {
image 'python:3.7.6'
args container_args
}
}
steps {
run_unit_tests('py37')
}
}
stage('test Python 3.8.3') {
agent {
docker {
image 'python:3.8.3'
args container_args
}
}
steps {
run_unit_tests('py38')
}
}
}
}
stage('SonarQube analysis') {
agent any
steps {
script {
// must match 'Name' from Jenkins 'Global Tool Configuration'
scannerHome = tool 'sonar-scaner';
}
// must match 'Name' from Jenkins 'Configure System'
withSonarQubeEnv('Project SonarQube') {
sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=./sonar.properties"
}
}
}
}
}
void run_unit_tests(tox_env) {
sh 'python -m venv venv'
sh 'venv/bin/pip install tox'
sh "venv/bin/tox -e $tox_env"
}
sonar.projectKey=inventory-provider
sonar.projectName=Inventory Provider
sonar.projectVersion=0.x
sonar.sources=inventory_provider
sonar.python.coverage.reportPaths=coverage.xml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment