From 3719128c8d42b5d4eb7241d9942fd310515caaae Mon Sep 17 00:00:00 2001 From: steventrouble Date: Tue, 21 Nov 2023 14:50:00 -0800 Subject: [PATCH] Fix browser caching issue in deployment script When extracting the jar file, jar xf restores the timestamp of the file as it was in the jarfile. This is not ideal, because it artificially sets the change time of the file to the past, and therefore browser caches will ignore the new file. --- ansible/install-app.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/install-app.yml b/ansible/install-app.yml index 218c60b..ffc00e0 100644 --- a/ansible/install-app.yml +++ b/ansible/install-app.yml @@ -60,12 +60,12 @@ group: iam-dev mode: 0664 backup: true - register: warfile # unpack the cs.war file - name: unpack cs.war - shell: "rm -rf /data/webapps/cs; mkdir /data/webapps/cs; cd /data/webapps/cs; jar xf /data/local/wars/cs.war" - when: warfile.changed + # When unzipping, use -DD to update the last modified time of each extracted file + # Otherwise, the browser cache will not pick up the new version of the file! + shell: "rm -rf /data/webapps/cs; mkdir /data/webapps/cs; cd /data/webapps/cs; unzip -DD /data/local/wars/cs.war" notify: - restart tomcat