jenkinsci / pyenv-pipeline-plugin

Execute commands in Python virtualenvs in Jenkins Pipeline DSL
https://plugins.jenkins.io/pyenv-pipeline/
MIT License
33 stars 15 forks source link

"No such file or directory" while executing pysh command withing withPythonEnv block #11

Closed avovsya closed 6 years ago

avovsya commented 6 years ago

Trying to use pyenv-plugin for the first time. Can't make it work with either ShiningPanda or python binary path, always get the same error:

[workspace] Running shell script
+ . /var/lib/jenkins/jobs/test-jenkins-pipeline-2/branches/feature-new-.moo0ks.ins-pipeline/workspace/.pyenv-usr-bin-python2.7/bin/activate
/var/lib/jenkins/jobs/test-jenkins-pipeline-2/branches/feature-new-.moo0ks.ins-pipeline/workspace@tmp/durable-89736fec/script.sh: line 2: /var/lib/jenkins/jobs/test-jenkins-pipeline-2/branches/feature-new-.moo0ks.ins-pipeline/workspace/.pyenv-usr-bin-python2.7/bin/activate: No such file or directory
script returned exit code 1

I've checked workspace directory and .pyenv-usr-bin-python2.7 is not there, but /usr/bin/python2.7 definitely exists.

Here is the code that I'm running(part of it):

pipeline {
  agent any
  stages {
    stage('Install requirements') {
      steps {
        withPythonEnv('/usr/bin/python2.7'){
            pysh 'pip install pylint'
        }
      }
    }
    ...

Also, the logs that I've provided are the only logs that I'm getting. So I don't see anything like this - https://github.com/jenkinsci/pyenv-pipeline-plugin/blob/master/src/main/java/com/github/pyenvpipeline/jenkins/steps/WithPythonEnvStep.java#L169 in the output, which leads me to the conclusion that the environment hasn't been created in the first place. Any thoughts on this?

I would I appreciate any help, Thanks

cstarner commented 6 years ago

That is very odd, and I have had no success replicating the issue on my side of things.

What version of the plugin and Jenkins are you using?

avovsya commented 6 years ago

Sorry, I'll close this one - I've found the issue and it wasn't fault of pyenv plugin but rather ShiningPanda and python configuration on Jenkins machine. As a result - virtualenv was not created by ShiningPanda.