2.x testing with Docker Compose deployment #930
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 2.x testing with Docker Compose deployment | |
env: | |
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }} | |
on: | |
workflow_dispatch: | |
inputs: | |
deployment_version: | |
default: 'main' | |
description: 'OpenWIFI deployment repository version to be deployed.' | |
required: true | |
owgw_version: | |
description: 'OpenWIFI Gateway version to be deployed.' | |
required: false | |
owsec_version: | |
description: 'OpenWIFI Security version to be deployed.' | |
required: false | |
owfms_version: | |
description: 'OpenWIFI Firmware version to be deployed.' | |
required: false | |
owprov_version: | |
description: 'OpenWIFI Provisioning version to be deployed.' | |
required: false | |
owanalytics_version: | |
description: 'OpenWIFI Analytics version to be deployed.' | |
required: false | |
owsub_version: | |
description: 'OpenWIFI Subscription (Userportal) version to be deployed.' | |
required: false | |
id: | |
description: 'run identifier' | |
required: false | |
microservice: | |
description: 'OpenWIFI microservice to be tested' | |
required: true | |
type: choice | |
options: | |
- owgw | |
- owsec | |
- owfms | |
- all | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
id: | |
name: Workflow ID Provider | |
runs-on: ubuntu-latest | |
steps: | |
- name: ${{ github.event.inputs.id }} | |
run: echo run identifier ${{ inputs.id }} | |
deploy-controller: | |
name: Deploy OpenWIFI Cloud SDK | |
needs: id | |
runs-on: ubuntu-latest | |
env: | |
AWS_DEFAULT_OUTPUT: json | |
AWS_DEFAULT_REGION: us-east-2 | |
outputs: | |
gateway_url: ${{ steps.deploy-sdk-docker-compose.outputs.gateway_url }} | |
sec_url: ${{ steps.deploy-sdk-docker-compose.outputs.sec_url }} | |
instance_id: ${{ steps.deploy-sdk-docker-compose.outputs.instance_id }} | |
instance_name: ${{ steps.deploy-sdk-docker-compose.outputs.instance_name }} | |
instance_public_ip: ${{ steps.deploy-sdk-docker-compose.outputs.instance_public_ip }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use deploy-sdk-docker-compose composite action | |
id: deploy-sdk-docker-compose | |
uses: ./.github/actions/deploy-sdk-docker-compose | |
with: | |
deployment_version: ${{ github.event.inputs.deployment_version }} | |
owgw_version: ${{ github.event.inputs.owgw_version }} | |
owsec_version: ${{ github.event.inputs.owsec_version }} | |
owfms_version: ${{ github.event.inputs.owfms_version }} | |
owprov_version: ${{ github.event.inputs.owprov_version }} | |
owanalytics_version: ${{ github.event.inputs.owanalytics_version }} | |
owsub_version: ${{ github.event.inputs.owsub_version }} | |
owsec_default_username: ${{ secrets.OWSEC_DEFAULT_USERNAME }} | |
owsec_default_password: ${{ secrets.OWSEC_DEFAULT_PASSWORD }} | |
owsec_hashed_default_password: ${{ secrets.UCENTRALGW_AUTH_PASSWORD }} | |
owsec_new_password: ${{ secrets.OWSEC_NEW_PASSWORD }} | |
owfms_s3_secret: ${{ secrets.UCENTRALFMS_S3_SECRET }} | |
owfms_s3_key: ${{ secrets.UCENTRALFMS_S3_KEY }} | |
rtty_token: ${{ secrets.RTTY_TOKEN }} | |
instance_ssh_key: ${{ secrets.SSH_LOADSIM }} | |
deploy-virtual-ap-instance: | |
name: Deploy virtual AP EC2 instance | |
needs: deploy-controller | |
runs-on: ubuntu-latest | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
outputs: | |
serial_number: ${{ steps.deploy-virtual-ap-instance.outputs.serial_number }} | |
instance_id: ${{ steps.deploy-virtual-ap-instance.outputs.instance_id }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use deploy-virtual-ap-instance composite action | |
id: deploy-virtual-ap-instance | |
uses: ./.github/actions/deploy-virtual-ap-instance | |
with: | |
virtual_ap_password: ${{ secrets.VIRTUAL_AP_PASSWORD }} | |
virtual_ap_cert: ${{ secrets.VIRTUAL_AP_CERT }} | |
virtual_ap_key: ${{ secrets.VIRTUAL_AP_KEY }} | |
virtual_ap_dev_id: ${{ secrets.VIRTUAL_AP_DEV_ID }} | |
gateway_url: ${{ needs.deploy-controller.outputs.gateway_url }} | |
gateway_public_ip: ${{ needs.deploy-controller.outputs.instance_public_ip }} | |
test: | |
name: Test specified microservice | |
needs: [deploy-controller, deploy-virtual-ap-instance] | |
runs-on: ubuntu-latest | |
env: | |
OWSEC: "${{ needs.deploy-controller.outputs.sec_url }}:16001" | |
OWSEC_USERNAME: ${{ secrets.OWSEC_DEFAULT_USERNAME }} | |
OWSEC_PASSWORD: ${{ secrets.OWSEC_NEW_PASSWORD }} | |
FLAGS: "-s -k" | |
steps: | |
- name: Add hostname for ${{ needs.deploy-controller.outputs.sec_url }} | |
run: | | |
echo "${{ needs.deploy-controller.outputs.instance_public_ip }} ${{ needs.deploy-controller.outputs.sec_url }}" | sudo tee -a /etc/hosts | |
- name: Get OWGW CLI script and test service | |
if: github.event.inputs.microservice == 'owgw' || github.event.inputs.microservice == 'all' | |
run: | | |
curl -s https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentralgw/master/test_scripts/curl/cli -o cli | |
chmod +x cli | |
./cli test_service ${{ needs.deploy-virtual-ap-instance.outputs.serial_number }} | |
- name: Get OWSec CLI script and test service | |
if: github.event.inputs.microservice == 'owsec' || github.event.inputs.microservice == 'all' | |
run: | | |
curl -s https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentralsec/main/test_scripts/curl/cli -o cli | |
chmod +x cli | |
./cli test_service | |
- name: Get OWFms CLI script and test service | |
if: github.event.inputs.microservice == 'owfms' || github.event.inputs.microservice == 'all' | |
run: | | |
curl -s https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentralfms/main/test_scripts/curl/cli -o cli | |
chmod +x cli | |
./cli test_service ${{ needs.deploy-virtual-ap-instance.outputs.serial_number }} | |
destroy-controller: | |
name: Destroy OpenWiFi cloud SDK instance | |
needs: [deploy-controller, test] | |
runs-on: ubuntu-latest | |
env: | |
AWS_DEFAULT_REGION: us-east-2 | |
if: always() | |
steps: | |
- name: Delete EC2 instance | |
continue-on-error: true | |
run: | | |
aws ec2 terminate-instances --instance-ids ${{ needs.deploy-controller.outputs.instance_id }} | |
terminate-virtual-ap-instance: | |
name: Terminate virtual AP instance | |
needs: [deploy-virtual-ap-instance, test] | |
runs-on: ubuntu-latest | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
if: always() | |
steps: | |
- name: Terminate virtual AP EC2 instance | |
continue-on-error: true | |
run: | | |
aws ec2 terminate-instances --instance-ids ${{ needs.deploy-virtual-ap-instance.outputs.instance_id }} |