Open viccuad opened 3 years ago
This is happening because the klog script is only called inside the destroy-k8s task: https://github.com/SUSE/cap/blob/515c930fd6e235099fd1feef1fa62bbed733496b/cap-ci/common/destroy_k8s.tmpl#L40-L52
Yet (rightly) the definition of the resource has nothing to do with destroy_k8s: https://github.com/SUSE/cap/blob/515c930fd6e235099fd1feef1fa62bbed733496b/cap-ci/pipeline.yaml.tmpl#L88-L98
Possible solutions:
IMHO, the correct solution would be to create another task klog
analogous to destroy_k8s
, that is run on_failure if enabled. This means calling a common_klog just before all common_destroy_k8s, if klog is enabled. Gave a quick try in https://github.com/SUSE/cap/compare/viccuad/fix-klogs-destroy, but fails so far. See commit messages.
A cheap, spaghetti solution would be: (pseudocode) {{- if ($config.logs.enabled or $jobs.deploy-k8s == false) }}
in https://github.com/suse/cap/blob/master/cap-ci/pipeline.yaml.tmpl#L88
There is a fundamental issue of design here. klog should not be part of destroy k8s job (aka destroy-kubecf flag) https://jira.suse.com/browse/CAP-1564
Using the following config file:
(note
logs.enabled=true
andjobs.deploy-k8s=false
)Gives me: