[PATCH v3 01/16] docker: Don't force rebuilds
dja at axtens.net
Wed Nov 30 08:18:28 AEDT 2016
> It's frustrating to have to rebuild the Docker image everytime the
> requirements change. Simply warn the user instead and let them take the
> intiative where necessary.
I'm worried that this will cause some quirky, difficult to debug and
difficult to reproduce issues. Having said that, I do appreciate that
having to rebuild is annoying, and that you do it more than I do!
I have this completely untested suggestion:
diff --git a/tools/docker/entrypoint.sh b/tools/docker/entrypoint.sh
index 5a23fa36b9cb..da48608b2b2b 100755
@@ -37,12 +37,22 @@ if [ ! -f ~patchwork/patchwork/tools/docker/entrypoint.sh ]; then
# check if we need to rebuild because requirements changed
+# allow the user to override with "--force-requirements"
+if [[ "$1" == "--force-requirements" ]]; then
for x in /tmp/requirements-*.txt; do
if ! cmp $x ~/patchwork/$(basename $x); then
echo "A requirements file has changed."
echo "Please rebuild the patchwork image:"
echo " docker-compose build web"
- exit 1
+ if [[ "$FORCE_REQUIREMENTS" == 1 ]]; then
+ echo "WARNING: Proceeding anyway as requested."
+ exit 1
This will force you to explicitly override the requirements. My hope is
that requiring this more active step to do something dangerous will make
you more likely to remember that you're in the danger zone and thus
remember to do a build when convenient.
Also this probably doesn't need to be part of this series.
> Signed-off-by: Stephen Finucane <stephen at that.guru>
> tools/docker/entrypoint.sh | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> diff --git a/tools/docker/entrypoint.sh b/tools/docker/entrypoint.sh
> index 5a23fa3..d06b271 100755
> --- a/tools/docker/entrypoint.sh
> +++ b/tools/docker/entrypoint.sh
> @@ -40,9 +40,8 @@ fi
> for x in /tmp/requirements-*.txt; do
> if ! cmp $x ~/patchwork/$(basename $x); then
> echo "A requirements file has changed."
> - echo "Please rebuild the patchwork image:"
> + echo "You may need to rebuild this image:"
> echo " docker-compose build web"
> - exit 1
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
More information about the Patchwork