Skip to content
name: Avi - Single Site Deployment
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
#push:
# branches: [ main ]
#pull_request:
# branches: [ main ]
release:
types: [released]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# These scenarios will be ran in parallel
jobs:
# This workflow contains multiple jobs to test various scenarios
single-site:
name: 1-site (${{ matrix.avi_version }},Network_${{ matrix.create_networking }},HA_${{ matrix.controller_ha }})
runs-on: ubuntu-latest
env:
site_type: "single-site"
GOOGLE_APPLICATION_CREDENTIALS: /home/runner/gcp-creds.json
TF_VAR_project: ${{ secrets.TF_VAR_PROJECT }}
TF_VAR_region: ${{ secrets.TF_VAR_REGION }}
TF_VAR_avi_version: ${{ matrix.avi_version }}
TF_VAR_create_networking: ${{ matrix.create_networking }}
TF_VAR_controller_ha: ${{ matrix.controller_ha }}
TF_VAR_service_account_email: ${{ secrets.TF_VAR_SERVICE_ACCOUNT_EMAIL }}
TF_VAR_controller_default_password: ${{ secrets.TF_VAR_CONTROLLER_DEFAULT_PASSWORD }}
TF_VAR_controller_password: ${{ secrets.TF_VAR_CONTROLLER_PASSWORD }}
TF_VAR_controller_image_gs_path: ${{ secrets.BUCKET }}/gcp_controller-${{ matrix.avi_version }}.tar.gz
TF_VAR_controller_public_address: true
TF_VAR_configure_ipam_profile: true
TF_VAR_ipam_networks: '[{ network="192.168.250.0/24", static_pool=["192.168.250.1", "192.168.250.254"]}]'
TF_VAR_configure_dns_profile: "true"
TF_VAR_dns_service_domain: "aviterraform.local"
TF_VAR_configure_dns_vs: "true"
TF_VAR_dns_vs_settings: '{ auto_allocate_ip=true, auto_allocate_public_ip=true, vs_ip = "", network = "192.168.250.0/24"}'
TF_VAR_register_controller: '{ enabled = "${{ matrix.register_controller }}", jwt_token = "${{ secrets.jwt_token }}", email = "${{ secrets.email }}", organization_id = "${{ secrets.organization_id }}" }'
register_controller: '{"register_controller":{"enabled":"${{ matrix.register_controller }}","jwt_token":"${{ secrets.jwt_token }}","email":"${{ secrets.email }}","organization_id":"${{ secrets.organization_id }}"}}'
defaults:
run:
shell: bash
working-directory: test
strategy:
matrix:
include:
- avi_version: 20.1.9
create_networking: true
controller_ha: false
register_controller: false
- avi_version: 20.1.9
create_networking: true
controller_ha: true
register_controller: false
- avi_version: 21.1.4
create_networking: true
controller_ha: false
register_controller: true
- avi_version: 21.1.4
create_networking: true
controller_ha: true
register_controller: true
- avi_version: 22.1.1
create_networking: true
controller_ha: false
register_controller: true
- avi_version: 22.1.1
create_networking: true
controller_ha: true
register_controller: true
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: 1.16
- name: Setup Env
run: |
go mod download
pipx inject ansible-core avisdk requests --include-deps --include-apps
pipx list
ansible-galaxy collection install git+https://github.com/vmware/ansible-collection-alb.git,eng
echo $GCP_CREDS > /home/runner/gcp-creds.json
echo $TF_VAR_register_controller
env:
GCP_CREDS: ${{ secrets.GCP_CREDS }}
- name: Create Infrastructure and run Go Tests
run: go test -v create_infra_test.go -tags=e2e -timeout 120m
- name: Run Ansible Playbook to verify Avi Controller Status
run: |
export name_prefix=$(cat ../examples/single-site/.test-data/TF_VAR_name_prefix.json)
export controller_ip=$(terraform -chdir="../examples/single-site" output -no-color -json | jq .controllers.value[0].public_ip_address)
ansible-playbook ansible_test.yml -e password=$TF_VAR_controller_password -e controller_ip=$controller_ip -e avi_version=$TF_VAR_avi_version -e name_prefix=$name_prefix -e controller_ha=$TF_VAR_controller_ha -e $register_controller
- name: Cleanup Avi Created Infra
if: ${{ always() }}
run: |
export controller_ip=$(terraform -chdir="../examples/single-site" output -no-color -json | jq .controllers.value[0].public_ip_address)
ansible-playbook ansible_avi_cleanup.yml -e password=$TF_VAR_controller_password -e controller_ip=$controller_ip -e avi_version=$TF_VAR_avi_version -e $register_controller
- name: Run Terraform Destroy
if: ${{ always() }}
run: |
go test -v destroy_infra_test.go -timeout 30m
rm /home/runner/gcp-creds.json