`config.logs.enabled=true` when `config.jobs.deploy-k8s-false` is broken
Opened this issue · 2 comments
Using the following config file:
(note logs.enabled=true
and jobs.deploy-k8s=false
)
workertags:
caasp4: suse-internal
jobs:
deploy-k8s: false
deploy-kubecf: true
smoke-tests: true
cf-acceptance-tests-brain: false
sync-integration-tests: false
minibroker-integration-tests: false
cf-acceptance-tests: false
upgrade-kubecf: false
deploy-stratos: false
destroy-kubecf: true
jobs_ordered:
- deploy-k8s
- deploy-kubecf
- smoke-tests
- cf-acceptance-tests-brain
- sync-integration-tests
- minibroker-integration-tests
- cf-acceptance-tests
- upgrade-kubecf
- deploy-stratos
- destroy-kubecf
backends:
caasp4: true
aks: false
gke: false
eks: false
availabilities:
sa: true
ha: false
all: false
schedulers:
diego: true
eirini: false
catapult:
uri: https://github.com/SUSE/catapult
branch: master
brain:
verbose: false
inorder: false
include: ""
exclude: ""
cats:
nodes: 3
flake-attempts: 5
timeout-scale: "3.0"
s3minibroker:
bucket: minibroker-helm-charts
region: us-east-1
regexp: minibroker-charts/minibroker-(.*).tgz
s3:
bucket: kubecf
region: us-west-2
regexp: kubecf-bundle-v(.*).tgz
# Scheduling is required for nightly builds, enabling it removes regular trigger on kubecf bundle.
schedule:
enabled: false
start: 12:00 AM
stop: 12:10 AM
location: America/Vancouver
logs:
enabled: true
Gives me:
apply configuration? [yN]: y
error: invalid pipeline config:
invalid resources:
resource 's3.klog-destination' is not used
This is happening because the klog script is only called inside the destroy-k8s task:
cap/cap-ci/common/destroy_k8s.tmpl
Lines 40 to 52 in 515c930
Yet (rightly) the definition of the resource has nothing to do with destroy_k8s:
Lines 88 to 98 in 515c930
Possible solutions:
-
IMHO, the correct solution would be to create another task
klog
analogous todestroy_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