From 5f8eb125e2a2e972d42d055703c81523f856ea8b Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 24 Nov 2022 08:04:37 +1000 Subject: [PATCH] Use lowercase network labels --- .github/workflows/continous-delivery.yml | 17 ++++++++++++++--- .github/workflows/deploy-gcp-tests.yml | 17 ++++++++++++++--- .github/workflows/zcashd-manual-deploy.yml | 13 ++++++++++++- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continous-delivery.yml b/.github/workflows/continous-delivery.yml index 4ce3a0f05cd..66cb9c01939 100644 --- a/.github/workflows/continous-delivery.yml +++ b/.github/workflows/continous-delivery.yml @@ -40,7 +40,7 @@ jobs: # - If our semver is `v1.3.0` the resulting output from this job would be `v1` # # Note: We just use the first part of the version to replace old instances, and change - # it when a major version is released, to keep a segregation between new and old + # it when a major version is released, to keep a segregation between new and old # versions. versioning: name: Versioning @@ -104,6 +104,17 @@ jobs: with: short-length: 7 + # Makes the Zcash network name lowercase. + # + # Labels in GCP are required to be in lowercase, but the blockchain network + # uses sentence case, so we need to downcase ${{ inputs.network || env.DEFAULT_NETWORK }}. + # + # Passes the lowercase network to subsequent steps using $NETWORK env variable. + - name: Downcase network name for labels + run: | + NETWORK_CAPS=${{ inputs.network || env.DEFAULT_NETWORK }} + echo "NETWORK=${NETWORK_CAPS,,}" >> $GITHUB_ENV + # Setup gcloud CLI - name: Authenticate to Google Cloud id: auth @@ -127,7 +138,7 @@ jobs: --container-mount-disk mount-path="/zebrad-cache",name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }} \ --machine-type ${{ env.MACHINE_TYPE }} \ --scopes cloud-platform \ - --labels=app=zebrad,environment=prod,network=${{ inputs.network || env.DEFAULT_NETWORK }},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \ + --labels=app=zebrad,environment=prod,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \ --tags zebrad # Check if our destination instance group exists already @@ -208,5 +219,5 @@ jobs: --container-mount-disk mount-path='/zebrad-cache',name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }} \ --machine-type ${{ env.MACHINE_TYPE }} \ --zone ${{ env.ZONE }} \ - --labels=app=zebrad,environment=qa,network=${{ inputs.network || env.DEFAULT_NETWORK }},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \ + --labels=app=zebrad,environment=qa,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \ --tags zebrad diff --git a/.github/workflows/deploy-gcp-tests.yml b/.github/workflows/deploy-gcp-tests.yml index 1a4c27b484a..3c5c25c89f6 100644 --- a/.github/workflows/deploy-gcp-tests.yml +++ b/.github/workflows/deploy-gcp-tests.yml @@ -125,6 +125,17 @@ jobs: with: short-length: 7 + # Makes the Zcash network name lowercase. + # + # Labels in GCP are required to be in lowercase, but the blockchain network + # uses sentence case, so we need to downcase ${{ inputs.network }}. + # + # Passes ${{ inputs.network }} to subsequent steps using $NETWORK env variable. + - name: Downcase network name for labels + run: | + NETWORK_CAPS=${{ inputs.network }} + echo "NETWORK=${NETWORK_CAPS,,}" >> $GITHUB_ENV + # Install our SSH secret - name: Install private SSH key uses: shimataro/ssh-key-action@v2.4.0 @@ -163,7 +174,7 @@ jobs: --scopes cloud-platform \ --metadata=google-monitoring-enabled=TRUE,google-logging-enabled=TRUE \ --metadata-from-file=startup-script=.github/workflows/scripts/gcp-vm-startup-script.sh \ - --labels=app=${{ inputs.app_name }},environment=test,network=${{ inputs.network }},github_ref=${{ env.GITHUB_REF_SLUG_URL }},test=${{ inputs.test_id }} \ + --labels=app=${{ inputs.app_name }},environment=test,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }},test=${{ inputs.test_id }} \ --tags ${{ inputs.app_name }} \ --zone ${{ env.ZONE }} sleep 60 @@ -272,7 +283,7 @@ jobs: with: short-length: 7 - - name: Downcase network name for disks + - name: Downcase network name for disks and labels run: | NETWORK_CAPS=${{ inputs.network }} echo "NETWORK=${NETWORK_CAPS,,}" >> $GITHUB_ENV @@ -404,7 +415,7 @@ jobs: --scopes cloud-platform \ --metadata=google-monitoring-enabled=TRUE,google-logging-enabled=TRUE \ --metadata-from-file=startup-script=.github/workflows/scripts/gcp-vm-startup-script.sh \ - --labels=app=${{ inputs.app_name }},environment=test,network=${{ inputs.network }},github_ref=${{ env.GITHUB_REF_SLUG_URL }},test=${{ inputs.test_id }} \ + --labels=app=${{ inputs.app_name }},environment=test,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }},test=${{ inputs.test_id }} \ --tags ${{ inputs.app_name }} \ --zone ${{ env.ZONE }} sleep 60 diff --git a/.github/workflows/zcashd-manual-deploy.yml b/.github/workflows/zcashd-manual-deploy.yml index 89c488ed4af..b74e864513c 100644 --- a/.github/workflows/zcashd-manual-deploy.yml +++ b/.github/workflows/zcashd-manual-deploy.yml @@ -37,6 +37,17 @@ jobs: with: short-length: 7 + # Performs formatting on the Zcash network name. + # + # Labels in GCP are required to be in lowercase, but the blockchain network + # uses sentence case, so we need to downcase ${{ inputs.network }}. + # + # Passes ${{ inputs.network }} to subsequent steps using $NETWORK env variable. + - name: Format network name for labels + run: | + NETWORK_CAPS=${{ inputs.network }} + echo "NETWORK=${NETWORK_CAPS,,}" >> $GITHUB_ENV + # Setup gcloud CLI - name: Authenticate to Google Cloud id: auth @@ -64,7 +75,7 @@ jobs: --machine-type ${{ env.MACHINE_TYPE }} \ --service-account ${{ env.DEPLOY_SA }} \ --scopes cloud-platform \ - --labels=app=zcashd,environment=prod,network=${{ inputs.network }},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \ + --labels=app=zcashd,environment=prod,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \ --tags zcashd # Check if our destination instance group exists already