Skip to content

Commit

Permalink
Ensure virtualenv binaries use relative paths
Browse files Browse the repository at this point in the history
This works around the shebang/virtualenv path length limit.
See: pypa/pip#1773

Connects rcbops/u-suk-dev#1080
  • Loading branch information
hughsaunders committed Feb 23, 2017
1 parent 705c236 commit db3ad59
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pipeline-steps/common.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def install_ansible(){
which scl && source /opt/rh/python27/enable
if [[ ! -d ".venv" ]]; then
virtualenv --python=/opt/rh/python27/root/usr/bin/python .venv
virtualenv --relocatable .venv
fi
# hack the selinux module into the venv
cp -r /usr/lib64/python2.6/site-packages/selinux .venv/lib64/python2.7/site-packages/
Expand All @@ -16,7 +17,9 @@ def install_ansible(){
# These pip commands cannot be combined into one.
pip install -U six packaging appdirs
pip install -U setuptools pip
virtualenv --relocatable .venv
pip install -U ansible pyrax
virtualenv --relocatable .venv
"""
}

Expand Down
2 changes: 2 additions & 0 deletions pipeline-steps/horizon.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ def mitaka_prep() {
if [[ ! -d ".venv" ]]; then
pip install virtualenv
virtualenv .venv
virtualenv --relocatable .venv
fi
source .venv/bin/activate
mv ~/.pip/pip.conf ~/.pip/pip.conf.bak
pip install selenium==2.53.1
pip install -r test-requirements.txt
pip install -r requirements.txt
virtualenv --relocatable .venv
mv ~/.pip/pip.conf.bak ~/.pip/pip.conf
"""
}
Expand Down
2 changes: 2 additions & 0 deletions pipeline-steps/kibana.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ def kibana_prep(){
if [ -f ~/.pip/pip.conf ]; then
mv ~/.pip/pip.conf ~/.pip/pip.conf.bak
pip install -r requirements.txt
virtualenv --relocatable .venv
mv ~/.pip/pip.conf.bak ~/.pip/pip.conf
else
pip install -r requirements.txt
virtualenv --relocatable .venv
fi
"""
}
Expand Down
1 change: 1 addition & 0 deletions pipeline-steps/ssh_slave.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def destroy(Map args){
sh """
. ../playbooks/.venv/bin/activate
pip install jenkinsapi
virtualenv --relocatable ../playbooks/.venv
python jenkins_node.py \
delete --name "${args.instance_name}"
"""
Expand Down
1 change: 1 addition & 0 deletions playbooks/setup-jenkins-slave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
cd {{ lookup('env', 'WORKSPACE') }}/rpc-gating/playbooks
. .venv/bin/activate
pip install jenkinsapi
virtualenv --relocatable .venv
python ../scripts/jenkins_node.py \
create \
--name {{inventory_hostname}} \
Expand Down
1 change: 1 addition & 0 deletions rpc-jobs/install-jenkins-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
sh """#!/bin/bash
. .venv/bin/activate
pip install urllib3==1.18.1
virtualenv --relocatable .venv
"""
common.venvPlaybook(
playbooks: ["playbooks/install_jenkins_plugins.yml"],
Expand Down
1 change: 1 addition & 0 deletions rpc-jobs/jjb-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
source .venv/bin/activate
pip install jenkins-job-builder
virtualenv --relocatable .venv
cat > jenkins_jobs.ini << EOF
[job-builder]
Expand Down

0 comments on commit db3ad59

Please sign in to comment.