Allow devs to modify images with Python directories
This will allow dev to update their container images from a local Python directory, example in /home/joe/git/openstack/heat. The new parameter python_dir is a list of directories. To use it, your playbook must be like: - 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 Change-Id: I182c3fa58dc9af870e0da9f51ae1e22aa90d03e5
This commit is contained in:
parent
8b366d2a27
commit
b25fe2590c
24
README.rst
24
README.rst
|
@ -56,7 +56,7 @@ Role Variables
|
|||
- See modify image variables
|
||||
|
||||
|
||||
.. list-table:: Variables used for def install
|
||||
.. list-table:: Variables used for dev install
|
||||
:widths: auto
|
||||
:header-rows: 1
|
||||
|
||||
|
@ -78,6 +78,9 @@ Role Variables
|
|||
* - `refspecs`
|
||||
- `[]`
|
||||
- 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
|
||||
|
@ -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
|
||||
container image as an sdist tarball to run pip install locally.
|
||||
|
||||
It can be used to pull a review from OpenDev Gerrit:
|
||||
|
||||
.. code-block::
|
||||
|
||||
- hosts: localhost
|
||||
|
@ -205,6 +210,23 @@ container image as an sdist tarball to run pip install locally.
|
|||
refspec: refs/changes/12/1234/3
|
||||
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
|
||||
-------
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
---
|
||||
update_repo: ''
|
||||
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
|
||||
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
|
||||
command: "/bin/bash dev_install.sh {{ item.project }} {{ item.refspec }}"
|
||||
environment:
|
||||
GERRIT_MODE: 1
|
||||
args:
|
||||
chdir: "{{ modify_dir_path }}"
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue