Create instance group if it doesn't exist, update it if it does (#513)
* Deploy instance group if it doesn't exist, update it if it does * Rename push.yml to cd.yml * Rename some CD steps
This commit is contained in:
parent
6324ad8828
commit
2bdd07c1bc
|
@ -1,4 +1,4 @@
|
|||
name: CI
|
||||
name: CD
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -29,7 +29,8 @@ jobs:
|
|||
echo "::set-env name=SHA7::$(git rev-parse --short=7 $GITHUB_SHA)"
|
||||
|
||||
# Setup gcloud CLI
|
||||
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
|
||||
- name: Set up gcloud Cloud SDK environment
|
||||
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
|
||||
with:
|
||||
version: '295.0.0'
|
||||
project_id: ${{ env.PROJECT_ID }}
|
||||
|
@ -72,19 +73,28 @@ jobs:
|
|||
# --source-ranges 0.0.0.0/0 \
|
||||
# --description="Allow incoming Zcash traffic from anywhere" \
|
||||
|
||||
# Deploy managed instance group using the new instance template
|
||||
# - name: Deploy managed instance group
|
||||
# run: |
|
||||
# gcloud compute instance-groups managed create \
|
||||
# "zebrad-$SHORT_BRANCH_NAME-$SHA7" \
|
||||
# --template "zebrad-$SHORT_BRANCH_NAME-$SHA7" \
|
||||
# --health-check zebrad-tracing-filter \
|
||||
# --initial-delay 30 \
|
||||
# --region us-central1 \
|
||||
# --size 2
|
||||
# Check if our destination instance group exists already
|
||||
- name: Check if instance group exists
|
||||
id: does-group-exist
|
||||
continue-on-error: true
|
||||
run: |
|
||||
gcloud compute instance-groups list | grep "zebrad-$SHORT_BRANCH_NAME"
|
||||
|
||||
# Deploy new managed instance group using the new instance template
|
||||
- name: Create managed instance group
|
||||
if: steps.does-group-exist.outcome == 'failure'
|
||||
run: |
|
||||
gcloud compute instance-groups managed create \
|
||||
"zebrad-$SHORT_BRANCH_NAME" \
|
||||
--template "zebrad-$SHORT_BRANCH_NAME-$SHA7" \
|
||||
--health-check zebrad-tracing-filter \
|
||||
--initial-delay 30 \
|
||||
--region us-central1 \
|
||||
--size 2
|
||||
|
||||
# Rolls out update to existing group using the new instance template
|
||||
- name: Update managed instance group
|
||||
if: steps.does-group-exist.outcome == 'success'
|
||||
run: |
|
||||
gcloud compute instance-groups managed rolling-action start-update \
|
||||
"zebrad-$SHORT_BRANCH_NAME" \
|
Loading…
Reference in New Issue