Skip to content

Commit

Permalink
refactor(workflows): avoid using cached states for release instances (#…
Browse files Browse the repository at this point in the history
…9137)

- Renamed `no_cached_disk` input to `need_cached_disk` in `cd-deploy-nodes-gcp.yml` to clarify its purpose.
- Adjusted conditional logic for cached disk usage based on event types (release vs. non-release) in `cd-deploy-nodes-gcp.yml`.
- Removed the environment strategy matrix from `sub-deploy-integration-tests-gcp.yml` to simplify the workflow configuration.
- Enhanced comments for better clarity on caching and environment handling across workflows.
  • Loading branch information
gustavovalverde authored Jan 20, 2025
1 parent 94e0d81 commit c7d8d71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
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

0 comments on commit c7d8d71

Please sign in to comment.