gha: Add collect artifacts function in gha-run script

This PR adds the collect artifacts function in gha-run script for
the kubernetes tests.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
Gabriela Cervantes
2024-02-21 16:23:39 +00:00
parent 2070e3481e
commit 342d3a320d
2 changed files with 19 additions and 8 deletions

View File

@@ -85,10 +85,10 @@ jobs:
timeout-minutes: 30
run: bash tests/integration/kubernetes/gha-run.sh run-tests
- name: Make artifacts tarball ${{ matrix.vmm }}
run: bash tests/integration/kubernetes/gha-run.sh make-tarball-artifacts
- name: Collect artifacts
run: bash tests/integration/kubernetes/gha-run.sh collect-artifacts
- name: Archive artifacts ${{ matrix.vmm }}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: k8s-tests-garm-${{ matrix.vmm }}

View File

@@ -204,6 +204,16 @@ function run_tests() {
popd
}
function collect_artifacts() {
local artifacts_dir="/tmp/artifacts"
if [ -d "${artifacts_dir}" ]; then
rm -rf "${artifacts_dir}"
fi
mkdir -p "${artifacts_dir}"
info "Running teardown script to collect artifacts using ${KATA_HYPERVISOR} hypervisor"
bash "${kubernetes_dir}/../../../ci/teardown.sh" "${artifacts_dir}"
}
function cleanup_kata_deploy() {
ensure_yq
@@ -382,6 +392,7 @@ function main() {
deploy-snapshotter) deploy_snapshotter ;;
run-tests) run_tests ;;
run-tests-kcli) run_tests "kcli" ;;
collect-artifacts) collect_artifacts ;;
cleanup-kcli) cleanup "kcli" ;;
cleanup-sev) cleanup "sev" ;;
cleanup-snp) cleanup "snp" ;;