Skip to content

feat: configure secondary ips for NFS protocol #839

feat: configure secondary ips for NFS protocol

feat: configure secondary ips for NFS protocol #839

Workflow file for this run

name: 'Terraform CI'
on:
pull_request:
release:
types: [published]
workflow_dispatch:
inputs:
dist:
required: true
description: Distribution type
default: dev
concurrency: ci
env:
RG_NAME: weka-ci
PREFIX: ci
CLUSTER_NAME: wekacluster
GET_WEKA_IO_TOKEN: ${{ secrets.GET_WEKA_IO_TOKEN }}
SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
TENANT_ID: ${{ secrets.TENANT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
INITIAL_CAPACITY: 6
INITIALIZATION_TIMEOUT: 30
NEW_CAPACITY: 7
SCALE_UP_TIMEOUT: 20
SCALE_DOWN_TIMEOUT: 20
jobs:
function-app-dist:
name: Function app code distribution
runs-on: ubuntu-latest
env:
DIST: ${{ github.event_name == 'release' && 'release' || 'dev' }}
defaults:
run:
shell: bash
working-directory: ./function-app/distribution
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
cache-dependency-path: function-app/code/go.mod
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Authenticate to Azure Cloud
uses: azure/login@v1
with:
# see https://github.com/Azure/login#configure-a-service-principal-with-a-secret
creds: ${{ secrets.RND_AZURE_CREDENTIALS }}
- name: Run create_and_upload_zip
if: github.event_name != 'workflow_dispatch'
run: task create_and_upload_zip DIST=$DIST
- name: Run create_and_upload_zip (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: task create_and_upload_zip DIST=${{ inputs.dist }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: update function_app_version'
file_pattern: 'variables.tf'
weka_deployment:
name: Test Weka Deployment
needs: function-app-dist
runs-on: ubuntu-latest
if: github.event_name != 'release'
defaults:
run:
working-directory: ./ci/deployment
steps:
- name: Checkout
uses: actions/checkout@v3
- id: auth
name: Authenticate to Azure Cloud
uses: azure/login@v1
with:
creds: ${{secrets.AZURE_CREDENTIALS}}
- name: Create Azure resource group
uses: azure/CLI@v1
with:
inlineScript: |
az group create --name $RG_NAME --location eastus
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.5.2
- name: Terraform Init
run: terraform init
- name: Terraform Apply
run: terraform apply -var="rg_name=$RG_NAME" -var="prefix=$PREFIX" -var="cluster_name=$CLUSTER_NAME" -var="get_weka_io_token=$GET_WEKA_IO_TOKEN" -var="client_id=$CLIENT_ID" -var="tenant_id=$TENANT_ID" -var="client_secret=$CLIENT_SECRET" -var="subscription_id=$SUBSCRIPTION_ID" -var="cluster_size=$INITIAL_CAPACITY" -auto-approve
- name: Wait for weka cluster
uses: azure/CLI@v1
with:
inlineScript: |
chmod +x $GITHUB_WORKSPACE/ci/deployment/wait_for_cluster.sh
$GITHUB_WORKSPACE/ci/deployment/wait_for_cluster.sh $PREFIX $CLUSTER_NAME $RG_NAME $SUBSCRIPTION_ID $INITIAL_CAPACITY $INITIALIZATION_TIMEOUT
- name: Scale up. Increase cluster capacity by 1
uses: azure/CLI@v1
with:
inlineScript: |
chmod +x $GITHUB_WORKSPACE/ci/deployment/resize.sh
$GITHUB_WORKSPACE/ci/deployment/resize.sh $PREFIX $CLUSTER_NAME $RG_NAME $SUBSCRIPTION_ID $NEW_CAPACITY
- name: Wait for scaled up weka cluster
uses: azure/CLI@v1
with:
inlineScript: |
chmod +x $GITHUB_WORKSPACE/ci/deployment/wait_for_cluster.sh
$GITHUB_WORKSPACE/ci/deployment/wait_for_cluster.sh $PREFIX $CLUSTER_NAME $RG_NAME $SUBSCRIPTION_ID $NEW_CAPACITY $SCALE_UP_TIMEOUT
- name: Scale down. Decrease cluster capacity by 1
uses: azure/CLI@v1
with:
inlineScript: |
chmod +x $GITHUB_WORKSPACE/ci/deployment/resize.sh
$GITHUB_WORKSPACE/ci/deployment/resize.sh $PREFIX $CLUSTER_NAME $RG_NAME $SUBSCRIPTION_ID $INITIAL_CAPACITY
- name: Wait for scaled down weka cluster
uses: azure/CLI@v1
with:
inlineScript: |
chmod +x $GITHUB_WORKSPACE/ci/deployment/wait_for_cluster.sh
$GITHUB_WORKSPACE/ci/deployment/wait_for_cluster.sh $PREFIX $CLUSTER_NAME $RG_NAME $SUBSCRIPTION_ID $INITIAL_CAPACITY $SCALE_DOWN_TIMEOUT
- name: Terraform Destroy
if: always()
run: terraform destroy -var="rg_name=$RG_NAME" -var="prefix=$PREFIX" -var="cluster_name=$CLUSTER_NAME" -var="get_weka_io_token=$GET_WEKA_IO_TOKEN" -var="client_id=$CLIENT_ID" -var="tenant_id=$TENANT_ID" -var="client_secret=$CLIENT_SECRET" -var="subscription_id=$SUBSCRIPTION_ID" -var="cluster_size=$INITIAL_CAPACITY" -auto-approve
- name: Delete Azure resource group
if: always()
uses: azure/CLI@v1
with:
inlineScript: |
az group delete --name $RG_NAME --yes
- name: Logout from Azure Cloud
if: always()
uses: azure/CLI@v1
with:
inlineScript: |
az logout
az cache purge
az account clear