chore(autotest): start test resources

This commit is contained in:
mengzhenyu 2022-02-11 09:58:54 +08:00
parent 50510d4e01
commit 5c39e0eca5
1 changed files with 330 additions and 330 deletions

View File

@ -9,104 +9,104 @@ on:
# workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
profile:
- emqx
otp:
- 24.1.5-3
os:
- ubuntu20.04
container: "ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}"
steps:
- uses: actions/checkout@v1
- name: build zip packages
run: make ${{ matrix.profile }}-zip
- name: packages test
run: |
export CODE_PATH=$GITHUB_WORKSPACE
EMQX_NAME=${{ matrix.profile }} .ci/build_packages/tests.sh
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os}}
path: _packages/**/*.zip
terraform_emqx:
runs-on: ubuntu-latest
needs: [build]
outputs:
emqx_public_ip: ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
emqx_node_ip1: ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }}
emqx_node_ip2: ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }}
emqx_node_ip3: ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: ubuntu20.04
path: /tmp
- name: Download emqx package
run: |
sudo cp /tmp/emqx/*.zip /tmp/emqx.zip
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/emqx
id: init1
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/emqx
id: validate1
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/emqx
id: server_ip
run: |
terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}" -var="emqx_package=/tmp/emqx.zip"
echo "::set-output name=emqx_private_ips::$(terraform output emqx_private_ips)"
echo "::set-output name=emqx_public_ips::$(terraform output emqx_public_ips)"
- name: Rename and upload emqx tfstate
working-directory: ./tf-test-automation/services/emqx
run: |
mv ./terraform.tfstate ./emqx.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/emqx/emqx.tfstate
- name: Show emqx_private_ips
id: emqx_private_ip
run: |
ip1=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $1}'`
ip2=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $2}'`
ip3=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $3}'`
emqx_public_ip=`echo "${{ steps.server_ip.outputs.emqx_public_ips }}"|awk -F ',' '{print $1}'`
echo "::set-output name=emqx_node_ip1::$ip1"
echo "::set-output name=emqx_node_ip2::$ip2"
echo "::set-output name=emqx_node_ip3::$ip3"
echo "::set-output name=emqx_public_ip::$emqx_public_ip"
- name: Show emqx node ip
run: |
echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }}
echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }}
echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
echo ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
# build:
# runs-on: ubuntu-20.04
#
# strategy:
# fail-fast: false
# matrix:
# profile:
# - emqx
# otp:
# - 24.1.5-3
# os:
# - ubuntu20.04
#
# container: "ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}"
#
# steps:
# - uses: actions/checkout@v1
# - name: build zip packages
# run: make ${{ matrix.profile }}-zip
# - name: packages test
# run: |
# export CODE_PATH=$GITHUB_WORKSPACE
# EMQX_NAME=${{ matrix.profile }} .ci/build_packages/tests.sh
# - uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.os}}
# path: _packages/**/*.zip
#
# terraform_emqx:
# runs-on: ubuntu-latest
#
# needs: [build]
# outputs:
# emqx_public_ip: ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
# emqx_node_ip1: ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }}
# emqx_node_ip2: ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }}
# emqx_node_ip3: ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
# steps:
# - uses: actions/checkout@v2
# - uses: actions/download-artifact@v2
# with:
# name: ubuntu20.04
# path: /tmp
# - name: Download emqx package
# run: |
# sudo cp /tmp/emqx/*.zip /tmp/emqx.zip
# - name: Checkout tf-test-automation
# uses: actions/checkout@v2
# with:
# repository: emqx/tf-test-automation
# ref: emqx-broker
# path: tf-test-automation
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1.3.2
# with:
# terraform_wrapper: false
# - name: Terraform Init tf-test-automation
# working-directory: ./tf-test-automation/services/emqx
# id: init1
# run: |
# terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# - name: Terraform Validate tf-test-automation
# working-directory: ./tf-test-automation/services/emqx
# id: validate1
# run: terraform validate -no-color
# - name: Terraform Apply tf-test-automation
# working-directory: ./tf-test-automation/services/emqx
# id: server_ip
# run: |
# terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}" -var="emqx_package=/tmp/emqx.zip"
# echo "::set-output name=emqx_private_ips::$(terraform output emqx_private_ips)"
# echo "::set-output name=emqx_public_ips::$(terraform output emqx_public_ips)"
# - name: Rename and upload emqx tfstate
# working-directory: ./tf-test-automation/services/emqx
# run: |
# mv ./terraform.tfstate ./emqx.tfstate
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: tfstate
# path: ./tf-test-automation/services/emqx/emqx.tfstate
# - name: Show emqx_private_ips
# id: emqx_private_ip
# run: |
# ip1=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $1}'`
# ip2=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $2}'`
# ip3=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $3}'`
# emqx_public_ip=`echo "${{ steps.server_ip.outputs.emqx_public_ips }}"|awk -F ',' '{print $1}'`
# echo "::set-output name=emqx_node_ip1::$ip1"
# echo "::set-output name=emqx_node_ip2::$ip2"
# echo "::set-output name=emqx_node_ip3::$ip3"
# echo "::set-output name=emqx_public_ip::$emqx_public_ip"
# - name: Show emqx node ip
# run: |
# echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }}
# echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }}
# echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
# echo ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
# xmeter_start:
# runs-on: ubuntu-latest
@ -126,240 +126,240 @@ jobs:
# aws ec2 start-instances --instance-ids i-0c5dccd394ed9be18
# aws ec2 start-instances --instance-ids i-04c1c50b3e4952266
#
# terraform_mysql:
# runs-on: ubuntu-latest
#
# outputs:
# mysql_ip: ${{ steps.mysql_ip.outputs.mysql_ip }}
# mysql_url: ${{ steps.mysql_url.outputs.mysql_url }}
# steps:
# - name: Checkout tf-test-automation
# uses: actions/checkout@v2
# with:
# repository: emqx/tf-test-automation
# ref: emqx-broker
# path: tf-test-automation
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1.3.2
# with:
# terraform_wrapper: false
# - name: Terraform Init tf-test-automation
# working-directory: ./tf-test-automation/services/mysql
# id: init1
# run: |
# terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# - name: Terraform Validate tf-test-automation
# working-directory: ./tf-test-automation/services/mysql
# id: validate1
# run: terraform validate -no-color
# - name: Terraform Apply tf-test-automation
# working-directory: ./tf-test-automation/services/mysql
# id: mysql_url
# run: |
# terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# echo "::set-output name=mysql_url::$(terraform output endpoint)"
# - name: Rename and upload mysql tfstate
# working-directory: ./tf-test-automation/services/mysql
# run: |
# mv ./terraform.tfstate ./mysql.tfstate
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: tfstate
# path: ./tf-test-automation/services/mysql/mysql.tfstate
# - name: Show mysql url
# id: mysql_ip
# run: |
# ip=`echo "${{ steps.mysql_url.outputs.mysql_url }}"|awk -F ':' '{print $1}'`
# echo "::set-output name=mysql_ip::$ip"
# - name: Show mysql ip
# run: |
# echo ${{ steps.mysql_url.outputs.mysql_url }}
# echo ${{ steps.mysql_ip.outputs.mysql_ip }}
##
# terraform_redis:
# runs-on: ubuntu-latest
#
# outputs:
# redis_ip: ${{ steps.redis_ip.outputs.redis_ip }}
# steps:
# - name: Checkout tf-test-automation
# uses: actions/checkout@v2
# with:
# repository: emqx/tf-test-automation
# ref: emqx-broker
# path: tf-test-automation
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1.3.2
# with:
# terraform_wrapper: false
# - name: Terraform Init tf-test-automation
# working-directory: ./tf-test-automation/services/redis
# id: init
# run: |
# terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# - name: Terraform Validate tf-test-automation
# working-directory: ./tf-test-automation/services/redis
# id: validate
# run: terraform validate -no-color
# - name: Terraform Apply tf-test-automation
# working-directory: ./tf-test-automation/services/redis
# id: redis_ip
# run: |
# terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
# echo "::set-output name=redis_ip::$(terraform output redis_private_ips)"
# - name: Rename and upload redis server tfstate
# working-directory: ./tf-test-automation/services/redis
# run: |
# mv ./terraform.tfstate ./redis.tfstate
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: tfstate
# path: ./tf-test-automation/services/redis/redis.tfstate
# - name: Show redis ip
# run: |
# echo ${{ steps.redis_ip.outputs.redis_ip }}
#
# terraform_pgsql:
# runs-on: ubuntu-latest
#
# outputs:
# pgsql_url: ${{ steps.pgsql_url.outputs.pgsql_url }}
# pgsql_ip: ${{ steps.pgsql_ip.outputs.pgsql_ip }}
# steps:
# - name: Checkout tf-test-automation
# uses: actions/checkout@v2
# with:
# repository: emqx/tf-test-automation
# ref: emqx-broker
# path: tf-test-automation
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1.3.2
# with:
# terraform_wrapper: false
# - name: Terraform Init tf-test-automation
# working-directory: ./tf-test-automation/services/pgsql
# id: init
# run: |
# terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# - name: Terraform Validate tf-test-automation
# working-directory: ./tf-test-automation/services/pgsql
# id: validate
# run: terraform validate -no-color
# - name: Terraform Apply tf-test-automation
# working-directory: ./tf-test-automation/services/pgsql
# id: pgsql_url
# run: |
# terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# echo "::set-output name=pgsql_url::$(terraform output endpoint)"
# - name: Rename and upload pgsql server tfstate
# working-directory: ./tf-test-automation/services/pgsql
# run: |
# mv ./terraform.tfstate ./pgsql.tfstate
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: tfstate
# path: ./tf-test-automation/services/pgsql/pgsql.tfstate
# - name: Show pgsql url
# id: pgsql_ip
# run: |
# ip=`echo "${{ steps.pgsql_url.outputs.pgsql_url }}"|awk -F ':' '{print $1}'`
# echo "::set-output name=pgsql_ip::$ip"
# - name: Show pgsql ip
# run: |
# echo ${{ steps.pgsql_url.outputs.pgsql_url }}
# echo ${{ steps.pgsql_ip.outputs.pgsql_ip }}
#
# terraform_mongo:
# runs-on: ubuntu-latest
#
# outputs:
# mongo_ip: ${{ steps.mongo_ip.outputs.mongo_ip }}
# steps:
# - name: Checkout tf-test-automation
# uses: actions/checkout@v2
# with:
# repository: emqx/tf-test-automation
# ref: emqx-broker
# path: tf-test-automation
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1.3.2
# with:
# terraform_wrapper: false
# - name: Terraform Init tf-test-automation
# working-directory: ./tf-test-automation/services/mongodb
# id: init
# run: |
# terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# - name: Terraform Validate tf-test-automation
# working-directory: ./tf-test-automation/services/mongodb
# id: validate
# run: terraform validate -no-color
# - name: Terraform Apply tf-test-automation
# working-directory: ./tf-test-automation/services/mongodb
# id: mongo_ip
# run: |
# terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
# echo "::set-output name=mongo_ip::$(terraform output mongo_private_ips)"
# - name: Rename and upload mongo server tfstate
# working-directory: ./tf-test-automation/services/mongodb
# run: |
# mv ./terraform.tfstate ./mongo.tfstate
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: tfstate
# path: ./tf-test-automation/services/mongodb/mongo.tfstate
# - name: Show mongo ip
# run: |
# echo ${{ steps.mongo_ip.outputs.mongo_ip }}
terraform_mysql:
runs-on: ubuntu-latest
# terraform_webhook:
# runs-on: ubuntu-latest
#
# outputs:
# webhook_ip: ${{ steps.webhook_ip.outputs.webhook_ip }}
# steps:
# - name: Checkout tf-test-automation
# uses: actions/checkout@v2
# with:
# repository: emqx/tf-test-automation
# ref: emqx-broker
# path: tf-test-automation
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1.3.2
# with:
# terraform_wrapper: false
# - name: Terraform Init tf-test-automation
# working-directory: ./tf-test-automation/services/webhook
# id: init
# run: |
# terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
# - name: Terraform Validate tf-test-automation
# working-directory: ./tf-test-automation/services/webhook
# id: validate
# run: terraform validate -no-color
# - name: Terraform Apply tf-test-automation
# working-directory: ./tf-test-automation/services/webhook
# id: webhook_ip
# run: |
# terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
# echo "::set-output name=webhook_ip::$(terraform output webhook_private_ips)"
# - name: Rename and upload webhook server tfstate
# working-directory: ./tf-test-automation/services/webhook
# run: |
# mv ./terraform.tfstate ./webhook.tfstate
# - uses: actions/upload-artifact@v2
# if: always()
# with:
# name: tfstate
# path: ./tf-test-automation/services/webhook/webhook.tfstate
# - name: Show webhook ip
# run: |
# echo ${{ steps.webhook_ip.outputs.webhook_ip }}
outputs:
mysql_ip: ${{ steps.mysql_ip.outputs.mysql_ip }}
mysql_url: ${{ steps.mysql_url.outputs.mysql_url }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/mysql
id: init1
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/mysql
id: validate1
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/mysql
id: mysql_url
run: |
terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
echo "::set-output name=mysql_url::$(terraform output endpoint)"
- name: Rename and upload mysql tfstate
working-directory: ./tf-test-automation/services/mysql
run: |
mv ./terraform.tfstate ./mysql.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/mysql/mysql.tfstate
- name: Show mysql url
id: mysql_ip
run: |
ip=`echo "${{ steps.mysql_url.outputs.mysql_url }}"|awk -F ':' '{print $1}'`
echo "::set-output name=mysql_ip::$ip"
- name: Show mysql ip
run: |
echo ${{ steps.mysql_url.outputs.mysql_url }}
echo ${{ steps.mysql_ip.outputs.mysql_ip }}
#
terraform_redis:
runs-on: ubuntu-latest
outputs:
redis_ip: ${{ steps.redis_ip.outputs.redis_ip }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/redis
id: init
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/redis
id: validate
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/redis
id: redis_ip
run: |
terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
echo "::set-output name=redis_ip::$(terraform output redis_private_ips)"
- name: Rename and upload redis server tfstate
working-directory: ./tf-test-automation/services/redis
run: |
mv ./terraform.tfstate ./redis.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/redis/redis.tfstate
- name: Show redis ip
run: |
echo ${{ steps.redis_ip.outputs.redis_ip }}
terraform_pgsql:
runs-on: ubuntu-latest
outputs:
pgsql_url: ${{ steps.pgsql_url.outputs.pgsql_url }}
pgsql_ip: ${{ steps.pgsql_ip.outputs.pgsql_ip }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/pgsql
id: init
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/pgsql
id: validate
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/pgsql
id: pgsql_url
run: |
terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
echo "::set-output name=pgsql_url::$(terraform output endpoint)"
- name: Rename and upload pgsql server tfstate
working-directory: ./tf-test-automation/services/pgsql
run: |
mv ./terraform.tfstate ./pgsql.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/pgsql/pgsql.tfstate
- name: Show pgsql url
id: pgsql_ip
run: |
ip=`echo "${{ steps.pgsql_url.outputs.pgsql_url }}"|awk -F ':' '{print $1}'`
echo "::set-output name=pgsql_ip::$ip"
- name: Show pgsql ip
run: |
echo ${{ steps.pgsql_url.outputs.pgsql_url }}
echo ${{ steps.pgsql_ip.outputs.pgsql_ip }}
terraform_mongo:
runs-on: ubuntu-latest
outputs:
mongo_ip: ${{ steps.mongo_ip.outputs.mongo_ip }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/mongodb
id: init
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/mongodb
id: validate
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/mongodb
id: mongo_ip
run: |
terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
echo "::set-output name=mongo_ip::$(terraform output mongo_private_ips)"
- name: Rename and upload mongo server tfstate
working-directory: ./tf-test-automation/services/mongodb
run: |
mv ./terraform.tfstate ./mongo.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/mongodb/mongo.tfstate
- name: Show mongo ip
run: |
echo ${{ steps.mongo_ip.outputs.mongo_ip }}
terraform_webhook:
runs-on: ubuntu-latest
outputs:
webhook_ip: ${{ steps.webhook_ip.outputs.webhook_ip }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/webhook
id: init
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/webhook
id: validate
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/webhook
id: webhook_ip
run: |
terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
echo "::set-output name=webhook_ip::$(terraform output webhook_private_ips)"
- name: Rename and upload webhook server tfstate
working-directory: ./tf-test-automation/services/webhook
run: |
mv ./terraform.tfstate ./webhook.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/webhook/webhook.tfstate
- name: Show webhook ip
run: |
echo ${{ steps.webhook_ip.outputs.webhook_ip }}
# master_control:
# runs-on: ubuntu-latest
#