diff --git a/theforeman.org/pipelines/infra/updateJobs.groovy b/theforeman.org/pipelines/infra/updateJobs.groovy index 6d0ec796..f2cadfe5 100644 --- a/theforeman.org/pipelines/infra/updateJobs.groovy +++ b/theforeman.org/pipelines/infra/updateJobs.groovy @@ -13,15 +13,15 @@ pipeline { ] ]) - virtEnv('jjb-venv', 'pip install pbr') - virtEnv('jjb-venv', 'pip install -r requirements.txt') + virtEnv('jjb-venv', 'pip install pbr', '3.11') + virtEnv('jjb-venv', 'pip install -r requirements.txt', '3.11') } } stage('Update ci.theforeman.org jobs') { steps { withCredentials([usernamePassword(credentialsId: 'theforeman-jenkins', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { - virtEnv('jjb-venv', "cd ./theforeman.org && REQUESTS_CA_BUNDLE=/etc/pki/tls/cert.pem jenkins-jobs --conf ./foreman_jenkins.ini --user ${env.USERNAME} --password '${env.PASSWORD}' update --delete-old -r .") + virtEnv('jjb-venv', "cd ./theforeman.org && REQUESTS_CA_BUNDLE=/etc/pki/tls/cert.pem jenkins-jobs --conf ./foreman_jenkins.ini --user ${env.USERNAME} --password '${env.PASSWORD}' update --delete-old -r .", '3.11') } } } @@ -29,7 +29,7 @@ pipeline { stage('Update jenkins-foreman.apps.ocp.cloud.ci.centos.org jobs') { steps { withCredentials([usernamePassword(credentialsId: 'centos-jenkins-openshift-cloud', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { - virtEnv('jjb-venv', "cd ./centos.org && REQUESTS_CA_BUNDLE=/etc/pki/tls/cert.pem jenkins-jobs --conf ./centos_jenkins.ini --user ${env.USERNAME} --password '${env.PASSWORD}' update --delete-old -r ./jobs") + virtEnv('jjb-venv', "cd ./centos.org && REQUESTS_CA_BUNDLE=/etc/pki/tls/cert.pem jenkins-jobs --conf ./centos_jenkins.ini --user ${env.USERNAME} --password '${env.PASSWORD}' update --delete-old -r ./jobs", '3.11') } } } diff --git a/theforeman.org/pipelines/lib/virtualEnv.groovy b/theforeman.org/pipelines/lib/virtualEnv.groovy index 72aa4adf..194c6d7e 100644 --- a/theforeman.org/pipelines/lib/virtualEnv.groovy +++ b/theforeman.org/pipelines/lib/virtualEnv.groovy @@ -1,6 +1,11 @@ -def virtEnv(path, command) { +def virtEnv(path, command, python=null) { if(!fileExists("${path}/bin/activate")) { - sh "virtualenv ${path}" + if(python) { + cmd = "python${python}" + } else { + cmd = "python3" + } + sh "${cmd} -m venv ${path}" } sh """