Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
20774f6
Adding SquashFS option to syncing.
gregharvey Jun 13, 2022
7f3e750
Make 'tarball' the default mount type so nothing existing breaks.
gregharvey Jun 13, 2022
0b17bb5
Altering deploy_path so we can build in another location for SquashFS…
gregharvey Jun 14, 2022
0b380de
Ensuring the build dir exists if doing a SquashFS build.
gregharvey Jun 14, 2022
7d8a9ac
Force symlink creation as the deploy dir may not exist yet.
gregharvey Jun 14, 2022
307ac67
Running mount commands with sudo.
gregharvey Jun 15, 2022
4424413
Tweaking link command and destination for live links.
gregharvey Jun 15, 2022
7e39641
Slight bug in link path handling for SquashFS.
gregharvey Jun 15, 2022
2bb6459
Checking for existing mount and using remount operation.
gregharvey Jun 15, 2022
f076147
Stop ce-deploy trying to delete from read-only SquashFS mount.
gregharvey Jun 15, 2022
6c7d2c9
Formatting error, these special jinja2 things are not filters - no sp…
gregharvey Jun 15, 2022
5e145d4
Reloading services to make sure mounting doesn't fail.
gregharvey Jun 16, 2022
57ed6e3
Picking more sensible loop var name.
gregharvey Jun 16, 2022
1b66af2
Moving to shell for mount check and fixing jinja2 filter names.
gregharvey Jun 16, 2022
9db2899
Trying with the posix mount module instead of command.
gregharvey Jun 16, 2022
169a5f7
Working through user/sudo issues.
gregharvey Jun 16, 2022
e878aab
Altering symlink handling slightly so we have the deploy directory al…
gregharvey Jun 16, 2022
d56accb
Merge branch '1.x' into squashfs
gregharvey Jun 16, 2022
c45db1d
Simplifying 'when' checks.
gregharvey Jun 16, 2022
b930652
Adding a revert behaviour for SquashFS.
gregharvey Jun 23, 2022
d8269c9
Merging 1.x.
gregharvey Jun 23, 2022
869da7d
Merge branch '1.x' into squashfs-PR-1.x
gregharvey Jun 23, 2022
326ab3e
Merge branch 'squashfs' into squashfs-PR-1.x
gregharvey Jun 23, 2022
4f7aa25
Making some wording a little less ambiguous.
gregharvey Jun 23, 2022
ad7b220
Merge branch 'squashfs' into squashfs-PR-1.x
gregharvey Jun 23, 2022
7be01a2
Fixing bad image path and adding clauses to stat check.
gregharvey Jun 29, 2022
9a34ae1
Merge branch '1.x' into squashfs-PR-1.x
gregharvey Jun 29, 2022
bdb48ec
Merge branch 'squashfs' into squashfs-PR-1.x
gregharvey Jun 29, 2022
1f12a90
Trying to make remounting SquashFS images a bit safer.
gregharvey Jun 29, 2022
d5688bd
Merge branch 'squashfs' into squashfs-PR-1.x
gregharvey Jun 29, 2022
edf02be
Adding when clauses to SquashFS image path check.
gregharvey Jun 29, 2022
0e8922f
Merge branch 'squashfs' into squashfs-PR-1.x
gregharvey Jun 29, 2022
abe7fe4
Removing revert code, as it cannot work.
gregharvey Jun 29, 2022
4d9eab7
Merge branch 'squashfs' into squashfs-PR-1.x
gregharvey Jun 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 42 additions & 22 deletions roles/deploy_code/tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@
- deploy_code.mount_type == "tarball"
run_once: true

- name: Ensure older SquashFS images are deleted.
ansible.builtin.file:
path: "{{ build_base_path }}/deploy.sqsh"
state: absent
when:
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"
run_once: true

- name: Create a SquashFS image of the deployed codebases.
ansible.builtin.command:
cmd: "mksquashfs {{ build_base_path }} /tmp/{{ project_name }}_{{ build_type }}.sqsh"
Expand Down Expand Up @@ -96,6 +86,36 @@
- deploy_code.mount_type == "squashfs"
run_once: true

- name: Check if we have a SquashFS image already there.
ansible.builtin.stat:
path: "{{ build_base_path }}/deploy.sqsh"
register: _deploy_code_mount_image
when:
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"

- name: Copy previous SquashFS image in case of rollback.
ansible.builtin.copy:
remote_src: true
force: true
src: "{{ build_base_path }}/deploy.sqsh"
dest: "{{ build_base_path }}/deploy_previous.sqsh"
when:
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"
- _deploy_code_mount_image.stat.islnk is defined

- name: Ensure mounted SquashFS image is deleted.
ansible.builtin.file:
path: "{{ build_base_path }}/deploy.sqsh"
state: absent
when:
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"

- name: Copy SquashFS image to local server.
ansible.builtin.command:
cmd: "cp {{ deploy_code.mount_sync }}/{{ project_name }}_{{ build_type }}.sqsh {{ build_base_path }}/deploy.sqsh"
Expand All @@ -108,21 +128,11 @@
ansible.builtin.shell:
cmd: "mount | grep {{ deploy_base_path }}"
ignore_errors: true
register: _mount_check
when:
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"

- name: Unmount existing SquashFS image.
ansible.builtin.command:
cmd: "umount -l {{ deploy_base_path }}"
become: true
register: _deploy_code_mount_check
when:
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"
- _mount_check is succeeded

- name: Reload any services that might be keeping the loop device busy.
ansible.builtin.service:
Expand All @@ -136,9 +146,19 @@
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"
- _mount_check is succeeded
- _deploy_code_mount_check is succeeded
- deploy_code.services | length > 0

- name: Unmount existing SquashFS image.
ansible.builtin.command:
cmd: "umount {{ deploy_base_path }}"
become: true
when:
- deploy_code.mount_sync is defined
- deploy_code.mount_sync | length > 1
- deploy_code.mount_type == "squashfs"
- _deploy_code_mount_check is succeeded

- name: Mount new SquashFS image.
ansible.builtin.command:
cmd: "mount {{ build_base_path }}/deploy.sqsh {{ deploy_base_path }} -t squashfs -o loop"
Expand Down