ci: add e2e-upgrade test

The test is implemented as a go test.
It can be executed as a bazel target.
The general workflow is to setup a cluster,
point the test to the workspace in which to
find the kubeconfig and the constellation config
and specify a target image, k8s and
service version. The test will succeed
if it detects all target versions in the cluster
within the configured timeout.
The CI automates the above steps.
A separate workflow is introduced as there
are multiple input fields to the test.
Adding all of these to the manual e2e test
seemed confusing.

Co-authored-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
Otto Bittner 2023-02-03 10:05:42 +00:00
parent 18661ced48
commit cac43a1dd0
25 changed files with 920 additions and 58 deletions

View file

@ -12,12 +12,9 @@ import (
"fmt"
"net/http"
"net/url"
"path"
"strings"
"time"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
"github.com/edgelesssys/constellation/v2/internal/config"
"github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/edgelesssys/constellation/v2/internal/file"
@ -181,34 +178,21 @@ func (cfm *configFetchMeasurementsCmd) parseFetchMeasurementsFlags(cmd *cobra.Co
}
func (f *fetchMeasurementsFlags) updateURLs(conf *config.Config) error {
ver, err := versionsapi.NewVersionFromShortPath(conf.Image, versionsapi.VersionKindImage)
if err != nil {
return fmt.Errorf("creating version from image name: %w", err)
}
measurementsURL, signatureURL, err := versionsapi.MeasurementURL(ver, conf.GetProvider())
if err != nil {
return err
}
if f.measurementsURL == nil {
url, err := measurementURL(conf.GetProvider(), conf.Image, "measurements.json")
if err != nil {
return err
}
f.measurementsURL = url
f.measurementsURL = measurementsURL
}
if f.signatureURL == nil {
url, err := measurementURL(conf.GetProvider(), conf.Image, "measurements.json.sig")
if err != nil {
return err
}
f.signatureURL = url
f.signatureURL = signatureURL
}
return nil
}
func measurementURL(provider cloudprovider.Provider, image, file string) (*url.URL, error) {
ver, err := versionsapi.NewVersionFromShortPath(image, versionsapi.VersionKindImage)
if err != nil {
return nil, fmt.Errorf("creating version from image name: %w", err)
}
artifactBaseURL := ver.ArtifactURL()
url, err := url.Parse(artifactBaseURL)
if err != nil {
return nil, fmt.Errorf("parsing artifact base URL %s: %w", artifactBaseURL, err)
}
url.Path = path.Join(url.Path, "image", "csp", strings.ToLower(provider.String()), file)
return url, nil
}