-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'auth-rpc-endpoint' into refactor-cookie-auth
- Loading branch information
Showing
7 changed files
with
86 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,17 +30,39 @@ on: | |
workflow_dispatch: | ||
inputs: | ||
network: | ||
default: 'Mainnet' | ||
default: Mainnet | ||
description: 'Network to deploy: Mainnet or Testnet' | ||
required: true | ||
log_file: | ||
default: '' | ||
description: 'Log to a file path rather than standard output' | ||
type: choice | ||
options: | ||
- Mainnet | ||
- Testnet | ||
cached_disk_type: | ||
default: tip | ||
description: 'Type of cached disk to use' | ||
required: true | ||
type: choice | ||
options: | ||
- tip | ||
- checkpoint | ||
prefer_main_cached_state: | ||
default: false | ||
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' | ||
required: false | ||
type: boolean | ||
no_cache: | ||
description: 'Disable the Docker cache for this build' | ||
required: false | ||
type: boolean | ||
default: false | ||
log_file: | ||
default: '' | ||
description: 'Log to a file path rather than standard output' | ||
|
||
push: | ||
# Skip main branch updates where Rust code and dependencies aren't modified. | ||
|
@@ -175,18 +197,19 @@ jobs: | |
test_variables: '-e NETWORK -e ZEBRA_CONF_PATH="zebrad/tests/common/configs/v1.0.0-rc.2.toml"' | ||
network: ${{ inputs.network || vars.ZCASH_NETWORK }} | ||
|
||
# Finds a `tip` cached state disk for zebra from the main branch | ||
# Finds a cached state disk for zebra | ||
# | ||
# Passes the disk name to subsequent jobs using `cached_disk_name` output | ||
# | ||
get-disk-name: | ||
name: Get disk name | ||
uses: ./.github/workflows/sub-find-cached-disks.yml | ||
if: ${{ !inputs.no_cached_disk }} | ||
with: | ||
network: ${{ inputs.network || vars.ZCASH_NETWORK }} | ||
disk_prefix: zebrad-cache | ||
disk_suffix: tip | ||
prefer_main_cached_state: true | ||
disk_suffix: ${{ inputs.cached_disk_type || 'tip' }} | ||
prefer_main_cached_state: ${{ inputs.prefer_main_cached_state || (github.event_name == 'push' && github.ref_name == 'main' && true) || false }} | ||
|
||
# Deploy Managed Instance Groups (MiGs) for Mainnet and Testnet, | ||
# with one node in the configured GCP region. | ||
|
@@ -250,14 +273,14 @@ jobs: | |
- name: Set up Cloud SDK | ||
uses: google-github-actions/[email protected] | ||
|
||
# TODO we should implement the fixes from https://github.com/ZcashFoundation/zebra/pull/5670 here | ||
# but the implementation is failing as it's requiring the disk names, contrary to what is stated in the official documentation | ||
- name: Create instance template for ${{ matrix.network }} | ||
run: | | ||
NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}" | ||
DISK_PARAMS="name=${NAME},device-name=${NAME},size=400GB,type=pd-ssd" | ||
DISK_NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}" | ||
DISK_PARAMS="name=${DISK_NAME},device-name=${DISK_NAME},size=400GB,type=pd-ssd" | ||
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 | ||
echo "No cached disk required" | ||
else | ||
echo "No cached disk found for ${{ matrix.network }} in main branch" | ||
exit 1 | ||
|
@@ -270,7 +293,7 @@ jobs: | |
--image-family=cos-stable \ | ||
--network-interface=subnet=${{ vars.GCP_SUBNETWORK }} \ | ||
--create-disk="${DISK_PARAMS}" \ | ||
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=${NAME},mode=rw \ | ||
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=${DISK_NAME},mode=rw \ | ||
--container-stdin \ | ||
--container-tty \ | ||
--container-image ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }} \ | ||
|
@@ -326,7 +349,8 @@ jobs: | |
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
if: github.event_name == 'workflow_dispatch' | ||
# Run even if we don't need a cached disk, but only when triggered by a workflow_dispatch | ||
if: ${{ !failure() && github.event_name == 'workflow_dispatch' }} | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
@@ -363,10 +387,12 @@ jobs: | |
# Create instance template from container image | ||
- name: Manual deploy of a single ${{ inputs.network }} instance running zebrad | ||
run: | | ||
NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}" | ||
DISK_PARAMS="name=${NAME},device-name=${NAME},size=400GB,type=pd-ssd" | ||
DISK_NAME="zebrad-cache-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-${NETWORK}" | ||
DISK_PARAMS="name=${DISK_NAME},device-name=${DISK_NAME},size=400GB,type=pd-ssd" | ||
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 | ||
echo "No cached disk required" | ||
else | ||
echo "No cached disk found for ${{ matrix.network }} in main branch" | ||
exit 1 | ||
|
@@ -379,7 +405,7 @@ jobs: | |
--image-family=cos-stable \ | ||
--network-interface=subnet=${{ vars.GCP_SUBNETWORK }} \ | ||
--create-disk="${DISK_PARAMS}" \ | ||
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=${NAME},mode=rw \ | ||
--container-mount-disk=mount-path='/var/cache/zebrad-cache',name=${DISK_NAME},mode=rw \ | ||
--container-stdin \ | ||
--container-tty \ | ||
--container-image ${{ vars.GAR_BASE }}/zebrad@${{ needs.build.outputs.image_digest }} \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ jobs: | |
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=default | ||
- uses: Swatinem/[email protected].3 | ||
- uses: Swatinem/[email protected].5 | ||
with: | ||
shared-key: "clippy-cargo-lock" | ||
|
||
|
@@ -138,7 +138,7 @@ jobs: | |
# We don't cache `fmt` outputs because the job is quick, | ||
# and we want to use the limited GitHub actions cache space for slower jobs. | ||
#- uses: Swatinem/[email protected].3 | ||
#- uses: Swatinem/[email protected].5 | ||
|
||
- run: | | ||
cargo fmt --all -- --check | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,7 @@ jobs: | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${{ matrix.rust }} --profile=minimal | ||
- uses: Swatinem/[email protected].3 | ||
- uses: Swatinem/[email protected].5 | ||
# TODO: change Rust cache target directory on Windows, | ||
# or remove this workaround once the build is more efficient (#3005). | ||
#with: | ||
|
@@ -221,7 +221,7 @@ jobs: | |
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal | ||
- uses: Swatinem/[email protected].3 | ||
- uses: Swatinem/[email protected].5 | ||
with: | ||
shared-key: "clippy-cargo-lock" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,7 @@ jobs: | |
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=beta --profile=default | ||
- uses: Swatinem/[email protected].3 | ||
- uses: Swatinem/[email protected].5 | ||
|
||
- name: Build internal docs | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,20 +74,30 @@ jobs: | |
- name: Set up Cloud SDK | ||
uses: google-github-actions/[email protected] | ||
|
||
# Performs formatting on disk name components. | ||
# | ||
# Disk images in GCP are required to be in lowercase, but the blockchain network | ||
# uses sentence case, so we need to downcase ${{ inputs.network }} | ||
# uses sentence case, so we need to downcase ${{ inputs.network }}. | ||
# | ||
# Disk image names in GCP are limited to 63 characters, so we need to limit | ||
# branch names to 12 characters. | ||
# Check the `create-state-image` in `sub-deploy-integration-tests-gcp.yml` for more details in image names. | ||
# More info: https://cloud.google.com/compute/docs/naming-resources#resource-name-format | ||
# | ||
# Passes a lowercase Network name to subsequent steps using $NETWORK env variable | ||
- name: Downcase network name for disks | ||
# Passes ${{ inputs.network }} to subsequent steps using $NETWORK env variable. | ||
# Passes ${{ env.GITHUB_REF_SLUG_URL }} to subsequent steps using $SHORT_GITHUB_REF env variable. | ||
- name: Format network name and branch name for disks | ||
run: | | ||
NETWORK_CAPS=${{ inputs.network }} | ||
echo "NETWORK=${NETWORK_CAPS,,}" >> $GITHUB_ENV | ||
NETWORK_CAPS="${{ inputs.network }}" | ||
echo "NETWORK=${NETWORK_CAPS,,}" >> "$GITHUB_ENV" | ||
LONG_GITHUB_REF="${{ env.GITHUB_REF_SLUG_URL }}" | ||
echo "SHORT_GITHUB_REF=${LONG_GITHUB_REF:0:12}" >> "$GITHUB_ENV" | ||
# Check if there are cached state disks available for subsequent jobs to use. | ||
- name: Check if cached state disks exists | ||
id: get-available-disks | ||
env: | ||
GITHUB_SHA_SHORT: ${{ env.GITHUB_SHA_SHORT }} | ||
GITHUB_REF: ${{ env.SHORT_GITHUB_REF }} | ||
NETWORK: ${{ env.NETWORK }} # use lowercase version from env, not input | ||
DISK_PREFIX: ${{ inputs.disk_prefix }} | ||
DISK_SUFFIX: ${{ inputs.disk_suffix }} | ||
|