@@ -11,13 +11,13 @@ import (
1111 "time"
1212
1313 "github.com/stretchr/testify/require"
14- "gopkg.in/yaml.v2"
1514 appsv1 "k8s.io/api/apps/v1"
1615 corev1 "k8s.io/api/core/v1"
1716 kubeclient "k8s.io/client-go/kubernetes"
1817 "k8s.io/client-go/rest"
1918 "k8s.io/utils/env"
2019 "sigs.k8s.io/controller-runtime/pkg/client"
20+ "sigs.k8s.io/yaml"
2121
2222 ocv1 "github.com/operator-framework/operator-controller/api/v1"
2323)
@@ -54,7 +54,7 @@ func CollectTestArtifacts(t *testing.T, artifactName string, c client.Client, cf
5454
5555 // get all cluster extensions save them to the artifact path.
5656 clusterExtensions := ocv1.ClusterExtensionList {}
57- if err := c .List (context .Background (), & clusterExtensions , client . InNamespace ( "" ) ); err != nil {
57+ if err := c .List (context .Background (), & clusterExtensions ); err != nil {
5858 fmt .Printf ("Failed to list cluster extensions: %v" , err )
5959 }
6060 for _ , clusterExtension := range clusterExtensions .Items {
@@ -69,6 +69,23 @@ func CollectTestArtifacts(t *testing.T, artifactName string, c client.Client, cf
6969 }
7070 }
7171
72+ // get all cluster extension revisions save them to the artifact path.
73+ clusterExtensionRevisions := ocv1.ClusterExtensionRevisionList {}
74+ if err := c .List (context .Background (), & clusterExtensionRevisions ); err != nil {
75+ fmt .Printf ("Failed to list cluster extensions: %v" , err )
76+ }
77+ for _ , cer := range clusterExtensionRevisions .Items {
78+ // Save cluster extension to artifact path
79+ clusterExtensionYaml , err := yaml .Marshal (cer )
80+ if err != nil {
81+ fmt .Printf ("Failed to marshal cluster extension: %v" , err )
82+ continue
83+ }
84+ if err := os .WriteFile (filepath .Join (artifactPath , cer .Name + "-clusterextensionrevision.yaml" ), clusterExtensionYaml , 0600 ); err != nil {
85+ fmt .Printf ("Failed to write cluster extension to file: %v" , err )
86+ }
87+ }
88+
7289 // get all catalogsources save them to the artifact path.
7390 catalogsources := ocv1.ClusterCatalogList {}
7491 if err := c .List (context .Background (), & catalogsources , client .InNamespace ("" )); err != nil {
0 commit comments