Skip to content

Commit

Permalink
fix: mount Docker volume at run and not before
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavovalverde committed Oct 6, 2023
1 parent 2fed739 commit be48482
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/sub-deploy-integration-tests-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,9 @@ jobs:
--tags ${{ inputs.app_name }} \
--zone ${{ vars.GCP_ZONE }}
# Create a docker volume with the new disk we just created or the cached state.
#
# SSH into the just created VM and create a docker volume with the recently attached disk.
# (The cached state and disk are usually the same size,
# but the cached state can be smaller if we just increased the disk size.)
- name: Create ${{ inputs.test_id }} Docker volume
# Format the mounted disk if the test doesn't use a cached state.
- name: Format ${{ inputs.test_id }} volume
if: ${{ !inputs.needs_zebra_state || !inputs.needs_lwd_state }}
shell: /usr/bin/bash -ex {0}
run: |
gcloud compute ssh ${{ inputs.test_id }}-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
Expand All @@ -293,13 +290,7 @@ jobs:
echo 'Waiting for /dev/sdb to be free...'; \
sleep 10; \
done; \
# Check if we need to format the disk if no state is needed
if [[ "${{ inputs.needs_zebra_state }}" == "false" && "${{ inputs.needs_lwd_state }}" == "false" ]]; then
sudo mkfs.ext4 -v /dev/sdb
fi \
&& \
sudo docker volume create --driver local --opt type=ext4 --opt device=/dev/sdb \
${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }} \
sudo mkfs.ext4 -v /dev/sdb \
"
# Launch the test with the previously created disk or cached state.
Expand Down Expand Up @@ -333,11 +324,11 @@ jobs:
- name: Launch ${{ inputs.test_id }} test
shell: /usr/bin/bash -ex {0}
run: |
MOUNT_FLAGS="--mount type=volume,src=${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.zebra_state_dir }}"
MOUNT_FLAGS="--mount type=volume,volume-driver=local,volume-opt=device=/dev/sdb,volume-opt=type=ext4,dst=${{ inputs.root_state_path }}/${{ inputs.zebra_state_dir }}"
# Check if we need to mount for Lightwalletd state
if [[ "${{ inputs.needs_lwd_state }}" == "true" || "${{ inputs.test_id }}" == "lwd-full-sync" ]]; then
MOUNT_FLAGS="$MOUNT_FLAGS --mount type=volume,src=${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.lwd_state_dir }}"
MOUNT_FLAGS="$MOUNT_FLAGS --mount type=volume,volume-driver=local,volume-opt=device=/dev/sdb,volume-opt=type=ext4,dst=${{ inputs.root_state_path }}/${{ inputs.lwd_state_dir }}"
fi
gcloud compute ssh ${{ inputs.test_id }}-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
Expand Down

0 comments on commit be48482

Please sign in to comment.