Skip to content

Commit 8ae55dd

Browse files
committed
Refactor dev mode
Provides mechanism for future work to fix bug where when package file manifest changes, the changes were not reflected in to devmode-enabled container. It changes the strategy of installing projects in dev mode in containers. Instead of bind mounting the project's git repository to the venv of the container, the repository is bind mounted to /dev-mode/<project_name> from which the it is installed using pip on every startup of the container using kolla_install_projects script. Related-bug: #1814515 Change-Id: Ia1bdff87cba73587a03124ab78a56b21c6176373 Signed-off-by: Roman Krček <[email protected]>
1 parent c63961f commit 8ae55dd

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

docker/base/Dockerfile.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ RUN sed -ri '/-session(\s+)optional(\s+)pam_systemd.so/d' /etc/pam.d/system-auth
358358
COPY set_configs.py /usr/local/bin/kolla_set_configs
359359
COPY start.sh /usr/local/bin/kolla_start
360360
COPY copy_cacerts.sh /usr/local/bin/kolla_copy_cacerts
361+
COPY install_projects.sh /usr/local/bin/kolla_install_projects
361362
COPY httpd_setup.sh /usr/local/bin/kolla_httpd_setup
362363
COPY sudoers /etc/sudoers
363364

@@ -375,7 +376,10 @@ RUN chmod 755 /usr/local/bin/healthcheck_*
375376
{% endif %}
376377

377378
RUN touch /usr/local/bin/kolla_extend_start \
378-
&& chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_set_configs /usr/local/bin/kolla_copy_cacerts \
379+
&& chmod 755 /usr/local/bin/kolla_start \
380+
/usr/local/bin/kolla_set_configs \
381+
/usr/local/bin/kolla_copy_cacerts \
382+
/usr/local/bin/kolla_install_projects \
379383
&& chmod 644 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_httpd_setup \
380384
&& chmod 440 /etc/sudoers \
381385
&& mkdir -p /var/log/kolla \

docker/base/install_projects.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# This script finds all projects in /dev-mode folder and
4+
# installs them using pip
5+
# The projects are mounted there when dev mode is enabled for them
6+
# in kolla-ansible
7+
8+
if [ -d "/dev-mode" ]; then
9+
for project in /dev-mode/*; do
10+
pip install -U "$project"
11+
done
12+
fi

docker/base/start.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ARGS=""
1515
# Install/remove custom CA certificates
1616
sudo kolla_copy_cacerts
1717

18+
# Install projects that are in /dev-mode
19+
kolla_install_projects
20+
1821
if [[ ! "${!KOLLA_SKIP_EXTEND_START[@]}" ]]; then
1922
# Run additional commands if present
2023
. kolla_extend_start
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
fixes:
3+
- |
4+
Provides mechanism for future work to fix bug where when package file
5+
manifest changes, the changes were not reflected in to devmode-enabled
6+
container.
7+
`LP#1814515 <https://launchpad.net/bugs/1814515>`__
8+
9+
upgrade:
10+
- |
11+
Changes the strategy of installing projects in dev mode in containers.
12+
Instead of bind mounting the project's git repository to the venv
13+
of the container, the repository is bind mounted to
14+
/dev-mode/<project_name> from which the project is installed using pip
15+
on every startup of the container using kolla_install_projects script.

0 commit comments

Comments
 (0)