Skip to content

Commit

Permalink
ci: collect logs before cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kofemann committed Aug 14, 2023
1 parent e007ede commit b396a79
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .gitlab-ci.yml
Expand Up @@ -310,20 +310,40 @@ prepare_k8s_env:
script:
- kubectl create namespace ${K8S_NAMESPACE}


#
# collect all logs
#
collect_logs:
stage: testenv_post
image: bitnami/kubectl:latest
tags:
- kubernetes
- dcache-dev
when: always
allow_failure: true
script:
- kubectl -n $K8S_NAMESPACE get pods | grep Running | awk '{print $1}' | xargs -n1 kubectl -n $K8S_NAMESPACE logs | tee $K8S_NAMESPACE.log
artifacts:
name: "logs-$CI_PIPELINE_ID"
paths:
- "$K8S_NAMESPACE.log"

#
# dispose kubernetes resources
#
cleanup_k8s_env:
stage: testenv_post
image: bitnami/kubectl:latest
needs:
- collect_logs
tags:
- kubernetes
- dcache-dev
when: always
script:
- kubectl delete namespace ${K8S_NAMESPACE} --grace-period=1 --ignore-not-found=true


#
# infrastructure required to run dCache
#
Expand Down

0 comments on commit b396a79

Please sign in to comment.