-
Notifications
You must be signed in to change notification settings - Fork 7
88 lines (71 loc) · 2.73 KB
/
workflow.yaml
File metadata and controls
88 lines (71 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 }}