Bug 2152094

Summary: Tekton pipeline fails in delete-template taskrun
Product: Container Native Virtualization (CNV) Reporter: Geetika Kapoor <gkapoor>
Component: InfrastructureAssignee: Karel Šimon <ksimon>
Status: CLOSED ERRATA QA Contact: Geetika Kapoor <gkapoor>
Severity: high Docs Contact:
Priority: high    
Version: 4.12.0CC: dholler, ksimon, ycui
Target Milestone: ---   
Target Release: 4.12.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-23 22:31:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Geetika Kapoor 2022-12-09 08:02:20 UTC
Description of problem:

Tekton pipeline fails in delete-template taskrun if any kind of taskrun failures happen before it.

Error:

2022/12/09 00:56:57 warning: unsuccessful cred copy: ".docker" from "/tekton/creds" to "/": unable to create destination directory: mkdir /.docker: permission denied
panic: templates.template.openshift.io "windows10-desktop-large-installer" is forbidden: User "system:serviceaccount:openshift-cnv:pipeline" cannot delete resource "templates" in API group "template.openshift.io" in the namespace "openshift-cnv" [recovered]
	panic: templates.template.openshift.io "windows10-desktop-large-installer" is forbidden: User "system:serviceaccount:openshift-cnv:pipeline" cannot delete resource "templates" in API group "template.openshift.io" in the namespace "openshift-cnv"

goroutine 1 [running]:
github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit.HandleExit()
	/remote-source/app/modules/modify-vm-template/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit/exit.go:80 +0xb4
panic({0xd667c0, 0xc000210ca0})
	/usr/lib/golang/src/runtime/panic.go:884 +0x212
github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit.ExitOrDieFromError(0x3, {0xf5dea0, 0xc000199860?}, {0xc0000cfe5f, 0x1, 0x1?})
	/remote-source/app/modules/modify-vm-template/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit/exit.go:60 +0x167
main.main()
	/remote-source/app/modules/modify-vm-template/cmd/modify-vm-template/main.go:41 +0x51a

Version-Release number of selected component (if applicable):

4.12

How reproducible:

always 

Steps to Reproduce:
1. any taskrun before delete-template should fail
2.
3.

Actual results:

delete-template getting impacted with any failures

Expected results:

delete-template should not be impacted with any failures

Additional info:

Comment 4 Geetika Kapoor 2023-02-17 00:26:10 UTC
Test Env:

$ oc get csv -n openshift-cnv
NAME                                       DISPLAY                       VERSION   REPLACES                                   PHASE
kubevirt-hyperconverged-operator.v4.12.1   OpenShift Virtualization      4.12.1    kubevirt-hyperconverged-operator.v4.12.0   Succeeded
openshift-pipelines-operator-rh.v1.9.0     Red Hat OpenShift Pipelines   1.9.0                                                Succeeded


Test Case :

Test Case 1 : Regular run with windows10 en iso image - pipelineref - windows10-installer - and then to check template deletion and vm cleanup
Result : Pipeline is GREEN and all tasks worked.

Test Case 2:  Running Pipeline , cancel/failed in between a clustertask(could be due to network, human intervention)and then to check template deletion and vm cleanup. 
Result :  we see that delete and cleanup tasks are still not started. 
Raised : https://issues.redhat.com/browse/SRVKP-2845

Test case 3: Rerun the Test case 1. Now DV already exist. Monitor the run and see the pipeline status. - pipelineref - windows10-installer
Result : Pipeline is GREEN and all tasks worked.


Test Case 4 : Regular run with - pipelineref - windows10-customize - and then to check template deletion and vm cleanup
Result : Pipeline is GREEN and all tasks worked.

Test Case 5 : Regular run with - pipelineref - windows10-customize with non regular dv name - and then to check template deletion and vm cleanup
Result : Failed as it only want win10 as dv name. This can be use configurable for better usability
Raised : https://bugzilla.redhat.com/show_bug.cgi?id=2170699



Teardown(delete+cleanup) doesn't work if pipeline failed/cancelled.

Comment 8 Geetika Kapoor 2023-05-23 17:15:05 UTC
Moving this bug to verified . All other test cases that needs retesting are track as independent bugs.

Comment 13 errata-xmlrpc 2023-05-23 22:31:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Virtualization 4.12.3 Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2023:3283