Skip to content

Commit

Permalink
Use lowercase network labels
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Nov 23, 2022
1 parent 8bec740 commit 5f8eb12
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/continous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
17 changes: 14 additions & 3 deletions .github/workflows/deploy-gcp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/zcashd-manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5f8eb12

Please sign in to comment.