Skip to content

Commit 6162b3c

Browse files
committed
ci: perform validation of Liquibase migrations during deployment
Part of #383
1 parent 90889c0 commit 6162b3c

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/main/scripts/ci/ansible/deploy.yml

+31-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,35 @@
2929
become: no
3030
delegate_to: 127.0.0.1
3131

32+
- name: Copying a candidate WAR file
33+
copy:
34+
src: "{{ local_war_dir }}/mystamps.war"
35+
dest: "{{ remote_war_dir }}/mystamps-candidate.war"
36+
owner: mystamps
37+
group: mystamps
38+
mode: '0755'
39+
40+
# The command to execute JVM is similar to ExecStart from /etc/systemd/system/mystamps.service
41+
- name: Ensuring whether Liquibase migrations are valid
42+
shell: |
43+
set -eu
44+
eval "$(sed -n '/^[A-Z]/s||export &|p' mystamps.conf)"
45+
java $JAVA_OPTS -jar mystamps-candidate.war liquibase validate
46+
args:
47+
chdir: /data/mystamps
48+
changed_when: False
49+
register: liquibase_validate
50+
51+
- name: Show stdout of liquibase validate
52+
debug:
53+
var: liquibase_validate.stdout_lines
54+
when: not liquibase_validate.failed
55+
56+
- name: Show stderr of liquibase validate
57+
debug:
58+
var: liquibase_validate.stderr_lines
59+
when: not liquibase_validate.failed
60+
3261
- name: Stopping monitoring
3362
uptimerobot:
3463
monitorid: "{{ uptimerobot.monitorid }}"
@@ -46,8 +75,9 @@
4675

4776
- name: Copying WAR file
4877
copy:
49-
src: "{{ local_war_dir }}/mystamps.war"
78+
src: "{{ remote_war_dir }}/mystamps-candidate.war"
5079
dest: "{{ remote_war_dir }}/mystamps.war"
80+
remote_src: yes
5181
owner: mystamps
5282
group: mystamps
5383
mode: '0755'

0 commit comments

Comments
 (0)