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

Unable to migrate out of pyenv-pipeline-plugin 1.0.4 to 2.0.0 #21

Closed emman27 closed 5 years ago

emman27 commented 5 years ago

Raising this issue as a result of not being able to migrate out. Here's the workflow I'm stuck in:

I have >100 pipelines on my Jenkins instance, many of them using this plugin. The current syntax is

withPythonEnv('Python2.7') {
  pysh 'python something.py'
}

Upgrading the plugin immediately breaks all these pipelines.

Alternatively, if I change the pipelines first to

withPythonEnv('Python2.7') {
  sh 'python something.py'
}

then pipelines are immediately broken

Suggesting to have an intermediate release where both syntaxes are supported to ease the migration pain.

cstarner commented 5 years ago

I can certainly add in temporary support for the older steps. That said, it would be helpful if you could show me what is breaking with the new sh statements

On Tue, Sep 4, 2018, 7:15 PM Emmanuel Goh notifications@github.com wrote:

Raising this issue as a result of not being able to migrate out. Here's the workflow I'm stuck in:

I have >100 pipelines on my Jenkins instance, many of them using this plugin. The current syntax is

withPythonEnv('Python2.7') { pysh 'python something.py' }

Upgrading the plugin immediately breaks all these pipelines.

Alternatively, if I change the pipelines first to

withPythonEnv('Python2.7') { sh 'python something.py' }

then pipelines are immediately broken

Suggesting to have an intermediate release where both syntaxes are supported to ease the migration pain.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jenkinsci/pyenv-pipeline-plugin/issues/21, or mute the thread https://github.com/notifications/unsubscribe-auth/AKQ39LLUNuZehGls2gRMoR8crqJiS6L2ks5uXyW3gaJpZM4WaBIG .

emman27 commented 5 years ago

Here are the relevant log (1.0.4), and the relevant section of the pipeline. Seems to dislike the sh step inside the block for some reason.

withPythonEnv('python2.7') {
            sh 'pip install --user -r requirements.txt'
            sh 'pytest --cov'
            sh 'codecov --token=token
}
$ python2.7 -m virtualenv --python=python2.7 /home/jenkins/workspace/s-utilities_feature_jenkins-4VIPT3TFSI2FDL7JYJGVU3H4A5K3SNOQHIZDX3XMFEDKP7RUO4BQ/.pyenv-python2.7
[Pipeline] {
[Pipeline] sh
[serverless] Running shell script
nohup: failed to run command 'sh': No such file or directory
process apparently never started in /home/jenkins/workspace/s-utilities_feature_jenkins-4VIPT3TFSI2FDL7JYJGVU3H4A5K3SNOQHIZDX3XMFEDKP7RUO4BQ/serverless@tmp/durable-66cc8114
cstarner commented 5 years ago

I would wager this is related to the way that I'm handling the changes to the PATH variable, and constitutes a bug in 2.0.0. I can also add backwards compatible pysh and pybat statements, but I think that there is something deeper going on here

cstarner commented 5 years ago

I've released a beta version with a fix that I believe will solve your issues. Would you mind testing it out in your environment? It's release pyenv-pipeline-2.0.1-beta. In order to access it through the Jenkins Plugin manager, you'll need to enable Experimental Plugins in a Jenkins instance.

You can read more details here: https://jenkins.io/doc/developer/publishing/releasing-experimental-updates/

Let me know if this fixes your problem.

cstarner commented 5 years ago

I should note that this change is directed at the 'sh': No such file or directory portion of the issue. I have not yet added back in the pysh and pybat steps, since my plan for their support is going to be empty extensions of the Durable Task equivalents. If sh is failing for you, my intended reinclusion of pysh would fail also

cstarner commented 5 years ago

I've added the pysh and pybat steps back in. Due to inactivity, I will am closing this

emman27 commented 5 years ago

Thanks @cstarner !