github.com/redhat-appstudio/e2e-tests@v0.0.0-20240520140907-9709f6f59323/pkg/clients/tekton/tekton_chains_public_keys.go (about) 1 package tekton 2 3 import ( 4 "context" 5 "fmt" 6 7 "github.com/redhat-appstudio/e2e-tests/pkg/constants" 8 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 ) 10 11 // GetTektonChainsPublicKey returns a TektonChains public key. 12 func (t *TektonController) GetTektonChainsPublicKey() ([]byte, error) { 13 namespace := constants.TEKTON_CHAINS_NS 14 secretName := "public-key" 15 dataKey := "cosign.pub" 16 17 secret, err := t.KubeInterface().CoreV1().Secrets(namespace).Get(context.Background(), secretName, metav1.GetOptions{}) 18 if err != nil { 19 return nil, fmt.Errorf("couldn't get the secret %s from %s namespace: %+v", secretName, namespace, err) 20 } 21 publicKey := secret.Data[dataKey] 22 if len(publicKey) < 1 { 23 return nil, fmt.Errorf("the content of the public key '%s' in secret %s in %s namespace is empty", dataKey, secretName, namespace) 24 } 25 return publicKey, err 26 }