Skip to content

Block on awscli. Supporting this is unclean #121

Block on awscli. Supporting this is unclean

Block on awscli. Supporting this is unclean #121

Workflow file for this run

name: Openstack Test Run
on:
push:
branches:
- "main"
- '!docs'
tags-ignore:
- "*"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TF_VAR_application_credential_id: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
TF_VAR_application_credential_secret: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
TF_VAR_ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
TF_VAR_ssh_public_key: ${{ secrets.SSH_PUBLIC_KEY }}
TF_VAR_os_auth_region: ${{ secrets.OS_AUTH_REGION }}
TF_VAR_os_auth_url: ${{ secrets.OS_AUTH_URL }}
TF_VAR_os_interface: ${{ secrets.OS_INTERFACE }}
TF_VAR_os_project_domain_name: ${{ secrets.OS_PROJECT_DOMAIN_NAME }}
TF_VAR_os_password: ${{ secrets.OS_PASSWORD }}
TF_VAR_os_project_id: ${{ secrets.OS_PROJECT_ID }}
TF_VAR_os_project_domain_id: ${{ secrets.OS_PROJECT_DOMAIN_ID }}
TF_VAR_os_project_name: ${{ secrets.OS_PROJECT_NAME }}
TF_VAR_os_region_name: ${{ secrets.OS_REGION_NAME }}
TF_VAR_os_username: ${{ secrets.OS_USERNAME }}
tf_working_directory: "./.github/workflows/openstack/terraform"
jobs:
terraform_openstack_create:
runs-on: self-hosted
defaults:
run:
working-directory: "./.github/workflows/openstack/terraform"
steps:
- uses: actions/checkout@v4
- name: Terraform fmt
id: fmt
run: |
terraform fmt -check
continue-on-error: true
- name: DEBUGVAR
id: debugvar
run: |
env | awk 'tolower($0)~/auth|project_name/'
- name: Terraform Init
id: init
run: |
terraform init
- name: Terraform Plan
id: plan
run: |
terraform plan -no-color
- name: Terraform Apply
id: apply
run: |
terraform apply -no-color -auto-approve
- name: Terraform Output File Create
run: |
terraform output -json > ${{ github.run_id }}-tf.out.json
- name: Make vm_ip file from Terraform Output File
id: get_vm_ip
run: |
echo "$(jq -r '.address.value' ${{ github.run_id }}-tf.out.json)" > ${{ github.workspace }}/${{ github.run_id }}-vm_ip
- name: Upload JSON Output
uses: actions/upload-artifact@v4
with:
name: ${{ github.run_id }}-tf.out.json
path: ${{ github.workspace }}/
overwrite: true
- name: Upload VM Output
uses: actions/upload-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
overwrite: true
clone_elevate_repo:
runs-on: self-hosted
needs: terraform_openstack_create
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Checkout Repo and Commit
if: github.event_name != 'pull_request'
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
script: |
cd /opt
echo "## [INFO]: ${{ github.ref }}"
echo "## [INFO]: ${{ github.ref_name }}"
echo "## [INFO}: ${{ github.repository }}"
git clone --depth 1 --branch ${{ github.ref_name }} https://github.com/${{ github.repository }}.git
hostname && pwd && ls -la
cd /opt/$(echo ${{ github.repository }} | cut -d / -f2)
git status
- name: Checking out Repo and Pull Request
if: github.event_name == 'pull_request'
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
script: |
cd /opt
echo "[DEBUG]: ${{ github.ref }}"
echo "[DEBUG]: ${{ github.head_ref }}"
echo "## [INFO}: ${{ github.repository }}"
git clone --depth 1 --branch ${{ github.head_ref }} https://github.com/${{ github.repository }}.git
cd /opt/$(echo ${{ github.repository }} | cut -d / -f2)
git status
setup_integration_checks:
runs-on: self-hosted
needs: clone_elevate_repo
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Setup for Integration Checks Prior to Running Elevate
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
script: |
REPODIR=$(echo ${{ github.repository }} | cut -d / -f2)
chmod -v +x /opt/${REPODIR}/t/integration/setup
/opt/${REPODIR}/t/integration/setup
start_elevate:
runs-on: self-hosted
needs: setup_integration_checks
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Starting Elevate
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
timeout: 30m
command_timeout: 30m
script: |
REPODIR=$(echo ${{ github.repository }} | cut -d / -f2)
cp -pv /opt/${REPODIR}/elevate-cpanel /scripts/elevate-cpanel
cp -pv /opt/${REPODIR}/.github/workflows/openstack/status_marker /scripts/status_marker
cp -pv /opt/${REPODIR}/.github/workflows/openstack/reboot_watch /scripts/reboot_watch
chmod -v +x /scripts/elevate-cpanel
/usr/local/cpanel/cpkeyclt
/scripts/elevate-cpanel --non-interactive --skip-cpanel-version-check --start &
wait_for_stage_1_reboot:
runs-on: self-hosted
needs: start_elevate
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Wait For VM to Come Back From Stage 2 Reboot
working-directory: "./.github/workflows/openstack/"
run: |
./ssh_retry ${{ steps.VM_IP.outputs.VM_IP }}
watch_for_stage_2_reboot:
runs-on: self-hosted
needs: wait_for_stage_1_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Reboot from Stage 1 into Stage 2
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
timeout: 60m
command_timeout: 30m
debug: true
script: |
/scripts/status_marker 1
/scripts/elevate-cpanel --log &
REBOOT_STRING="/usr/bin/systemctl start elevate-cpanel.service" RETVAL=1 /scripts/reboot_watch
wait_for_stage_2_reboot:
runs-on: self-hosted
needs: watch_for_stage_2_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Wait For VM to Come Back From Stage 2 Reboot
working-directory: "./.github/workflows/openstack/"
run: |
./ssh_retry ${{ steps.VM_IP.outputs.VM_IP }}
watch_for_stage_3_reboot:
runs-on: self-hosted
needs: wait_for_stage_2_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Stage 3 Reboot
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
timeout: 60m
command_timeout: 30m
debug: true
script: |
/scripts/status_marker 3
/scripts/elevate-cpanel --log &
REBOOT_STRING="Rebooting into stage 3 of 5" RETVAL=1 /scripts/reboot_watch
wait_for_stage_3_reboot:
runs-on: self-hosted
needs: watch_for_stage_3_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Wait For VM to Come Back From Stage 3 Reboot
working-directory: "./.github/workflows/openstack/"
run: |
./ssh_retry ${{ steps.VM_IP.outputs.VM_IP }}
watch_for_stage_4_reboot:
runs-on: self-hosted
needs: wait_for_stage_3_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Stage 4 Reboot
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
timeout: 30m
command_timeout: 30m
script: |
/scripts/status_marker 4
/scripts/elevate-cpanel --log &
REBOOT_STRING="Rebooting into stage 4 of 5" RETVAL=1 /scripts/reboot_watch
wait_for_stage_4_reboot:
runs-on: self-hosted
needs: watch_for_stage_4_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Wait For VM to Come Back From Stage 4 Reboot
working-directory: "./.github/workflows/openstack/"
run: |
./ssh_retry ${{ steps.VM_IP.outputs.VM_IP }}
watch_for_stage_5_reboot:
runs-on: self-hosted
needs: wait_for_stage_4_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Monitor Elevate for Stage 5 Reboot
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
timeout: 45m
command_timeout: 35m
script: |
/scripts/status_marker 5
/scripts/elevate-cpanel --log &
REBOOT_STRING="Rebooting into stage 5 of 5" RETVAL=1 /scripts/reboot_watch
wait_for_stage_5_reboot:
runs-on: self-hosted
needs: watch_for_stage_5_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Wait For VM to Come Back From Stage 5 Reboot
working-directory: "./.github/workflows/openstack/"
run: |
./ssh_retry ${{ steps.VM_IP.outputs.VM_IP }}
verify_upgraded_os:
runs-on: self-hosted
needs: wait_for_stage_5_reboot
outputs:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
steps:
- name: Download VM IP
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-vm_ip
path: ${{ github.workspace }}/
- name: Get VM IP from Artifact
id: VM_IP
run: |
echo "VM_IP=$(cat ${{ github.run_id }}-vm_ip)" >> "$GITHUB_OUTPUT"
cat ${{ github.run_id }}-vm_ip > VM_IP
ls -la
- name: Export VM_IP to env
env:
VM_IP: ${{ steps.VM_IP.outputs.VM_IP }}
run: echo "VM_IP is ${{ steps.VM_IP.outputs.VM_IP }}"
- name: Verify End Result Integration Tests
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ steps.VM_IP.outputs.VM_IP }}
username: 'root'
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: '22'
timeout: 5m
command_timeout: 1m
script: |
REPODIR=$(echo ${{ github.repository }} | cut -d / -f2)
/usr/local/cpanel/3rdparty/bin/prove -lvm /opt/${REPODIR}/t/integration/*.t
terraform_openstack_destroy:
runs-on: self-hosted
needs: verify_upgraded_os
defaults:
run:
working-directory: "./.github/workflows/openstack/terraform"
steps:
- name: Download Terraform Output JSON
uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}-tf.out.json
path: ${{ github.workspace }}/tf.out.json
- name: Destroy OpenStack VM
run: terraform destroy -no-color -auto-approve