Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): evaluate "if" conditions correctly and use last disk SHA #3556

Merged
merged 5 commits into from
Feb 16, 2022
Merged
Changes from 4 commits
Commits
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
16 changes: 11 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ jobs:
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --workspace -- -Zunstable-options --include-ignored

regenerate-stateful-disks:
name: Renerate state disks
name: Regenerate stateful disks
runs-on: ubuntu-latest
needs: build
outputs:
disk_short_sha: ${{ steps.disk-short-sha.outputs.disk_short_sha }}
steps:
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -197,7 +199,7 @@ jobs:

- name: Create GCP compute instance
id: create-instance
if: ${{ steps.changed-files-specific.outputs.any_changed == 'true' }} || ${{ github.event.inputs.regenerate-disks == 'true' }}
if: ${{ steps.changed-files-specific.outputs.any_changed == 'true' || github.event.inputs.regenerate-disks == 'true' }}
run: |
gcloud compute instances create-with-container "zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}" \
--boot-disk-size 100GB \
Expand Down Expand Up @@ -244,6 +246,7 @@ jobs:

- name: Regenerate stateful disks logs
id: sync-to-checkpoint
if: steps.create-instance.outcome == 'success'
run: |
gcloud compute ssh \
zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} \
Expand All @@ -267,13 +270,16 @@ jobs:
--storage-location=us \
--description="Created from head branch ${{ env.GITHUB_HEAD_REF_SLUG }} targeting ${{ env.GITHUB_BASE_REF_SLUG }} from PR ${{ env.GITHUB_REF_SLUG }} with commit ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA }}"

- name: Write the disk SHORT_SHA to a txt
- name: Output and write the disk SHORT_SHA to a txt
id: disk-short-sha
if: steps.sync-to-checkpoint.outcome == 'success'
run: |
short_sha=$(echo "${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}")
echo "$short_sha" > latest-disk-state-sha.txt
echo "::set-output name=disk_short_sha::$short_sha"

- name: Upload the disk state txt
if: steps.sync-to-checkpoint.outcome == 'success'
uses: actions/[email protected]
with:
name: latest-disk-state-sha
Expand All @@ -291,7 +297,6 @@ jobs:
name: Test blocks sync
runs-on: ubuntu-latest
needs: [ build, regenerate-stateful-disks]
if: ${{ github.event.inputs.regenerate-disks != 'true' }}
steps:
- uses: actions/[email protected]
with:
Expand All @@ -310,6 +315,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: test.yml
workflow_conclusion: ''
conradoplg marked this conversation as resolved.
Show resolved Hide resolved
name: latest-disk-state-sha
check_artifacts: true

Expand Down Expand Up @@ -355,7 +361,7 @@ jobs:
--tags zebrad \
--zone "${{ env.ZONE }}"
env:
DISK_SHORT_SHA: ${{ steps.get-disk-sha.outputs.sha }}
DISK_SHORT_SHA: ${{ needs.regenerate-stateful-disks.outputs.disk_short_sha || steps.get-disk-sha.outputs.sha }}

# TODO: this approach is very mesy, but getting the just created container name is very error prone and GCP doesn't have a workaround for this without requiring a TTY
# This TODO relates to the following issues:
Expand Down