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 timeout-minutes: 30
run: bash tests/integration/kubernetes/gha-run.sh run-tests run: bash tests/integration/kubernetes/gha-run.sh run-tests
- name: Make artifacts tarball ${{ matrix.vmm }} - name: Collect artifacts
run: bash tests/integration/kubernetes/gha-run.sh make-tarball-artifacts run: bash tests/integration/kubernetes/gha-run.sh collect-artifacts
- name: Archive artifacts ${{ matrix.vmm }} - name: Archive artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: k8s-tests-garm-${{ matrix.vmm }} name: k8s-tests-garm-${{ matrix.vmm }}

View File

@@ -204,6 +204,16 @@ function run_tests() {
popd 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() { function cleanup_kata_deploy() {
ensure_yq ensure_yq
@@ -382,6 +392,7 @@ function main() {
deploy-snapshotter) deploy_snapshotter ;; deploy-snapshotter) deploy_snapshotter ;;
run-tests) run_tests ;; run-tests) run_tests ;;
run-tests-kcli) run_tests "kcli" ;; run-tests-kcli) run_tests "kcli" ;;
collect-artifacts) collect_artifacts ;;
cleanup-kcli) cleanup "kcli" ;; cleanup-kcli) cleanup "kcli" ;;
cleanup-sev) cleanup "sev" ;; cleanup-sev) cleanup "sev" ;;
cleanup-snp) cleanup "snp" ;; cleanup-snp) cleanup "snp" ;;