Mercurial > kallithea
comparison Jenkinsfile @ 6550:ad275fcc5a90
jenkinsfile: create venv in special folder instead of jenkins workspace
The path to a jenkins workspace tends to get very long. But the maximum for a
shebang line is usually 127 characters. This can cause problems with git hook
scripts or when calling pip. To avoid these problems create the virtualenv
in the a folder under $JENKINS_HOME which is usually much shorter.
author | domruf <dominikruf@gmail.com> |
---|---|
date | Thu, 23 Mar 2017 22:20:35 +0100 |
parents | f65f8acaca84 |
children | bc1b11a5d548 |
comparison
equal
deleted
inserted
replaced
6549:f65f8acaca84 | 6550:ad275fcc5a90 |
---|---|
1 node { | 1 node { |
2 def createvirtualenv = '' | |
2 def activatevirtualenv = '' | 3 def activatevirtualenv = '' |
3 if (isUnix()) { | 4 if (isUnix()) { |
4 activatevirtualenv = '. venv/bin/activate' | 5 createvirtualenv = 'rm -r $JENKINS_HOME/venv/$JOB_NAME || true && virtualenv $JENKINS_HOME/venv/$JOB_NAME' |
6 activatevirtualenv = '. $JENKINS_HOME/venv/$JOB_NAME/bin/activate' | |
5 } else { | 7 } else { |
6 activatevirtualenv = 'call venv\\Scripts\\activate.bat' | 8 createvirtualenv = 'rmdir /s /q %JENKINS_HOME%\\venv\\%JOB_NAME% || true && virtualenv %JENKINS_HOME%\\venv\\%JOB_NAME%' |
9 activatevirtualenv = 'call %JENKINS_HOME%\\venv\\%JOB_NAME%\\Scripts\\activate.bat' | |
7 } | 10 } |
8 | 11 |
9 stage('checkout') { | 12 stage('checkout') { |
10 checkout scm | 13 checkout scm |
11 if (isUnix()) { | 14 if (isUnix()) { |
13 } else { | 16 } else { |
14 bat 'hg --config extensions.purge= purge --all' | 17 bat 'hg --config extensions.purge= purge --all' |
15 } | 18 } |
16 } | 19 } |
17 stage('virtual env') { | 20 stage('virtual env') { |
18 def virtualenvscript = """virtualenv venv | 21 def virtualenvscript = """$createvirtualenv |
19 $activatevirtualenv | 22 $activatevirtualenv |
20 python -m pip install --upgrade pip | 23 python -m pip install --upgrade pip |
21 pip install --upgrade setuptools | 24 pip install --upgrade setuptools |
22 pip install --upgrade pylint | 25 pip install --upgrade pylint |
23 pip install --upgrade pytest-cov | 26 pip install --upgrade pytest-cov |