Add separate jobs for bringing up hosts and running tests on guests

This commit is contained in:
Brian Cain 2020-02-19 16:44:21 -08:00
parent 0101a1798c
commit 66c0a7510d
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 65 additions and 8 deletions

37
.ci/spec/clean-packet.sh Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env bash
# packet and job configuration
export SLACK_USERNAME="Vagrant"
export SLACK_ICON="https://media.giphy.com/media/yIQ5glQeheYE0/200.gif"
export SLACK_TITLE="Vagrant-Spec Test Runner"
export PACKET_EXEC_DEVICE_NAME="${PACKET_EXEC_DEVICE_NAME:-spec-ci-boxes}"
export PACKET_EXEC_DEVICE_SIZE="${PACKET_EXEC_DEVICE_SIZE:-baremetal_0,baremetal_1,baremetal_1e}"
export PACKET_EXEC_PREFER_FACILITIES="${PACKET_EXEC_PREFER_FACILITIES:-iad1,iad2,ewr1,dfw1,dfw2,sea1,sjc1,lax1}"
export PACKET_EXEC_OPERATING_SYSTEM="${PACKET_EXEC_OPERATING_SYSTEM:-ubuntu_18_04}"
export PACKET_EXEC_PRE_BUILTINS="${PACKET_EXEC_PRE_BUILTINS:-InstallVagrant,InstallVirtualBox,InstallVmware,InstallHashiCorpTool,InstallVagrantVmware}"
export PACKET_EXEC_QUIET="1"
export PKT_VAGRANT_CLOUD_TOKEN="${VAGRANT_CLOUD_TOKEN}"
export VAGRANT_PKG_VERSION="2.2.7" # need to figure out how to make this latest instead
###
csource="${BASH_SOURCE[0]}"
while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
. "${root}/.ci/common.sh"
pushd "${root}" > "${output}"
# Ensure we have a packet device to connect
echo "Cleaning up packet device..."
export PKT_VAGRANT_HOST_BOXES="${VAGRANT_HOST_BOXES}"
export PKT_VAGRANT_GUEST_BOXES="${VAGRANT_GUEST_BOXES}"
export PKT_VAGRANT_CWD=test/vagrant-spec/
export PKT_VAGRANT_VAGRANTFILE=Vagrantfile.spec
pkt_wrap_stream "cd vagrant;vagrant destroy -f" \
"Vagrant command failed"
echo "Finished destroying spec test hosts"

View File

@ -16,23 +16,43 @@ jobs:
run: .ci/spec/create-packet.sh
working-directory: ${{github.workspace}}
spec-tests:
setup-hosts:
if: github.repository == 'hashicorp/vagrant-blackbox'
runs-on: self-hosted
strategy:
matrix:
host_os: ["hashicorp/bionic64"]
guest_os: ["hashicorp/bionic64", "hashicorp-vagrant/ubuntu-16.04"]
name: Vagrant-Spec Tests
name: Vagrant-Spec Start Hosts
needs: setup-packet
steps:
- name: Code Checkout
uses: actions/checkout@v1
- name: Run Tests with host ${{ matrix.host_os }} using guest ${{ matrix.guest_os }}
run: .ci/spec/create-hosts.sh
working-directory: ${{github.workspace}}
env:
VAGRANT_HOST_BOXES: "hashicorp/bionic64"
VAGRANT_GUEST_BOXES: "hasicorp/bionic64","hashicorp-vagrant/ubuntu-16.04"
spec-tests:
if: github.repository == 'hashicorp/vagrant-blackbox'
runs-on: self-hosted
name: Vagrant-Spec Tests
needs: setup-hosts
steps:
- name: Run Tests with all hosts and guests
run: .ci/spec/run-test.sh
working-directory: ${{github.workspace}}
env:
VAGRANT_HOST_BOXES: ${{ matrix.host_os }}
VAGRANT_GUEST_BOXES: ${{ matrix.guest_os }}
VAGRANT_HOST_BOXES: "hashicorp/bionic64"
VAGRANT_GUEST_BOXES: "hasicorp/bionic64","hashicorp-vagrant/ubuntu-16.04"
cleanup:
if: github.repository == 'hashicorp/vagrant-blackbox'
runs-on: self-hosted
name: Cleanup Post Vagrant-Spec Tests
needs: spec-tests
steps:
- name: Clean Packet
if: always()
run: .ci/spec/clean-packet.sh
- name: Clean Workspace
if: always()
run: rm -rf ${{ github.workspace }}