refactor(build): use OCI Image Format Specification for labels (#3728)
* refactor(build): use OCI Image Format Specification for labels This should also fix when an image gets built multiple times using the cache, as each image differs in labels * refactor(tags): use PR context sha and ref Remove the needed of PR Head SHA and Ref, as those can cause conflict depending on how the branch name has been established
This commit is contained in:
parent
e7af51db3a
commit
5004c4d3a1
|
@ -35,6 +35,25 @@ jobs:
|
||||||
- name: Inject slug/short variables
|
- name: Inject slug/short variables
|
||||||
uses: rlespinasse/github-slug-action@v4
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
|
||||||
|
# Automatic tag management and OCI Image Format Specification for labels
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3.6.2
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
${{ env.GAR_BASE }}/${{ env.GITHUB_REF_SLUG_URL }}
|
||||||
|
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.GITHUB_REF_SLUG_URL }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
# Setup gcloud CLI
|
# Setup gcloud CLI
|
||||||
- name: Authenticate to Google Cloud
|
- name: Authenticate to Google Cloud
|
||||||
id: auth
|
id: auth
|
||||||
|
@ -79,11 +98,8 @@ jobs:
|
||||||
platforms: |
|
platforms: |
|
||||||
linux/amd64
|
linux/amd64
|
||||||
linux/arm64
|
linux/arm64
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ env.GAR_BASE }}/${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}:latest
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
${{ env.GAR_BASE }}/${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}:${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}:latest
|
|
||||||
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}:${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
build-args: |
|
build-args: |
|
||||||
NETWORK=${{ github.event.inputs.network || env.NETWORK }}
|
NETWORK=${{ github.event.inputs.network || env.NETWORK }}
|
||||||
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
||||||
|
@ -124,9 +140,9 @@ jobs:
|
||||||
|
|
||||||
- name: Create instance template
|
- name: Create instance template
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-templates create-with-container zebrad-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
|
gcloud compute instance-templates create-with-container zebrad-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--boot-disk-type=pd-ssd \
|
--boot-disk-type=pd-ssd \
|
||||||
--container-image ${{ env.GAR_BASE }}/${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}:${{ env.GITHUB_SHA_SHORT }} \
|
--container-image ${{ env.GAR_BASE }}/${{ env.GITHUB_REF_SLUG_URL }}:${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--create-disk name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }},auto-delete=yes,size=100GB,type=pd-ssd \
|
--create-disk name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }},auto-delete=yes,size=100GB,type=pd-ssd \
|
||||||
--container-mount-disk mount-path="/zebrad-cache",name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }} \
|
--container-mount-disk mount-path="/zebrad-cache",name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--machine-type ${{ env.MACHINE_TYPE }} \
|
--machine-type ${{ env.MACHINE_TYPE }} \
|
||||||
|
@ -138,15 +154,15 @@ jobs:
|
||||||
id: does-group-exist
|
id: does-group-exist
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-groups list | grep "zebrad-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}" | grep "${{ env.REGION }}"
|
gcloud compute instance-groups list | grep "zebrad-${{ env.GITHUB_REF_SLUG_URL }}" | grep "${{ env.REGION }}"
|
||||||
|
|
||||||
# Deploy new managed instance group using the new instance template
|
# Deploy new managed instance group using the new instance template
|
||||||
- name: Create managed instance group
|
- name: Create managed instance group
|
||||||
if: steps.does-group-exist.outcome == 'failure'
|
if: steps.does-group-exist.outcome == 'failure'
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-groups managed create \
|
gcloud compute instance-groups managed create \
|
||||||
"zebrad-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}" \
|
"zebrad-${{ env.GITHUB_REF_SLUG_URL }}" \
|
||||||
--template "zebrad-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
--template "zebrad-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--health-check zebrad-tracing-filter \
|
--health-check zebrad-tracing-filter \
|
||||||
--initial-delay 30 \
|
--initial-delay 30 \
|
||||||
--region "${{ env.REGION }}" \
|
--region "${{ env.REGION }}" \
|
||||||
|
@ -157,8 +173,8 @@ jobs:
|
||||||
if: steps.does-group-exist.outcome == 'success'
|
if: steps.does-group-exist.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-groups managed rolling-action start-update \
|
gcloud compute instance-groups managed rolling-action start-update \
|
||||||
"zebrad-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}" \
|
"zebrad-${{ env.GITHUB_REF_SLUG_URL }}" \
|
||||||
--version template="zebrad-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
--version template="zebrad-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--region "${{ env.REGION }}"
|
--region "${{ env.REGION }}"
|
||||||
|
|
||||||
deploy-instance:
|
deploy-instance:
|
||||||
|
@ -191,12 +207,12 @@ jobs:
|
||||||
# Create instance template from container image
|
# Create instance template from container image
|
||||||
- name: Manual deploy of a single instance running zebrad
|
- name: Manual deploy of a single instance running zebrad
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instances create-with-container "zebrad-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
gcloud compute instances create-with-container "zebrad-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--boot-disk-size 100GB \
|
--boot-disk-size 100GB \
|
||||||
--boot-disk-type=pd-ssd \
|
--boot-disk-type=pd-ssd \
|
||||||
--container-stdin \
|
--container-stdin \
|
||||||
--container-tty \
|
--container-tty \
|
||||||
--container-image ${{ env.GAR_BASE }}/${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}:${{ env.GITHUB_SHA_SHORT }} \
|
--container-image ${{ env.GAR_BASE }}/${{ env.GITHUB_REF_SLUG_URL }}:${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--create-disk name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }},auto-delete=yes,size=100GB,type=pd-ssd \
|
--create-disk name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }},auto-delete=yes,size=100GB,type=pd-ssd \
|
||||||
--container-mount-disk mount-path='/zebrad-cache',name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }} \
|
--container-mount-disk mount-path='/zebrad-cache',name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--machine-type ${{ env.MACHINE_TYPE }} \
|
--machine-type ${{ env.MACHINE_TYPE }} \
|
||||||
|
|
|
@ -62,6 +62,25 @@ jobs:
|
||||||
- name: Inject slug/short variables
|
- name: Inject slug/short variables
|
||||||
uses: rlespinasse/github-slug-action@v4
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
|
||||||
|
# Automatic tag management and OCI Image Format Specification for labels
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3.6.2
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}
|
||||||
|
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.IMAGE_NAME }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
# Setup Docker Buildx to allow use of docker cache layers from GH
|
# Setup Docker Buildx to allow use of docker cache layers from GH
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
|
@ -89,14 +108,11 @@ jobs:
|
||||||
target: tester
|
target: tester
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile
|
file: ./docker/Dockerfile
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:latest
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}
|
|
||||||
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}
|
|
||||||
build-args: |
|
build-args: |
|
||||||
NETWORK=${{ github.event.inputs.network || env.NETWORK }}
|
NETWORK=${{ github.event.inputs.network || env.NETWORK }}
|
||||||
SHORT_SHA=${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}
|
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
||||||
RUST_BACKTRACE=full
|
RUST_BACKTRACE=full
|
||||||
ZEBRA_SKIP_NETWORK_TESTS="1"
|
ZEBRA_SKIP_NETWORK_TESTS="1"
|
||||||
CHECKPOINT_SYNC=${{ github.event.inputs.checkpoint_sync || true }}
|
CHECKPOINT_SYNC=${{ github.event.inputs.checkpoint_sync || true }}
|
||||||
|
@ -122,8 +138,8 @@ jobs:
|
||||||
|
|
||||||
- name: Run all zebrad tests
|
- name: Run all zebrad tests
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --workspace -- --include-ignored
|
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --workspace -- --include-ignored
|
||||||
|
|
||||||
test-fake-activation-heights:
|
test-fake-activation-heights:
|
||||||
name: Test with fake activation heights
|
name: Test with fake activation heights
|
||||||
|
@ -140,8 +156,8 @@ jobs:
|
||||||
|
|
||||||
- name: Run tests with fake activation heights
|
- name: Run tests with fake activation heights
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} cargo test --locked --release --package zebra-state --lib -- with_fake_activation_heights
|
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --package zebra-state --lib -- with_fake_activation_heights
|
||||||
|
|
||||||
# Test that Zebra syncs and checkpoints a few thousand blocks from an empty state
|
# Test that Zebra syncs and checkpoints a few thousand blocks from an empty state
|
||||||
test-empty-sync:
|
test-empty-sync:
|
||||||
|
@ -159,8 +175,8 @@ jobs:
|
||||||
|
|
||||||
- name: Run zebrad large sync tests
|
- name: Run zebrad large sync tests
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance sync_large_checkpoints_ -- --ignored
|
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance sync_large_checkpoints_ -- --ignored
|
||||||
|
|
||||||
test-lightwalletd-integration:
|
test-lightwalletd-integration:
|
||||||
name: Test integration with lightwalletd
|
name: Test integration with lightwalletd
|
||||||
|
@ -177,8 +193,8 @@ jobs:
|
||||||
|
|
||||||
- name: Run tests with included lightwalletd binary
|
- name: Run tests with included lightwalletd binary
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/zebrad-test:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS -e ZEBRA_TEST_LIGHTWALLETD --name zebrad-tests -t ${{ env.GAR_BASE }}/zebrad-test:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance -- lightwalletd_integration
|
docker run -e ZEBRA_SKIP_IPV6_TESTS -e ZEBRA_TEST_LIGHTWALLETD --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance -- lightwalletd_integration
|
||||||
env:
|
env:
|
||||||
ZEBRA_TEST_LIGHTWALLETD: '1'
|
ZEBRA_TEST_LIGHTWALLETD: '1'
|
||||||
|
|
||||||
|
@ -229,12 +245,12 @@ jobs:
|
||||||
id: create-instance
|
id: create-instance
|
||||||
if: ${{ steps.changed-files-specific.outputs.any_changed == 'true' || github.event.inputs.regenerate-disks == 'true' }}
|
if: ${{ steps.changed-files-specific.outputs.any_changed == 'true' || github.event.inputs.regenerate-disks == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instances create-with-container "zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}" \
|
gcloud compute instances create-with-container "zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--boot-disk-size 100GB \
|
--boot-disk-size 100GB \
|
||||||
--boot-disk-type pd-ssd \
|
--boot-disk-type pd-ssd \
|
||||||
--create-disk name="zebrad-cache-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy",size=100GB,type=pd-ssd \
|
--create-disk name="zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy",size=100GB,type=pd-ssd \
|
||||||
--container-mount-disk mount-path='/zebrad-cache',name="zebrad-cache-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy" \
|
--container-mount-disk mount-path='/zebrad-cache',name="zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy" \
|
||||||
--container-image ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} \
|
--container-image ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--container-restart-policy=never \
|
--container-restart-policy=never \
|
||||||
--container-stdin \
|
--container-stdin \
|
||||||
--container-tty \
|
--container-tty \
|
||||||
|
@ -262,14 +278,14 @@ jobs:
|
||||||
id: get-container-name
|
id: get-container-name
|
||||||
if: steps.create-instance.outcome == 'success'
|
if: steps.create-instance.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
INSTANCE_ID=$(gcloud compute instances describe zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} --zone ${{ env.ZONE }} --format='value(id)')
|
INSTANCE_ID=$(gcloud compute instances describe zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} --zone ${{ env.ZONE }} --format='value(id)')
|
||||||
echo "Using instance: $INSTANCE_ID"
|
echo "Using instance: $INSTANCE_ID"
|
||||||
while [[ ${CONTAINER_NAME} != *"zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}"* ]]; do
|
while [[ ${CONTAINER_NAME} != *"zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}"* ]]; do
|
||||||
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
||||||
echo "Using container: ${CONTAINER_NAME} from instance: ${INSTANCE_ID}"
|
echo "Using container: ${CONTAINER_NAME} from instance: ${INSTANCE_ID}"
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
||||||
echo "::set-output name=zebra_container::$CONTAINER_NAME"
|
echo "::set-output name=zebra_container::$CONTAINER_NAME"
|
||||||
|
|
||||||
- name: Regenerate stateful disks logs
|
- name: Regenerate stateful disks logs
|
||||||
|
@ -277,7 +293,7 @@ jobs:
|
||||||
if: steps.create-instance.outcome == 'success'
|
if: steps.create-instance.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
gcloud compute ssh \
|
gcloud compute ssh \
|
||||||
zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} \
|
zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--zone ${{ env.ZONE }} \
|
--zone ${{ env.ZONE }} \
|
||||||
--quiet \
|
--quiet \
|
||||||
--ssh-flag="-o ServerAliveInterval=5" \
|
--ssh-flag="-o ServerAliveInterval=5" \
|
||||||
|
@ -291,9 +307,9 @@ jobs:
|
||||||
# Only run if the earlier step succeeds
|
# Only run if the earlier step succeeds
|
||||||
if: steps.sync-to-checkpoint.outcome == 'success'
|
if: steps.sync-to-checkpoint.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
gcloud compute images create zebrad-cache-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy \
|
gcloud compute images create zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy \
|
||||||
--force \
|
--force \
|
||||||
--source-disk=zebrad-cache-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy \
|
--source-disk=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy \
|
||||||
--source-disk-zone=${{ env.ZONE }} \
|
--source-disk-zone=${{ env.ZONE }} \
|
||||||
--storage-location=us \
|
--storage-location=us \
|
||||||
--description="Created from head branch ${{ env.GITHUB_HEAD_REF_SLUG_URL }} targeting ${{ env.GITHUB_BASE_REF_SLUG }} from PR ${{ env.GITHUB_REF_SLUG_URL }} with commit ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA }}"
|
--description="Created from head branch ${{ env.GITHUB_HEAD_REF_SLUG_URL }} targeting ${{ env.GITHUB_BASE_REF_SLUG }} from PR ${{ env.GITHUB_REF_SLUG_URL }} with commit ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA }}"
|
||||||
|
@ -302,7 +318,7 @@ jobs:
|
||||||
id: disk-short-sha
|
id: disk-short-sha
|
||||||
if: steps.sync-to-checkpoint.outcome == 'success'
|
if: steps.sync-to-checkpoint.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
short_sha=$(echo "${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}")
|
short_sha=$(echo "${{ env.GITHUB_SHA_SHORT }}")
|
||||||
echo "$short_sha" > latest-disk-state-sha.txt
|
echo "$short_sha" > latest-disk-state-sha.txt
|
||||||
echo "::set-output name=disk_short_sha::$short_sha"
|
echo "::set-output name=disk_short_sha::$short_sha"
|
||||||
|
|
||||||
|
@ -319,7 +335,7 @@ jobs:
|
||||||
if: ${{ steps.sync-to-checkpoint.outcome == 'success' }} || ${{ steps.sync-to-checkpoint.outcome == 'failure' }}
|
if: ${{ steps.sync-to-checkpoint.outcome == 'success' }} || ${{ steps.sync-to-checkpoint.outcome == 'failure' }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instances delete "zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}" --delete-disks all --zone "${{ env.ZONE }}"
|
gcloud compute instances delete "zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" --delete-disks all --zone "${{ env.ZONE }}"
|
||||||
|
|
||||||
# Test that Zebra syncs and fully validates a few thousand blocks from a cached post-checkpoint state
|
# Test that Zebra syncs and fully validates a few thousand blocks from a cached post-checkpoint state
|
||||||
test-stateful-sync:
|
test-stateful-sync:
|
||||||
|
@ -365,12 +381,12 @@ jobs:
|
||||||
- name: Create GCP compute instance
|
- name: Create GCP compute instance
|
||||||
id: create-instance
|
id: create-instance
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instances create-with-container "zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}" \
|
gcloud compute instances create-with-container "zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--boot-disk-size 100GB \
|
--boot-disk-size 100GB \
|
||||||
--boot-disk-type pd-ssd \
|
--boot-disk-type pd-ssd \
|
||||||
--create-disk=image=zebrad-cache-${{ env.DISK_SHORT_SHA }}-${{ env.lower_net_name }}-canopy,name=zebrad-cache-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy,size=100GB,type=pd-ssd \
|
--create-disk=image=zebrad-cache-${{ env.DISK_SHORT_SHA }}-${{ env.lower_net_name }}-canopy,name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy,size=100GB,type=pd-ssd \
|
||||||
--container-mount-disk=mount-path='/zebrad-cache',name=zebrad-cache-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy \
|
--container-mount-disk=mount-path='/zebrad-cache',name=zebrad-cache-${{ env.GITHUB_SHA_SHORT }}-${{ env.lower_net_name }}-canopy \
|
||||||
--container-image ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} \
|
--container-image ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--container-restart-policy=never \
|
--container-restart-policy=never \
|
||||||
--container-stdin \
|
--container-stdin \
|
||||||
--container-tty \
|
--container-tty \
|
||||||
|
@ -400,21 +416,21 @@ jobs:
|
||||||
id: get-container-name
|
id: get-container-name
|
||||||
if: steps.create-instance.outcome == 'success'
|
if: steps.create-instance.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
INSTANCE_ID=$(gcloud compute instances describe zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} --zone ${{ env.ZONE }} --format='value(id)')
|
INSTANCE_ID=$(gcloud compute instances describe zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} --zone ${{ env.ZONE }} --format='value(id)')
|
||||||
echo "Using instance: $INSTANCE_ID"
|
echo "Using instance: $INSTANCE_ID"
|
||||||
while [[ ${CONTAINER_NAME} != *"zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}"* ]]; do
|
while [[ ${CONTAINER_NAME} != *"zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}"* ]]; do
|
||||||
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
||||||
echo "Using container: ${CONTAINER_NAME} from instance: ${INSTANCE_ID}"
|
echo "Using container: ${CONTAINER_NAME} from instance: ${INSTANCE_ID}"
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
||||||
echo "::set-output name=zebra_container::$CONTAINER_NAME"
|
echo "::set-output name=zebra_container::$CONTAINER_NAME"
|
||||||
|
|
||||||
- name: Sync past mandatory checkpoint logs
|
- name: Sync past mandatory checkpoint logs
|
||||||
id: sync-past-checkpoint
|
id: sync-past-checkpoint
|
||||||
run: |
|
run: |
|
||||||
gcloud compute ssh \
|
gcloud compute ssh \
|
||||||
zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} \
|
zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--zone ${{ env.ZONE }} \
|
--zone ${{ env.ZONE }} \
|
||||||
--quiet \
|
--quiet \
|
||||||
--ssh-flag="-o ServerAliveInterval=5" \
|
--ssh-flag="-o ServerAliveInterval=5" \
|
||||||
|
@ -427,7 +443,7 @@ jobs:
|
||||||
if: ${{ steps.sync-past-checkpoint.outcome == 'success' }} || ${{ steps.sync-past-checkpoint.outcome == 'failure' }}
|
if: ${{ steps.sync-past-checkpoint.outcome == 'success' }} || ${{ steps.sync-past-checkpoint.outcome == 'failure' }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instances delete "zebrad-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}" --delete-disks all --zone "${{ env.ZONE }}"
|
gcloud compute instances delete "zebrad-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" --delete-disks all --zone "${{ env.ZONE }}"
|
||||||
|
|
||||||
# Test that Zebra can run a full mainnet sync after a PR is approved
|
# Test that Zebra can run a full mainnet sync after a PR is approved
|
||||||
test-full-sync:
|
test-full-sync:
|
||||||
|
@ -454,10 +470,10 @@ jobs:
|
||||||
- name: Create GCP compute instance
|
- name: Create GCP compute instance
|
||||||
id: create-instance
|
id: create-instance
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instances create-with-container "sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}" \
|
gcloud compute instances create-with-container "sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--boot-disk-size 100GB \
|
--boot-disk-size 100GB \
|
||||||
--boot-disk-type pd-extreme \
|
--boot-disk-type pd-extreme \
|
||||||
--container-image ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} \
|
--container-image ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--container-restart-policy=never \
|
--container-restart-policy=never \
|
||||||
--container-stdin \
|
--container-stdin \
|
||||||
--container-tty \
|
--container-tty \
|
||||||
|
@ -476,21 +492,21 @@ jobs:
|
||||||
id: get-container-name
|
id: get-container-name
|
||||||
if: steps.create-instance.outcome == 'success'
|
if: steps.create-instance.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
INSTANCE_ID=$(gcloud compute instances describe sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} --zone ${{ env.ZONE }} --format='value(id)')
|
INSTANCE_ID=$(gcloud compute instances describe sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} --zone ${{ env.ZONE }} --format='value(id)')
|
||||||
echo "Using instance: $INSTANCE_ID"
|
echo "Using instance: $INSTANCE_ID"
|
||||||
while [[ ${CONTAINER_NAME} != *"sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}"* ]]; do
|
while [[ ${CONTAINER_NAME} != *"sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}"* ]]; do
|
||||||
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
||||||
echo "Using container: ${CONTAINER_NAME} from instance: ${INSTANCE_ID}"
|
echo "Using container: ${CONTAINER_NAME} from instance: ${INSTANCE_ID}"
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
CONTAINER_NAME=$(gcloud logging read 'log_name=projects/${{ env.PROJECT_ID }}/logs/cos_system AND jsonPayload.MESSAGE:sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}' --format='value(jsonPayload.MESSAGE)' --limit=1 | grep -o '...-sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}-....' | tr -d "'.")
|
||||||
echo "::set-output name=zebra_container::$CONTAINER_NAME"
|
echo "::set-output name=zebra_container::$CONTAINER_NAME"
|
||||||
|
|
||||||
- name: Sync past mandatory checkpoint logs
|
- name: Sync past mandatory checkpoint logs
|
||||||
id: sync-past-checkpoint
|
id: sync-past-checkpoint
|
||||||
run: |
|
run: |
|
||||||
gcloud compute ssh \
|
gcloud compute ssh \
|
||||||
sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }} \
|
sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--zone ${{ env.ZONE }} \
|
--zone ${{ env.ZONE }} \
|
||||||
--quiet \
|
--quiet \
|
||||||
--ssh-flag="-o ServerAliveInterval=5" \
|
--ssh-flag="-o ServerAliveInterval=5" \
|
||||||
|
@ -503,4 +519,4 @@ jobs:
|
||||||
if: ${{ steps.sync-past-checkpoint.outcome == 'success' }} || ${{ steps.sync-past-checkpoint.outcome == 'failure' }}
|
if: ${{ steps.sync-past-checkpoint.outcome == 'success' }} || ${{ steps.sync-past-checkpoint.outcome == 'failure' }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instances delete "sync-tests-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT || env.GITHUB_SHA_SHORT }}" --delete-disks all --zone "${{ env.ZONE }}"
|
gcloud compute instances delete "sync-tests-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" --delete-disks all --zone "${{ env.ZONE }}"
|
||||||
|
|
|
@ -46,6 +46,24 @@ jobs:
|
||||||
- name: Inject slug/short variables
|
- name: Inject slug/short variables
|
||||||
uses: rlespinasse/github-slug-action@v4
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
|
||||||
|
# Automatic tag management and OCI Image Format Specification for labels
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3.6.2
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
# Setup gcloud CLI
|
# Setup gcloud CLI
|
||||||
- name: Authenticate to Google Cloud
|
- name: Authenticate to Google Cloud
|
||||||
id: auth
|
id: auth
|
||||||
|
@ -83,9 +101,8 @@ jobs:
|
||||||
platforms: |
|
platforms: |
|
||||||
linux/amd64
|
linux/amd64
|
||||||
linux/arm64
|
linux/arm64
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:latest
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
push: true
|
push: true
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
|
@ -35,6 +35,24 @@ jobs:
|
||||||
- name: Inject slug/short variables
|
- name: Inject slug/short variables
|
||||||
uses: rlespinasse/github-slug-action@v4
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
|
||||||
|
# Automatic tag management and OCI Image Format Specification for labels
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3.6.2
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
# Setup gcloud CLI
|
# Setup gcloud CLI
|
||||||
- name: Authenticate to Google Cloud
|
- name: Authenticate to Google Cloud
|
||||||
id: auth
|
id: auth
|
||||||
|
@ -72,9 +90,8 @@ jobs:
|
||||||
platforms: |
|
platforms: |
|
||||||
linux/amd64
|
linux/amd64
|
||||||
linux/arm64
|
linux/arm64
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:latest
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
build-args: |
|
build-args: |
|
||||||
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
||||||
ZEBRA_SKIP_IPV6_TESTS="1"
|
ZEBRA_SKIP_IPV6_TESTS="1"
|
||||||
|
|
|
@ -38,7 +38,7 @@ jobs:
|
||||||
# Create instance template from container image
|
# Create instance template from container image
|
||||||
- name: Create instance template
|
- name: Create instance template
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-templates create-with-container zcashd-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
|
gcloud compute instance-templates create-with-container zcashd-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }} \
|
||||||
--boot-disk-size 10GB \
|
--boot-disk-size 10GB \
|
||||||
--boot-disk-type=pd-ssd \
|
--boot-disk-type=pd-ssd \
|
||||||
--container-stdin \
|
--container-stdin \
|
||||||
|
@ -55,15 +55,15 @@ jobs:
|
||||||
id: does-group-exist
|
id: does-group-exist
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-groups list | grep "zcashd-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ github.event.inputs.network }}" | grep "${{ env.REGION }}"
|
gcloud compute instance-groups list | grep "zcashd-${{ env.GITHUB_REF_SLUG_URL }}-${{ github.event.inputs.network }}" | grep "${{ env.REGION }}"
|
||||||
|
|
||||||
# Deploy new managed instance group using the new instance template
|
# Deploy new managed instance group using the new instance template
|
||||||
- name: Create managed instance group
|
- name: Create managed instance group
|
||||||
if: steps.does-group-exist.outcome == 'failure'
|
if: steps.does-group-exist.outcome == 'failure'
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-groups managed create \
|
gcloud compute instance-groups managed create \
|
||||||
"zcashd-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ github.event.inputs.network }}" \
|
"zcashd-${{ env.GITHUB_REF_SLUG_URL }}-${{ github.event.inputs.network }}" \
|
||||||
--template "zcashd-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
--template "zcashd-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--region "${{ env.REGION }}" \
|
--region "${{ env.REGION }}" \
|
||||||
--size "${{ github.event.inputs.size }}"
|
--size "${{ github.event.inputs.size }}"
|
||||||
|
|
||||||
|
@ -72,6 +72,6 @@ jobs:
|
||||||
if: steps.does-group-exist.outcome == 'success'
|
if: steps.does-group-exist.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
gcloud compute instance-groups managed rolling-action start-update \
|
gcloud compute instance-groups managed rolling-action start-update \
|
||||||
"zcashd-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ github.event.inputs.network }}" \
|
"zcashd-${{ env.GITHUB_REF_SLUG_URL }}-${{ github.event.inputs.network }}" \
|
||||||
--version template="zcashd-${{ env.GITHUB_HEAD_REF_SLUG_URL || env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
--version template="zcashd-${{ env.GITHUB_REF_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}" \
|
||||||
--region "${{ env.REGION }}"
|
--region "${{ env.REGION }}"
|
Loading…
Reference in New Issue