chore(autotest): start emqx cluster

This commit is contained in:
mengzhenyu 2022-02-09 10:19:43 +08:00
parent 113b63a6ab
commit 50510d4e01
1 changed files with 141 additions and 141 deletions

View File

@ -9,104 +9,104 @@ on:
# workflow_dispatch: # workflow_dispatch:
jobs: jobs:
# build: build:
# runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
#
# strategy: strategy:
# fail-fast: false fail-fast: false
# matrix: matrix:
# profile: profile:
# - emqx - emqx
# otp: otp:
# - 24.1.5-3 - 24.1.5-3
# os: os:
# - ubuntu20.04 - ubuntu20.04
#
# container: "ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}" container: "ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}"
#
# steps: steps:
# - uses: actions/checkout@v1 - uses: actions/checkout@v1
# - name: build zip packages - name: build zip packages
# run: make ${{ matrix.profile }}-zip run: make ${{ matrix.profile }}-zip
# - name: packages test - name: packages test
# run: | run: |
# export CODE_PATH=$GITHUB_WORKSPACE export CODE_PATH=$GITHUB_WORKSPACE
# EMQX_NAME=${{ matrix.profile }} .ci/build_packages/tests.sh EMQX_NAME=${{ matrix.profile }} .ci/build_packages/tests.sh
# - uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
# with: with:
# name: ${{ matrix.os}} name: ${{ matrix.os}}
# path: _packages/**/*.zip path: _packages/**/*.zip
#
# terraform_emqx: terraform_emqx:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
#
# needs: [build] needs: [build]
# outputs: outputs:
# emqx_public_ip: ${{ steps.emqx_private_ip.outputs.emqx_public_ip }} emqx_public_ip: ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
# emqx_node_ip1: ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }} emqx_node_ip1: ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }}
# emqx_node_ip2: ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }} emqx_node_ip2: ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }}
# emqx_node_ip3: ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }} emqx_node_ip3: ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
# with: with:
# name: ubuntu20.04 name: ubuntu20.04
# path: /tmp path: /tmp
# - name: Download emqx package - name: Download emqx package
# run: | run: |
# sudo cp /tmp/emqx/*.zip /tmp/emqx.zip sudo cp /tmp/emqx/*.zip /tmp/emqx.zip
# - name: Checkout tf-test-automation - name: Checkout tf-test-automation
# uses: actions/checkout@v2 uses: actions/checkout@v2
# with: with:
# repository: emqx/tf-test-automation repository: emqx/tf-test-automation
# ref: emqx-broker ref: emqx-broker
# path: tf-test-automation path: tf-test-automation
# - name: Setup Terraform - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1.3.2 uses: hashicorp/setup-terraform@v1.3.2
# with: with:
# terraform_wrapper: false terraform_wrapper: false
# - name: Terraform Init tf-test-automation - name: Terraform Init tf-test-automation
# working-directory: ./tf-test-automation/services/emqx working-directory: ./tf-test-automation/services/emqx
# id: init1 id: init1
# run: | 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 }}" 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 - name: Terraform Validate tf-test-automation
# working-directory: ./tf-test-automation/services/emqx working-directory: ./tf-test-automation/services/emqx
# id: validate1 id: validate1
# run: terraform validate -no-color run: terraform validate -no-color
# - name: Terraform Apply tf-test-automation - name: Terraform Apply tf-test-automation
# working-directory: ./tf-test-automation/services/emqx working-directory: ./tf-test-automation/services/emqx
# id: server_ip id: server_ip
# run: | 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" 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_private_ips::$(terraform output emqx_private_ips)"
# echo "::set-output name=emqx_public_ips::$(terraform output emqx_public_ips)" echo "::set-output name=emqx_public_ips::$(terraform output emqx_public_ips)"
# - name: Rename and upload emqx tfstate - name: Rename and upload emqx tfstate
# working-directory: ./tf-test-automation/services/emqx working-directory: ./tf-test-automation/services/emqx
# run: | run: |
# mv ./terraform.tfstate ./emqx.tfstate mv ./terraform.tfstate ./emqx.tfstate
# - uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
# if: always() if: always()
# with: with:
# name: tfstate name: tfstate
# path: ./tf-test-automation/services/emqx/emqx.tfstate path: ./tf-test-automation/services/emqx/emqx.tfstate
# - name: Show emqx_private_ips - name: Show emqx_private_ips
# id: emqx_private_ip id: emqx_private_ip
# run: | run: |
# ip1=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $1}'` 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}'` 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}'` 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}'` 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_ip1::$ip1"
# echo "::set-output name=emqx_node_ip2::$ip2" echo "::set-output name=emqx_node_ip2::$ip2"
# echo "::set-output name=emqx_node_ip3::$ip3" echo "::set-output name=emqx_node_ip3::$ip3"
# echo "::set-output name=emqx_public_ip::$emqx_public_ip" echo "::set-output name=emqx_public_ip::$emqx_public_ip"
# - name: Show emqx node ip - name: Show emqx node ip
# run: | run: |
# echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }} 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_ip2 }}
# echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }} echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
# echo ${{ steps.emqx_private_ip.outputs.emqx_public_ip }} echo ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
# xmeter_start: # xmeter_start:
# runs-on: ubuntu-latest # runs-on: ubuntu-latest
@ -316,49 +316,49 @@ jobs:
# run: | # run: |
# echo ${{ steps.mongo_ip.outputs.mongo_ip }} # echo ${{ steps.mongo_ip.outputs.mongo_ip }}
terraform_webhook: # terraform_webhook:
runs-on: ubuntu-latest # runs-on: ubuntu-latest
#
outputs: # outputs:
webhook_ip: ${{ steps.webhook_ip.outputs.webhook_ip }} # webhook_ip: ${{ steps.webhook_ip.outputs.webhook_ip }}
steps: # steps:
- name: Checkout tf-test-automation # - name: Checkout tf-test-automation
uses: actions/checkout@v2 # uses: actions/checkout@v2
with: # with:
repository: emqx/tf-test-automation # repository: emqx/tf-test-automation
ref: emqx-broker # ref: emqx-broker
path: tf-test-automation # path: tf-test-automation
- name: Setup Terraform # - name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2 # uses: hashicorp/setup-terraform@v1.3.2
with: # with:
terraform_wrapper: false # terraform_wrapper: false
- name: Terraform Init tf-test-automation # - name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/webhook # working-directory: ./tf-test-automation/services/webhook
id: init # id: init
run: | # 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 }}" # 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 # - name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/webhook # working-directory: ./tf-test-automation/services/webhook
id: validate # id: validate
run: terraform validate -no-color # run: terraform validate -no-color
- name: Terraform Apply tf-test-automation # - name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/webhook # working-directory: ./tf-test-automation/services/webhook
id: webhook_ip # id: webhook_ip
run: | # 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 }}" # 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)" # echo "::set-output name=webhook_ip::$(terraform output webhook_private_ips)"
- name: Rename and upload webhook server tfstate # - name: Rename and upload webhook server tfstate
working-directory: ./tf-test-automation/services/webhook # working-directory: ./tf-test-automation/services/webhook
run: | # run: |
mv ./terraform.tfstate ./webhook.tfstate # mv ./terraform.tfstate ./webhook.tfstate
- uses: actions/upload-artifact@v2 # - uses: actions/upload-artifact@v2
if: always() # if: always()
with: # with:
name: tfstate # name: tfstate
path: ./tf-test-automation/services/webhook/webhook.tfstate # path: ./tf-test-automation/services/webhook/webhook.tfstate
- name: Show webhook ip # - name: Show webhook ip
run: | # run: |
echo ${{ steps.webhook_ip.outputs.webhook_ip }} # echo ${{ steps.webhook_ip.outputs.webhook_ip }}
# #
# master_control: # master_control:
# runs-on: ubuntu-latest # runs-on: ubuntu-latest