From c9cd349dac5ff02ca9b4251d906be3cc2cca5308 Mon Sep 17 00:00:00 2001 From: tommyd450 Date: Tue, 24 Sep 2024 11:31:57 +0100 Subject: [PATCH] Fix for the push pipeline and incomplete rebase --- .tekton/cosign-push.yaml | 2 +- test/e2e_test.go | 47 ++++++---------------------------------- 2 files changed, 8 insertions(+), 41 deletions(-) diff --git a/.tekton/cosign-push.yaml b/.tekton/cosign-push.yaml index d8eb61749f6..cc3c6a90cf3 100644 --- a/.tekton/cosign-push.yaml +++ b/.tekton/cosign-push.yaml @@ -179,7 +179,7 @@ spec: value: quay.io/redhat-appstudio-tekton-catalog/task-prefetch-dependencies-oci-ta:0.1@sha256:57979e1c289bfe09acb70401f35558a9032e749b398a43fea049c044f9d96afe - name: kind value: task - resolver: bundles<<<<<<< unit_tests_on_tas_pipeline_v2 + resolver: bundles - name: build-container params: - name: IMAGE diff --git a/test/e2e_test.go b/test/e2e_test.go index 230531bf1f0..f0e36328b6f 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -21,7 +21,12 @@ import ( "bytes" "context" "crypto" + "crypto/rand" + "crypto/sha256" + "crypto/x509" + "encoding/base64" "encoding/json" + "encoding/pem" "fmt" "io" "net/http" @@ -55,6 +60,8 @@ import ( "github.com/sigstore/cosign/v2/cmd/cosign/cli/sign" cliverify "github.com/sigstore/cosign/v2/cmd/cosign/cli/verify" "github.com/sigstore/cosign/v2/internal/pkg/cosign/fulcio/fulcioroots" + "github.com/sigstore/cosign/v2/internal/pkg/cosign/tsa" + "github.com/sigstore/cosign/v2/internal/pkg/cosign/tsa/client" "github.com/sigstore/cosign/v2/pkg/cosign" "github.com/sigstore/cosign/v2/pkg/cosign/bundle" "github.com/sigstore/cosign/v2/pkg/cosign/env" @@ -2548,43 +2555,3 @@ func getOIDCToken() (string, error) { } return string(body), nil } -<<<<<<< HEAD - -func setLocalEnv(t *testing.T, dir string) error { - // fulcio repo is downloaded to the user's home directory by e2e_test.sh - home, err := os.UserHomeDir() - if err != nil { - return fmt.Errorf("error getting home directory: %w", err) - } - t.Setenv(env.VariableSigstoreCTLogPublicKeyFile.String(), path.Join(home, "fulcio/config/ctfe/pubkey.pem")) - err = downloadAndSetEnv(t, fulcioURL+"/api/v1/rootCert", env.VariableSigstoreRootFile.String(), dir) - if err != nil { - return fmt.Errorf("error setting %s env var: %w", env.VariableSigstoreRootFile.String(), err) - } - err = downloadAndSetEnv(t, rekorURL+"/api/v1/log/publicKey", env.VariableSigstoreRekorPublicKey.String(), dir) - if err != nil { - return fmt.Errorf("error setting %s env var: %w", env.VariableSigstoreRekorPublicKey.String(), err) - } - return nil -} - -func downloadAndSetEnv(t *testing.T, url, envVar, dir string) error { - resp, err := http.Get(url) - if err != nil { - return fmt.Errorf("error downloading file: %w", err) - } - defer resp.Body.Close() - f, err := os.CreateTemp(dir, "") - if err != nil { - return fmt.Errorf("error creating temp file: %w", err) - } - defer f.Close() - _, err = io.Copy(f, resp.Body) - if err != nil { - return fmt.Errorf("error writing to file: %w", err) - } - t.Setenv(envVar, f.Name()) - return nil -} -======= ->>>>>>> v2.4.0