refactor(workflows): unify environment handling across CI configurations

- Removed the optional environment input from multiple workflow files, including `manual-zcashd-deploy.yml`, `sub-build-docker-image.yml`, and `sub-deploy-integration-tests-gcp.yml`.
- Updated environment assignment logic to consistently use 'prod' for release events across `cd-deploy-nodes-gcp.yml`, `sub-build-docker-image.yml`, `sub-find-cached-disks.yml`, and `sub-deploy-integration-tests-gcp.yml`.
- Enhanced clarity in comments regarding environment strategies in `sub-deploy-integration-tests-gcp.yml`.
This commit is contained in:
Gustavo Valverde 2024-12-30 10:13:21 -04:00
parent 72c26e6f44
commit 25f4b10119
5 changed files with 5 additions and 20 deletions

View File

@ -155,7 +155,6 @@ jobs:
# 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 }}
with:
environment: ${{ github.event_name == 'release' && 'prod' || 'dev' }}
network: ${{ inputs.network || vars.ZCASH_NETWORK }}
disk_prefix: zebrad-cache
disk_suffix: ${{ inputs.cached_disk_type || 'tip' }}
@ -175,7 +174,6 @@ jobs:
image_name: zebrad
no_cache: ${{ inputs.no_cache || false }}
rust_log: info
environment: ${{ github.event_name == 'release' && 'prod' || 'dev' }}
# This step needs access to Docker Hub secrets to run successfully
secrets: inherit
@ -241,7 +239,7 @@ jobs:
timeout-minutes: 60
env:
CACHED_DISK_NAME: ${{ needs.get-disk-name.outputs.cached_disk_name }}
environment: ${{ github.event_name == 'release' && 'prod' || 'dev' }}
environment: ${{ github.event_name == 'release' && 'prod' }}
permissions:
contents: 'read'
id-token: 'write'

View File

@ -10,9 +10,6 @@ name: Zcashd Manual Deploy
on:
workflow_dispatch:
inputs:
environment:
required: false
default: dev
network:
default: 'Mainnet'
description: 'Network to deploy: Mainnet or Testnet'

View File

@ -10,11 +10,6 @@ name: Build docker image
on:
workflow_call:
inputs:
environment:
description: 'The infra environment to build the image for'
required: false
default: dev
type: string
image_name:
required: true
type: string
@ -75,7 +70,7 @@ jobs:
name: Build images
timeout-minutes: 210
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
environment: ${{ github.event_name == 'release' && 'prod' }}
outputs:
image_digest: ${{ steps.docker_build.outputs.digest }}
image_name: ${{ fromJSON(steps.docker_build.outputs.metadata)['image.name'] }}

View File

@ -3,10 +3,6 @@ name: Deploy Tests to GCP
on:
workflow_call:
inputs:
environment:
required: false
default: dev
type: string
# Status and logging
test_id:
required: true
@ -388,11 +384,10 @@ jobs:
permissions:
contents: 'read'
id-token: 'write'
# We want to create images for both dev and prod environments,
# but for prod we only want to create images from the main branch
# We want to create main branch images for both dev and prod environments
strategy:
matrix:
environment: ${{ github.ref_name == 'main' && fromJSON('["dev", "prod"]') || fromJSON('["dev"]') }}
environment: ${{ github.ref_name == 'main' && fromJSON('["dev", "prod"]') }}
environment: ${{ matrix.environment }}
steps:
- uses: actions/checkout@v4.2.2

View File

@ -48,7 +48,7 @@ jobs:
get-cached-disks:
name: Get ${{ inputs.test_id || inputs.network }} cached disk
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
environment: ${{ github.event_name == 'release' && 'prod' }}
outputs:
state_version: ${{ steps.get-available-disks.outputs.state_version }}
cached_disk_name: ${{ steps.get-available-disks.outputs.cached_disk_name }}