Merge "Allow devs to modify images with Python directories"
This commit is contained in:
commit
1415b042f5
24
README.rst
24
README.rst
|
@ -56,7 +56,7 @@ Role Variables
|
||||||
- See modify image variables
|
- See modify image variables
|
||||||
|
|
||||||
|
|
||||||
.. list-table:: Variables used for def install
|
.. list-table:: Variables used for dev install
|
||||||
:widths: auto
|
:widths: auto
|
||||||
:header-rows: 1
|
:header-rows: 1
|
||||||
|
|
||||||
|
@ -78,6 +78,9 @@ Role Variables
|
||||||
* - `refspecs`
|
* - `refspecs`
|
||||||
- `[]`
|
- `[]`
|
||||||
- An array of project/refspec pairs that will be installed into the generated container. Currently only supports python source projects.
|
- An array of project/refspec pairs that will be installed into the generated container. Currently only supports python source projects.
|
||||||
|
* - `python_dir`
|
||||||
|
- `[]`
|
||||||
|
- Directory which contains a Python project ready to be installed with pip.
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
|
@ -188,6 +191,8 @@ code installed via pip. To minimize dependencies within the container
|
||||||
we generate the sdist locally and then copy it into the resulting
|
we generate the sdist locally and then copy it into the resulting
|
||||||
container image as an sdist tarball to run pip install locally.
|
container image as an sdist tarball to run pip install locally.
|
||||||
|
|
||||||
|
It can be used to pull a review from OpenDev Gerrit:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
|
@ -205,6 +210,23 @@ container image as an sdist tarball to run pip install locally.
|
||||||
refspec: refs/changes/12/1234/3
|
refspec: refs/changes/12/1234/3
|
||||||
modified_append_tag: -devel
|
modified_append_tag: -devel
|
||||||
|
|
||||||
|
or it can be used to build an image from a local Python directory:
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
- hosts: localhost
|
||||||
|
connection: local
|
||||||
|
tasks:
|
||||||
|
- name: dev install heat-api
|
||||||
|
import_role:
|
||||||
|
name: tripleo-modify-image
|
||||||
|
vars:
|
||||||
|
tasks_from: dev_install.yml
|
||||||
|
source_image: docker.io/tripleomaster/centos-binary-heat-api:current-tripleo
|
||||||
|
modified_append_tag: -devel
|
||||||
|
python_dir:
|
||||||
|
- /home/joe/git/openstack/heat
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
---
|
---
|
||||||
update_repo: ''
|
update_repo: ''
|
||||||
container_build_tool: 'docker'
|
container_build_tool: 'docker'
|
||||||
|
python_dir: []
|
||||||
|
refspecs: []
|
||||||
|
|
|
@ -27,6 +27,22 @@ function cherrypick {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Copy a Python directory
|
||||||
|
# $1 : Python directory to copy and install to generate a tarball.
|
||||||
|
function copy {
|
||||||
|
local PYTHON_DIR=$1
|
||||||
|
|
||||||
|
rm -rf dev
|
||||||
|
cp -r $PYTHON_DIR dev
|
||||||
|
cd dev
|
||||||
|
SKIP_GENERATE_AUTHORS=1 SKIP_WRITE_GIT_CHANGELOG=1 python setup.py sdist
|
||||||
|
cp dist/*.tar.gz ../
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p refspec_projects
|
mkdir -p refspec_projects
|
||||||
cd refspec_projects
|
cd refspec_projects
|
||||||
cherrypick $1 $2
|
if [[ "$GERRIT_MODE" == 1 ]]; then
|
||||||
|
cherrypick $1 $2
|
||||||
|
else
|
||||||
|
copy $1
|
||||||
|
fi
|
||||||
|
|
|
@ -28,8 +28,20 @@
|
||||||
|
|
||||||
- name: Git checkout the refspecs into local temp dir
|
- name: Git checkout the refspecs into local temp dir
|
||||||
command: "/bin/bash dev_install.sh {{ item.project }} {{ item.refspec }}"
|
command: "/bin/bash dev_install.sh {{ item.project }} {{ item.refspec }}"
|
||||||
|
environment:
|
||||||
|
GERRIT_MODE: 1
|
||||||
args:
|
args:
|
||||||
chdir: "{{ modify_dir_path }}"
|
chdir: "{{ modify_dir_path }}"
|
||||||
loop: "{{ refspecs }}"
|
loop: "{{ refspecs }}"
|
||||||
|
when: item > 0
|
||||||
|
|
||||||
|
- name: Copy the Python directories into local temp dir
|
||||||
|
command: "/bin/bash dev_install.sh {{ item }}"
|
||||||
|
environment:
|
||||||
|
GERRIT_MODE: 0
|
||||||
|
args:
|
||||||
|
chdir: "{{ modify_dir_path }}"
|
||||||
|
loop: "{{ python_dir }}"
|
||||||
|
when: item > 0
|
||||||
|
|
||||||
- include_tasks: modify_image.yml
|
- include_tasks: modify_image.yml
|
||||||
|
|
Loading…
Reference in New Issue