Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

fix: redis pool size number -> string #152

fix: redis pool size number -> string

fix: redis pool size number -> string #152

Workflow file for this run

name: ci_terraform
on:
push:
branches:
- main
paths:
- "terraform/**"
pull_request:
paths:
- "terraform/**"
concurrency:
# Support push/pr as event types with different behaviors each:
# 1. push: queue up builds
# 2. pr: only allow one run per PR
group: ${{ github.workflow }}-${{ github.event.type }}${{ github.event.pull_request.number }}
# If there is already a workflow running for the same pull request, cancel it
cancel-in-progress: ${{ github.event.type == 'PullRequest' }}
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Init Terraform
id: tf-init
uses: WalletConnect/actions/terraform/init/@1.0.3
with:
environment: staging
- name: Check Terraform Formatting
id: tf-fmt
uses: WalletConnect/actions/terraform/check-fmt/@1.0.3
plan-staging:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: 'read'
pull-requests: 'write'
environment:
name: infra/staging
url: https://staging.cast.walletconnect.com/health
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Get Grafana details
id: grafana-get-details
run: |
WORKSPACE_ID=$(aws grafana list-workspaces | jq -r '.workspaces[] | select( .tags.Env == "prod") | select( .tags.Name == "grafana-9") | .id')
ENDPOINT=$(aws grafana list-workspaces | jq -r '.workspaces[] | select( .tags.Env == "prod") | select( .tags.Name == "grafana-9") | .endpoint')
echo "::set-output name=workspace-id::$WORKSPACE_ID"
echo "::set-output name=endpoint::$ENDPOINT"
- name: Get Grafana key
id: grafana-get-key
uses: WalletConnect/actions/aws/grafana/get-key/@1.0.3
with:
key-prefix: ${{ github.event.repository.name }}-staging
workspace-id: ${{ steps.grafana-get-details.outputs.workspace-id }}
- name: Init Terraform
id: tf-init
uses: WalletConnect/actions/terraform/init/@1.0.3
with:
environment: staging
- name: Run Terraform Plan
id: tf-plan-staging
uses: WalletConnect/actions/terraform/plan/@1.0.3
env:
GRAFANA_AUTH: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_endpoint: ${{ steps.grafana-get-details.outputs.endpoint }}
TF_VAR_keypair_seed: ${{ secrets.KEYPAIR_SEED }}
TF_VAR_project_id: ${{secrets.PROJECT_ID}}
TF_VAR_relay_url: "https://staging.relay.walletconnect.com"
TF_VAR_cast_url: "https://staging.cast.walletconnect.com"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
environment: staging
- name: Delete Grafana key
id: grafana-delete-key
uses: WalletConnect/actions/aws/grafana/delete-key/@1.0.3
if: ${{ success() || failure() || cancelled() }} # don't use always() since it creates non-cancellable jobs
with:
key-name: ${{ steps.grafana-get-key.outputs.key-name }}
workspace-id: ${{ steps.grafana-get-details.outputs.workspace-id }}
plan-prod:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: 'read'
pull-requests: 'write'
environment:
name: infra/prod
url: https://cast.walletconnect.com/health
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Get Grafana details
id: grafana-get-details
run: |
WORKSPACE_ID=$(aws grafana list-workspaces | jq -r '.workspaces[] | select( .tags.Env == "prod") | select( .tags.Name == "grafana-9") | .id')
ENDPOINT=$(aws grafana list-workspaces | jq -r '.workspaces[] | select( .tags.Env == "prod") | select( .tags.Name == "grafana-9") | .endpoint')
echo "::set-output name=workspace-id::$WORKSPACE_ID"
echo "::set-output name=endpoint::$ENDPOINT"
- name: Get Grafana key
id: grafana-get-key
uses: WalletConnect/actions/aws/grafana/get-key/@1.0.3
with:
key-prefix: ${{ github.event.repository.name }}-prod
workspace-id: ${{ steps.grafana-get-details.outputs.workspace-id }}
- name: Init Terraform
id: tf-init
uses: WalletConnect/actions/terraform/init/@1.0.3
with:
environment: prod
- name: Run Terraform Plan
id: tf-plan-prod
uses: WalletConnect/actions/terraform/plan/@1.0.3
env:
GRAFANA_AUTH: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_endpoint: ${{ steps.grafana-get-details.outputs.endpoint }}
TF_VAR_keypair_seed: ${{ secrets.KEYPAIR_SEED }}
TF_VAR_project_id: ${{secrets.PROJECT_ID}}
TF_VAR_relay_url: "https://relay.walletconnect.com"
TF_VAR_cast_url: "https://cast.walletconnect.com"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
environment: prod
- name: Delete Grafana key
id: grafana-delete-key
uses: WalletConnect/actions/aws/grafana/delete-key/@1.0.3
if: ${{ success() || failure() || cancelled() }} # don't use always() since it creates non-cancellable jobs
with:
key-name: ${{ steps.grafana-get-key.outputs.key-name }}
workspace-id: ${{ steps.grafana-get-details.outputs.workspace-id }}
kick-off-release:
needs: [fmt]
if: github.event_name != 'pull_request'
uses: ./.github/workflows/cd.yml
secrets: inherit