chore: update release scripts #697
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
name: 'Terraform CI' | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
weka_version: | |
required: true | |
description: Weka version | |
concurrency: ci | |
jobs: | |
terraform: | |
name: Terraform | |
if: false | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./examples/public_vpc | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- id: auth | |
name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v0 | |
with: | |
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Copy Terraform State | |
run: cp "../../ci/deployment/state.tf" . | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Apply | |
if: github.event_name != 'workflow_dispatch' | |
run: terraform apply -var-file=../../ci/deployment/terraform.tfvars -var="get_weka_io_token=$GET_WEKA_IO_TOKEN" -auto-approve | |
env: | |
GET_WEKA_IO_TOKEN: ${{ secrets.GET_WEKA_IO_TOKEN }} | |
- name: Terraform Apply (workflow_dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: terraform apply -var-file=../../ci/deployment/terraform.tfvars -var="get_weka_io_token=$GET_WEKA_IO_TOKEN" -var="weka_version=${{ inputs.weka_version }}" -auto-approve | |
env: | |
GET_WEKA_IO_TOKEN: ${{ secrets.GET_WEKA_IO_TOKEN }} | |
- name: Wait for weka cluster | |
run: ../../ci/deployment/wait_for_cluster.sh 6 30 | |
- name: Scale up | |
run: | | |
func_url=$(gcloud functions describe weka-poc-weka-functions \ | |
--project wekaio-ci \ | |
--region europe-west1 \ | |
--format='get(serviceConfig.uri)' \ | |
--gen2) | |
curl "$func_url?action=resize" --fail -H "Authorization:bearer $(gcloud auth print-identity-token)" -d '{"value": 7}' | |
- name: Wait for weka cluster | |
run: ../../ci/deployment/wait_for_cluster.sh 7 15 | |
- name: Scale down | |
run: | | |
func_url=$(gcloud functions describe weka-poc-weka-functions \ | |
--project wekaio-ci \ | |
--region europe-west1 \ | |
--format='get(serviceConfig.uri)' \ | |
--gen2) | |
curl "$func_url?action=resize" --fail -H "Authorization:bearer $(gcloud auth print-identity-token)" -d '{"value": 6}' | |
- name: Wait for weka cluster | |
run: ../../ci/deployment/wait_for_cluster.sh 6 15 | |
- name: Terraform Destroy | |
if: always() | |
run: terraform destroy -var-file=../../ci/deployment/terraform.tfvars -var="get_weka_io_token=$GET_WEKA_IO_TOKEN" -auto-approve | |
env: | |
GET_WEKA_IO_TOKEN: ${{ secrets.GET_WEKA_IO_TOKEN }} |