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

refactor(workflows): avoid using cached states for release instances #9137

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 11 additions & 7 deletions .github/workflows/cd-deploy-nodes-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ on:
description: 'Prefer cached state from the main branch'
required: false
type: boolean
no_cached_disk:
default: false
description: 'Do not use a cached state disk'
need_cached_disk:
default: true
description: 'Use a cached state disk'
required: false
type: boolean
no_cache:
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
uses: ./.github/workflows/sub-find-cached-disks.yml
# Skip PRs from external repositories, let them pass, and then GitHub's Merge Queue will check them.
# This workflow also runs on release tags, the event name check will run it on releases.
if: ${{ (!startsWith(github.event_name, 'pull') || !github.event.pull_request.head.repo.fork) && !inputs.no_cached_disk }}
if: ${{ inputs.need_cached_disk && github.event_name != 'release' && !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
with:
network: ${{ inputs.network || vars.ZCASH_NETWORK }}
disk_prefix: zebrad-cache
Expand Down Expand Up @@ -279,11 +279,15 @@ jobs:

- name: Create instance template for ${{ matrix.network }}
run: |
DISK_NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}"
if [ "${{ github.event_name }}" == "release" ]; then
DISK_NAME="zebrad-cache-${NETWORK}"
else
DISK_NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}"
fi
DISK_PARAMS="name=${DISK_NAME},device-name=${DISK_NAME},size=400GB,type=pd-balanced"
if [ -n "${{ env.CACHED_DISK_NAME }}" ]; then
DISK_PARAMS+=",image=${{ env.CACHED_DISK_NAME }}"
elif [ ${{ inputs.no_cached_disk && github.event_name == 'workflow_dispatch' }} ]; then
elif [ ${{ !inputs.need_cached_disk && github.event_name == 'workflow_dispatch' }} ]; then
echo "No cached disk required"
else
echo "No cached disk found for ${{ matrix.network }} in main branch"
Expand Down Expand Up @@ -395,7 +399,7 @@ jobs:
DISK_PARAMS="name=${DISK_NAME},device-name=${DISK_NAME},size=400GB,type=pd-balanced"
if [ -n "${{ env.CACHED_DISK_NAME }}" ]; then
DISK_PARAMS+=",image=${{ env.CACHED_DISK_NAME }}"
elif [ ${{ inputs.no_cached_disk && github.event_name == 'workflow_dispatch' }} ]; then
elif [ ${{ !inputs.need_cached_disk && github.event_name == 'workflow_dispatch' }} ]; then
echo "No cached disk required"
else
echo "No cached disk found for ${{ matrix.network }} in main branch"
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/sub-deploy-integration-tests-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,6 @@ jobs:
permissions:
contents: 'read'
id-token: 'write'
# We want to create main branch images for both dev and prod environments
strategy:
matrix:
environment: ${{ github.ref_name == 'main' && fromJSON('["dev", "prod"]') }}
environment: ${{ matrix.environment }}
steps:
- uses: actions/[email protected]
with:
Expand Down
Loading