Files
wlan-testing/.github/workflows/ow_docker-compose.yml
Johann Hoffmann dcf3498b10 [WIFI-7604] Add workflows to test deployment upgrade paths (#471)
* Create and switch to composite action for Docker Compose in Kubernetes deployment

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add missing inputs to composite action

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add input for hashed password and adapt variable names

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix input variable names

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add Docker Compose upgrade test workflow

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Get deploy script according to deployment_version input

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Hard-code branch for testing

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Re-add RTTY_TOKEN for testing previous release upgrades

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* [WIFI-7697] Move deploy related files from wlan-testing to wlan-cloud-ucentral-deploy (#472)

* Change composite actions and workflows to use wlan-cloud-ucentral-deploy repo

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Checkout target branch matching with deployment version

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Remove working-directory option

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Rename image version variables to enable search and replace in deploy script

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Remove defaults from action inputs

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Try removing owsub and owanalytics ports for 2.4 deployment

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Actually remove ports since commenting out doesn't work

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* [WIFI-7766] Switch Docker Compose testing workflow to deployment on EC2 (#499)

* Switch from Kubernetes pod to EC2 instance deployment

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix indentation

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add VPC subnet ID to use existing security group

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Move env variable definition to executed SSH command

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Remove defaults from inputs to avoid overwriting deployment_version

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix syntax

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix variable syntax

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add my own SSH key for debugging

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Revert "Add my own SSH key for debugging"

This reverts commit e4a9fee140.

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Increase AWS instance size

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Update package lists before installing

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add curl insecure option and append self-signed REST API cert to AP cert trust store

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Pass FLAGS variable to clustersysteminfo Docker container

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Switch to github.run_number for uniqueness

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Start Docker manually on instance

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Install Docker using the repository

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Do not destroy created instances for debugging

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Quote selfsigned_restapi_ca

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Split SSH commands into multiple lines for better readability

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix syntax

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix typo

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Revert "Split SSH commands into multiple lines for better readability"

This reverts commit c08ec026cfe3915e36cef3215226b41dd0319ed8.

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Revert "Fix syntax"

This reverts commit f408cfd19f5cf01d6b1d1f78c930897f9442c7de.

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add debugging output for REST API CA cert

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add: RTTY_TOKEN env for older versions support

Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>

* Download self-signed REST API CA cert directly to virtual AP

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Switch to self-signed certs

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix variable name

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix step name

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Change hostname and use sudo to add hosts entry

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix syntax

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Actually add IP to hosts entry

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix missing hostname in AP hosts entry

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Adapt Docker Compose upgrade workflow to EC2 instance deployment

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Configure Docker to log to logstash input

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix Docker daemon config

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Add missing EOF

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix indentation

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix syntax

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Try to fix syntax again

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Use different delimiter

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix conflict after rebase

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Fix workflow syntax

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

* Disable StrictHostKeyChecking in workflow

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>

Co-authored-by: Dmitry Dunaev <dmitry@opsfleet.com>
2022-05-10 13:53:54 +02:00

177 lines
6.7 KiB
YAML

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@v2
- 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@v2
- 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 }}