I'm having trouble getting python3 to work in jenkins. Jenkins is currently running in a docker container and i'm using pipeline
scripts to facilitate CI/CD
This is my Jenkinsfile
for a python repo
pipeline {
agent any
tools {
nodejs 'nodejs'
python3 'python3'
}
environment{
}
stages {
stage('build'){
steps{
echo 'Preparing'
sh 'python3 --version'
sh 'pip3 install -U pytest'
script{
// pull git tag and add to a variable to set the build info - {tag#build_no}
GIT_TAG = sh(script: "git describe --abbrev=0 --tags", returnStdout: true).trim()
sh 'echo ${GIT_TAG}'
currentBuild.displayName = "${GIT_TAG}#${BUILD_NUMBER}"
}
}
}
stage('Checkout'){
steps {
echo 'Checking out code from repo'
checkout scm
}
}
stage('install'){
steps{
echo 'installing libraries'
sh 'pip3 install -r requirements.txt'
}
}
stage('test'){
steps {
echo 'running tests'
sh 'pytest'
}
post{
success{
bitbucketStatusNotify(buildState: 'SUCCESSFUL')
office365ConnectorSend message: "The build was successfull", status: "Success", webhookUrl: "${env.HOOK}"
}
failure{
bitbucketStatusNotify(buildState: 'FAILED')
office365ConnectorSend message: "The build has failed", status: "Failure", webhookUrl: "${env.HOOK}"
}
}
}
}
}
python3 isnt recognized by jenkins as it hasnt been installed yet. How do i get a python3 installation in my jenkins folder? I tried making the changes here - but for some reason - this doesnt seem to work (using the shiningpanda
plugin)
python2.7 actually does exist in /usr/bin/python
but this seem to be unrecognized by Jenkins