fix(ci): actually create a cached state image after running a sync (#4669)
* Actually create a cached state image * fix(state): use same disk naming convention for all test instances Co-authored-by: Gustavo Valverde <gustavo@iterativo.do>
This commit is contained in:
parent
c75a68e655
commit
20850b4cb4
|
@ -223,7 +223,7 @@ jobs:
|
|||
gcloud compute instances create-with-container "${{ inputs.test_id }}-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||
--boot-disk-size 100GB \
|
||||
--boot-disk-type pd-ssd \
|
||||
--create-disk image=${{ env.CACHED_DISK_NAME }},name="${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }}",device-name="${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }}",size=100GB,type=pd-ssd \
|
||||
--create-disk image=${{ env.CACHED_DISK_NAME }},name="${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }}",device-name="${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }}",size=100GB,type=pd-ssd \
|
||||
--container-image debian:buster \
|
||||
--container-restart-policy=never \
|
||||
--machine-type ${{ env.MACHINE_TYPE }} \
|
||||
|
@ -263,10 +263,10 @@ jobs:
|
|||
--command \
|
||||
"\
|
||||
docker volume create --driver local --opt type=ext4 --opt device=/dev/sdb \
|
||||
${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||
${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||
&& \
|
||||
docker run ${{ inputs.test_variables }} -t --name ${{ inputs.test_id }} \
|
||||
--mount type=volume,src=${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.zebra_state_dir }} \
|
||||
--mount type=volume,src=${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.zebra_state_dir }} \
|
||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}"
|
||||
|
||||
# SSH into the just created VM, and create a Docker container to run the incoming test
|
||||
|
@ -309,18 +309,21 @@ jobs:
|
|||
--command \
|
||||
"\
|
||||
docker volume create --driver local --opt type=ext4 --opt device=/dev/sdb \
|
||||
${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||
${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||
&& \
|
||||
docker run ${{ inputs.test_variables }} -t --name ${{ inputs.test_id }} \
|
||||
--mount type=volume,src=${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.zebra_state_dir }} \
|
||||
--mount type=volume,src=${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.lwd_state_dir }} \
|
||||
--mount type=volume,src=${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.zebra_state_dir }} \
|
||||
--mount type=volume,src=${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }},dst=${{ inputs.root_state_path }}/${{ inputs.lwd_state_dir }} \
|
||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}"
|
||||
|
||||
create-state-image:
|
||||
name: Create ${{ inputs.test_id }} cached state image
|
||||
runs-on: ubuntu-latest
|
||||
# We run exactly one of without-cached-state or with-cached-state, and we always skip the other one.
|
||||
# Normally, if a job is skipped, all the jobs that depend on it are also skipped.
|
||||
# So we need to override the default success() check to make this job run.
|
||||
needs: [ test-without-cached-state, test-with-cached-state ]
|
||||
if: ${{ inputs.saves_to_disk }}
|
||||
if: ${{ !cancelled() && !failure() && inputs.saves_to_disk }}
|
||||
permissions:
|
||||
contents: 'read'
|
||||
id-token: 'write'
|
||||
|
@ -394,7 +397,7 @@ jobs:
|
|||
run: |
|
||||
gcloud compute images create ${{ inputs.disk_prefix }}-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-v${{ env.STATE_VERSION }}-${{ env.NETWORK }}-${{ inputs.disk_suffix }} \
|
||||
--force \
|
||||
--source-disk=${{ inputs.disk_prefix }}-${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||
--source-disk=${{ inputs.test_id }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||
--source-disk-zone=${{ env.ZONE }} \
|
||||
--storage-location=us \
|
||||
--description="Created from commit ${{ env.GITHUB_SHA_SHORT }} with height ${{ env.SYNC_HEIGHT }}"
|
||||
|
|
Loading…
Reference in New Issue