ci: Separate log pulling and notify on success
* Without being a separate task, log pull won't happen on failure * Add a job at the end for notifying on success - since these only run nightly and on manual trigger, seems like it'd be nice to get notified of something happy!
This commit is contained in:
parent
b842f6841a
commit
31c2390533
12
.ci/spec/notify-success.sh
Executable file
12
.ci/spec/notify-success.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
csource="${BASH_SOURCE[0]}"
|
||||
while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
|
||||
root="$( cd -P "$( dirname "$csource" )/../../" && pwd )"
|
||||
|
||||
. "${root}/.ci/load-ci.sh"
|
||||
. "${root}/.ci/spec/env.sh"
|
||||
|
||||
pushd "${root}" > "${output}"
|
||||
|
||||
slack -m 'Tests have passed!'
|
||||
28
.ci/spec/pull-log.sh
Executable file
28
.ci/spec/pull-log.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
csource="${BASH_SOURCE[0]}"
|
||||
while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
|
||||
root="$( cd -P "$( dirname "$csource" )/../../" && pwd )"
|
||||
|
||||
. "${root}/.ci/load-ci.sh"
|
||||
. "${root}/.ci/spec/env.sh"
|
||||
|
||||
pushd "${root}" > "${output}"
|
||||
|
||||
# Use same setup as run-tests.sh so `vagrant ssh` will work.
|
||||
|
||||
unset PACKET_EXEC_PRE_BUILTINS
|
||||
|
||||
# spec test configuration, defined by action runners, used by Vagrant on packet
|
||||
export PKT_VAGRANT_HOST_BOXES="${VAGRANT_HOST_BOXES}"
|
||||
export PKT_VAGRANT_GUEST_BOXES="${VAGRANT_GUEST_BOXES}"
|
||||
# other vagrant-spec options
|
||||
export PKT_VAGRANT_HOST_MEMORY="${VAGRANT_HOST_MEMORY:-10000}"
|
||||
export PKT_VAGRANT_CWD="test/vagrant-spec/"
|
||||
export PKT_VAGRANT_VAGRANTFILE=Vagrantfile.spec
|
||||
export PKT_VAGRANT_SPEC_PROVIDERS="${VAGRANT_SPEC_PROVIDERS}"
|
||||
export PKT_VAGRANT_DOCKER_IMAGES="${VAGRANT_DOCKER_IMAGES}"
|
||||
|
||||
echo "Pulling log..."
|
||||
packet-exec run "vagrant ssh -c \"cat /tmp/vagrant-spec.log\" > vagrant-spec.log"
|
||||
packet-exec run "cat vagrant-spec.log" > vagrant-spec.log
|
||||
@ -29,8 +29,4 @@ echo "Running vagrant spec tests..."
|
||||
wrap_stream packet-exec run "vagrant provision" \
|
||||
"Vagrant Acceptance testing command failed"
|
||||
|
||||
echo "Pulling log..."
|
||||
packet-exec run "vagrant ssh -c \"cat /tmp/vagrant-spec.log\" > vagrant-spec.log"
|
||||
packet-exec run "cat vagrant-spec.log" > vagrant-spec.log
|
||||
|
||||
echo "Finished vagrant spec tests"
|
||||
|
||||
23
.github/workflows/spectesting.yml
vendored
23
.github/workflows/spectesting.yml
vendored
@ -66,6 +66,17 @@ jobs:
|
||||
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}
|
||||
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
|
||||
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
|
||||
- name: Pull log from guest
|
||||
if: always()
|
||||
run: ./.ci/spec/pull-log.sh
|
||||
env:
|
||||
VAGRANT_HOST_BOXES: ${{matrix.host_os}}
|
||||
VAGRANT_GUEST_BOXES: ${{matrix.guest_os}}
|
||||
VAGRANT_SPEC_PROVIDERS: ${{matrix.providers}}
|
||||
VAGRANT_DOCKER_IMAGES: ${{matrix.docker_images}}
|
||||
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}
|
||||
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
|
||||
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
|
||||
- name: Upload log
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
@ -83,3 +94,15 @@ jobs:
|
||||
run: ./.ci/spec/clean-packet.sh
|
||||
- name: Clean Workspace
|
||||
run: rm -rf ${{ github.workspace }}
|
||||
|
||||
notify-on-success:
|
||||
runs-on: self-hosted
|
||||
name: Notify on Success
|
||||
needs: spec-tests
|
||||
if: success()
|
||||
steps:
|
||||
- name: Notify on Success
|
||||
run: ./.ci/spec/notify-success.sh
|
||||
env:
|
||||
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
|
||||
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user