Repository: redhat-openshift-ecosystem/openshift-preflight
Pull request #462 (2022-03-08 16:10:49)

making certImage.certified match testResults.passed
- Fixes: #461 
- Moved`testResultsJsonFile` to be the first step since `testResults.passed` is needed in `certImage` creation. The diff makes it looked like more has changed, but it really is that test `testResultsJsonFile` moves from `last` to `first` in this code.

Signed-off-by: Adam D. Cornett <adc@redhat.com>

openshift-ci[bot]: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/redhat-openshift-ecosystem/openshift-preflight/pull/462#" title="Author self-approved">acornett21</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=redhat-openshift-ecosystem%2Fopenshift-preflight).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/redhat-openshift-ecosystem/openshift-preflight/blob/main/OWNERS)~~ [acornett21]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
openshift-ci[bot]: @acornett21: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
ci/prow/4.8-e2e | 0ae8045c212703871e6d94968aa3aaf6930f60c9 | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/redhat-openshift-ecosystem_openshift-preflight/462/pull-ci-redhat-openshift-ecosystem-openshift-preflight-main-4.8-e2e/1501228961869336576) | true | `/test 4.8-e2e`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=redhat-openshift-ecosystem&repo=openshift-preflight&pr=462). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:acornett21).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->

Patch:
diff --git a/certification/errors/errors.go b/certification/errors/errors.go
index cb70465..1b9af41 100644
--- a/certification/errors/errors.go
+++ b/certification/errors/errors.go
@@ -11,6 +11,7 @@ var (
 	ErrFormattingResults               = errors.New("error formatting results")
 	ErrInsufficientPosArguments        = errors.New("not enough positional arguments")
 	ErrGetRemoteContainerFailed        = errors.New("failed to pull remote container")
+	ErrParseTagInfoFailed              = errors.New("failed to parse tag info")
 	ErrExtractingTarball               = errors.New("failed to extract tarball")
 	ErrCreateTempDir                   = errors.New("failed to create temporary directory")
 	ErrImageInspectFailed              = errors.New("failed to inspect image")
diff --git a/certification/internal/engine/engine.go b/certification/internal/engine/engine.go
index 84d4416..2be6d3e 100644
--- a/certification/internal/engine/engine.go
+++ b/certification/internal/engine/engine.go
@@ -18,7 +18,7 @@ import (
 	"time"
 
 	"github.com/google/go-containerregistry/pkg/crane"
-	v1 "github.com/google/go-containerregistry/pkg/v1"
+	"github.com/google/go-containerregistry/pkg/name"
 	rpmdb "github.com/knqyf263/go-rpmdb/pkg"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/artifacts"
@@ -100,7 +100,14 @@ func (c *CraneEngine) ExecuteChecks() error {
 		return fmt.Errorf("%w: %s", errors.ErrExtractingTarball, err)
 	}
 
-	if err := writeCertImage(img); err != nil {
+	// store the image internals in the engine image reference to pass to validations.
+	c.imageRef = certification.ImageReference{
+		ImageURI:    c.Image,
+		ImageFSPath: containerFSPath,
+		ImageInfo:   img,
+	}
+
+	if err := writeCertImage(c.imageRef); err != nil {
 		return err
 	}
 
@@ -110,14 +117,6 @@ func (c *CraneEngine) ExecuteChecks() error {
 		}
 	}
 
-	// store the image internals in the engine image reference to pass to validations.
-	// TODO: pass this to validations when the new check interface includes it.
-	c.imageRef = certification.ImageReference{
-		ImageURI:    c.Image,
-		ImageFSPath: containerFSPath,
-		ImageInfo:   img,
-	}
-
 	if c.IsBundle {
 		// Record test cluster version
 		c.results.TestedOn, err = GetOpenshiftClusterVersion()
@@ -297,28 +296,28 @@ func untar(dst string, r io.Reader) error {
 	}
 }
 
-func writeCertImage(img v1.Image) error {
-	config, err := img.ConfigFile()
+func writeCertImage(imageRef certification.ImageReference) error {
+	config, err := imageRef.ImageInfo.ConfigFile()
 	if err != nil {
 		return fmt.Errorf("%w: %s", errors.ErrImageInspectFailed, err)
 	}
 
-	manifest, err := img.Manifest()
+	manifest, err := imageRef.ImageInfo.Manifest()
 	if err != nil {
 		return fmt.Errorf("%w: %s", errors.ErrImageInspectFailed, err)
 	}
 
-	digest, err := img.Digest()
+	digest, err := imageRef.ImageInfo.Digest()
 	if err != nil {
 		return fmt.Errorf("%w: %s", errors.ErrImageInspectFailed, err)
 	}
 
-	rawConfig, err := img.RawConfigFile()
+	rawConfig, err := imageRef.ImageInfo.RawConfigFile()
 	if err != nil {
 		return fmt.Errorf("%w: %s", errors.ErrImageInspectFailed, err)
 	}
 
-	size, err := img.Size()
+	size, err := imageRef.ImageInfo.Size()
 	if err != nil {
 		return fmt.Errorf("%w: %s", errors.ErrImageInspectFailed, err)
 	}
@@ -326,7 +325,7 @@ func writeCertImage(img v1.Image) error {
 	labels := convertLabels(config.Config.Labels)
 	layerSizes := make([]pyxis.Layer, 0, len(config.RootFS.DiffIDs))
 	for _, diffid := range config.RootFS.DiffIDs {
-		layer, err := img.LayerByDiffID(diffid)
+		layer, err := imageRef.ImageInfo.LayerByDiffID(diffid)
 		if err != nil {
 			return err
 		}
@@ -352,6 +351,28 @@ func writeCertImage(img v1.Image) error {
 		return fmt.Errorf("%w: %s", errors.ErrImageInspectFailed, err)
 	}
 
+	addedDate := time.Now().UTC().Format(time.RFC3339)
+
+	log.Debug("getting tag info for image")
+	tag, err := name.NewTag(imageRef.ImageURI)
+	if err != nil {
+		return fmt.Errorf("%w: %s", errors.ErrParseTagInfoFailed, err)
+	}
+
+	tags := make([]pyxis.Tag, 0, 1)
+	tags = append(tags, pyxis.Tag{
+		AddedDate: addedDate,
+		Name:      tag.TagStr(),
+	})
+
+	repositories := make([]pyxis.Repository, 0, 1)
+	repositories = append(repositories, pyxis.Repository{
+		PushDate:   addedDate,
+		Registry:   tag.Context().RegistryStr(),
+		Repository: tag.Context().RepositoryStr(),
+		Tags:       tags,
+	})
+
 	certImage := pyxis.CertImage{
 		DockerImageDigest: digest.String(),
 		DockerImageID:     manifest.Config.Digest.String(),
@@ -369,6 +390,7 @@ func writeCertImage(img v1.Image) error {
 			UncompressedLayerSizes: layerSizes,
 		},
 		RawConfig:         string(rawConfig),
+		Repositories:      repositories,
 		SumLayerSizeBytes: sumLayersSizeBytes,
 		// This is an assumption that the DiffIDs are in order from base up.
 		// Need more evisdence that this is always the case.
diff --git a/certification/pyxis/submit.go b/certification/pyxis/submit.go
index b78352c..a41be9b 100644
--- a/certification/pyxis/submit.go
+++ b/certification/pyxis/submit.go
@@ -2,21 +2,25 @@ package pyxis
 
 import (
 	"context"
+	"fmt"
 
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/errors"
 	log "github.com/sirupsen/logrus"
 )
 
-func (p *pyxisEngine) SubmitResults(certProject *CertProject, certImage *CertImage, rpmManifest *RPMManifest, testResults *TestResults) (*CertProject, *CertImage, *TestResults, error) {
+func (p *pyxisEngine) SubmitResults(ctx context.Context, certProject *CertProject, certImage *CertImage, rpmManifest *RPMManifest, testResults *TestResults) (*CertProject, *CertImage, *TestResults, error) {
 	var err error
-	ctx := context.Background()
-	oldProject := *certProject
 
 	if certProject.CertificationStatus == "Started" {
 		certProject.CertificationStatus = "In Progress"
 	}
 
-	if *certProject != oldProject {
+	oldCertProject, err := p.GetProject(ctx)
+	if err != nil {
+		return nil, nil, nil, fmt.Errorf("%w: %s", err, "could not retrieve project")
+	}
+
+	if *certProject != *oldCertProject {
 		certProject, err = p.updateProject(ctx, certProject)
 		if err != nil {
 			log.Error(err, "could not update project")
diff --git a/certification/pyxis/types.go b/certification/pyxis/types.go
index 86a633b..4f0ec8d 100644
--- a/certification/pyxis/types.go
+++ b/certification/pyxis/types.go
@@ -4,7 +4,7 @@ import "github.com/redhat-openshift-ecosystem/openshift-preflight/certification/
 
 type CertImage struct {
 	ID                     string       `json:"_id,omitempty"`
-	Certified              bool         `json:"certified" default:"false"`
+	Certified              bool         `json:"certified"`
 	Deleted                bool         `json:"deleted" default:"false"`
 	DockerImageDigest      string       `json:"docker_image_digest,omitempty"`
 	DockerImageID          string       `json:"docker_image_id,omitempty"`
@@ -81,8 +81,8 @@ type CertProject struct {
 
 type Container struct {
 	DockerConfigJSON string `json:"docker_config_json"`
-	Type             string `json:"type " default:"Containers"` // conditionally required
-	ISVPID           string `json:"isv_pid,omitempty"`          // required
+	Type             string `json:"type" default:"Containers"` // conditionally required
+	ISVPID           string `json:"isv_pid,omitempty"`         // required
 }
 
 type Layer struct {
diff --git a/cmd/check.go b/cmd/check.go
index c258b4f..a7b812c 100644
--- a/cmd/check.go
+++ b/cmd/check.go
@@ -16,6 +16,8 @@ var checkCmd = &cobra.Command{
 }
 
 func init() {
+	cobra.OnInitialize(initConfig)
+
 	checkCmd.PersistentFlags().BoolP("list-checks", "l", false, "lists all the checks run for a given check")
 
 	rootCmd.AddCommand(checkCmd)
diff --git a/cmd/check_container.go b/cmd/check_container.go
index 93cb656..777176b 100644
--- a/cmd/check_container.go
+++ b/cmd/check_container.go
@@ -44,7 +44,7 @@ var checkContainerCmd = &cobra.Command{
 			return fmt.Errorf("%w: A container image positional argument is required", errors.ErrInsufficientPosArguments)
 		}
 
-		if submit {
+		if submit && !viper.IsSet("dockerConfig") {
 			cmd.MarkFlagRequired("docker-config")
 		}
 
@@ -59,6 +59,8 @@ var checkContainerCmd = &cobra.Command{
 
 		log.Info("certification library version ", version.Version.String())
 
+		ctx := context.Background()
+
 		containerImage := args[0]
 
 		cfg := runtime.Config{
@@ -75,7 +77,6 @@ var checkContainerCmd = &cobra.Command{
 			projectId = strings.Split(projectId, "-")[1]
 		}
 		apiToken := viper.GetString("pyxis_api_token")
-		ctx := context.Background()
 		pyxisEngine := pyxis.NewPyxisEngine(apiToken, projectId, &http.Client{Timeout: 60 * time.Second})
 		certProject, err := pyxisEngine.GetProject(ctx)
 		if err != nil {
@@ -88,6 +89,21 @@ var checkContainerCmd = &cobra.Command{
 			cfg.Scratch = true
 		}
 
+		if submit {
+			dockerConfigJsonFile, err := os.Open(viper.GetString("dockerConfig"))
+			if err != nil {
+				return err
+			}
+			defer dockerConfigJsonFile.Close()
+
+			dockerConfigJsonBytes, err := io.ReadAll(dockerConfigJsonFile)
+			if err != nil {
+				return err
+			}
+
+			certProject.Container.DockerConfigJSON = string(dockerConfigJsonBytes)
+		}
+
 		engine, err := engine.NewForConfig(cfg)
 		if err != nil {
 			return err
@@ -140,61 +156,63 @@ var checkContainerCmd = &cobra.Command{
 		// submitting results to pxysis if submit flag is set
 		if submit {
 			log.Info("preparing results that will be submitted to Red Hat")
+			log.Tracef("CertProject: %+v", certProject)
 
-			certImageJsonFile, err := os.Open(path.Join(artifacts.Path(), certification.DefaultCertImageFilename))
+			testResultsJsonFile, err := os.Open(path.Join(artifacts.Path(), certification.DefaultTestResultsFilename))
 			if err != nil {
 				return err
 			}
-			defer certImageJsonFile.Close()
+			defer testResultsJsonFile.Close()
 
-			certImageBytes, err := io.ReadAll(certImageJsonFile)
+			testResultsBytes, err := io.ReadAll(testResultsJsonFile)
 			if err != nil {
 				return err
 			}
 
-			certImage := new(pyxis.CertImage)
-			err = json.Unmarshal(certImageBytes, &certImage)
+			testResults := new(pyxis.TestResults)
+			err = json.Unmarshal(testResultsBytes, &testResults)
 			if err != nil {
 				return err
 			}
 
-			certImage.ISVPID = certProject.Container.ISVPID
-
-			rpmManifestJsonFile, err := os.Open(path.Join(artifacts.Path(), certification.DefaultRPMManifestFilename))
+			certImageJsonFile, err := os.Open(path.Join(artifacts.Path(), certification.DefaultCertImageFilename))
 			if err != nil {
 				return err
 			}
-			defer rpmManifestJsonFile.Close()
+			defer certImageJsonFile.Close()
 
-			rpmManifestBytes, err := io.ReadAll(rpmManifestJsonFile)
+			certImageBytes, err := io.ReadAll(certImageJsonFile)
 			if err != nil {
 				return err
 			}
 
-			rpmManifest := new(pyxis.RPMManifest)
-			err = json.Unmarshal(rpmManifestBytes, rpmManifest)
+			certImage := new(pyxis.CertImage)
+			err = json.Unmarshal(certImageBytes, &certImage)
 			if err != nil {
 				return err
 			}
 
-			testResultsJsonFile, err := os.Open(path.Join(artifacts.Path(), certification.DefaultTestResultsFilename))
+			certImage.ISVPID = certProject.Container.ISVPID
+			certImage.Certified = testResults.Passed
+
+			rpmManifestJsonFile, err := os.Open(path.Join(artifacts.Path(), certification.DefaultRPMManifestFilename))
 			if err != nil {
 				return err
 			}
-			defer testResultsJsonFile.Close()
+			defer rpmManifestJsonFile.Close()
 
-			testResultsBytes, err := io.ReadAll(testResultsJsonFile)
+			rpmManifestBytes, err := io.ReadAll(rpmManifestJsonFile)
 			if err != nil {
 				return err
 			}
 
-			testResults := new(pyxis.TestResults)
-			err = json.Unmarshal(testResultsBytes, &testResults)
+			rpmManifest := new(pyxis.RPMManifest)
+			err = json.Unmarshal(rpmManifestBytes, rpmManifest)
 			if err != nil {
 				return err
 			}
 
-			_, certImage, _, err = pyxisEngine.SubmitResults(certProject, certImage, rpmManifest, testResults)
+			_, certImage, _, err = pyxisEngine.SubmitResults(ctx, certProject, certImage, rpmManifest, testResults)
 			if err != nil {
 				return err
 			}
@@ -214,7 +232,7 @@ func init() {
 	viper.BindPFlag("submit", checkContainerCmd.Flags().Lookup("submit"))
 
 	checkContainerCmd.Flags().StringP("docker-config", "d", "", "path to docker config.json file")
-	viper.BindPFlag("docker_config", checkContainerCmd.Flags().Lookup("docker-config"))
+	viper.BindPFlag("dockerConfig", checkContainerCmd.Flags().Lookup("docker-config"))
 
 	checkContainerCmd.Flags().String("pyxis-api-token", "", "API token for Pyxis authentication")
 	checkContainerCmd.MarkFlagRequired("pyxis-api-token")
diff --git a/cmd/utils.go b/cmd/utils.go
index 8bd9ccd..e0440c8 100644
--- a/cmd/utils.go
+++ b/cmd/utils.go
@@ -10,12 +10,13 @@ import (
 	"github.com/spf13/viper"
 )
 
+var configFileUsed bool
+
 func resultsFilenameWithExtension(ext string) string {
 	return strings.Join([]string{"results", ext}, ".")
 }
 
-// preRunConfig is used by cobra.PreRun in all non-root commands to load all necessary configurations
-func preRunConfig(cmd *cobra.Command, args []string) {
+func initConfig() {
 	// set up ENV var support
 	viper.SetEnvPrefix("pflt")
 	viper.AutomaticEnv()
@@ -25,7 +26,7 @@ func preRunConfig(cmd *cobra.Command, args []string) {
 	viper.SetConfigType("yaml")
 	viper.AddConfigPath(".")
 
-	configFileUsed := true
+	configFileUsed = true
 	if err := viper.ReadInConfig(); err != nil {
 		if _, ok := err.(viper.ConfigFileNotFoundError); ok {
 			configFileUsed = false
@@ -47,7 +48,10 @@ func preRunConfig(cmd *cobra.Command, args []string) {
 	// Set up pyxis host
 	viper.SetDefault("pyxis_host", DefaultPyxisHost)
 	viper.SetDefault("pyxis_api_token", "")
+}
 
+// preRunConfig is used by cobra.PreRun in all non-root commands to load all necessary configurations
+func preRunConfig(cmd *cobra.Command, args []string) {
 	// set up logging
 	logname := viper.GetString("logfile")
 	logFile, err := os.OpenFile(logname, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o600)
diff --git a/docs/CONFIG.md b/docs/CONFIG.md
index 64b61c0..cbd5bb4 100644
--- a/docs/CONFIG.md
+++ b/docs/CONFIG.md
@@ -39,3 +39,4 @@ is called.
 |--|--|--|--|--|
 |`PFLT_PYXIS_HOST`|env|The Pyxis host to connect to. Must contain any additional path information leading up to the API version|optional|catalog.redhat.com/api/containers|
 |`PFLT_PYXIS_API_TOKEN`|env|The API Token to be used when connecting to Pyxis. Used for authenticated calls only.|optional?|-|
+|`PFLT_DOCKERCONFIG`|env|The full path to a dockerconfigjson file, that has access to the container under test.|required|-|


Test patch:
diff --git a/certification/pyxis/submit_test.go b/certification/pyxis/submit_test.go
index dc3496b..e92a9b5 100644
--- a/certification/pyxis/submit_test.go
+++ b/certification/pyxis/submit_test.go
@@ -3,11 +3,14 @@ package pyxis
 import (
 	"context"
 	"errors"
+	"fmt"
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
 )
 
+var ctx = context.Background()
+
 var _ = Describe("Pyxis Submit", func() {
 	var pyxisEngine *pyxisEngine
 
@@ -17,7 +20,7 @@ var _ = Describe("Pyxis Submit", func() {
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).ToNot(HaveOccurred())
 				Expect(certProject).ToNot(BeNil())
 				Expect(certImage).ToNot(BeNil())
@@ -36,8 +39,8 @@ var _ = Describe("Pyxis Submit updateProject 401 Unauthorized", func() {
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
-				Expect(err).To(MatchError(errors.New("error calling remote API")))
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				Expect(err).To(MatchError(fmt.Errorf("%w: %s", errors.New("error calling remote API"), "could not retrieve project")))
 				Expect(certProject).To(BeNil())
 				Expect(certImage).To(BeNil())
 				Expect(testResults).To(BeNil())
@@ -55,7 +58,7 @@ var _ = Describe("Pyxis Submit with createImage 409 Conflict", func() {
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).ToNot(HaveOccurred())
 				Expect(certProject).ToNot(BeNil())
 				Expect(certImage).ToNot(BeNil())
@@ -74,7 +77,7 @@ var _ = Describe("Pyxis Submit with createImage 401 Unauthorized", func() {
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).To(MatchError(errors.New("error calling remote API")))
 				Expect(certProject).To(BeNil())
 				Expect(certImage).To(BeNil())
@@ -93,7 +96,7 @@ var _ = Describe("Pyxis Submit with createImage 409 Conflict and getImage 401 Un
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).To(MatchError(errors.New("error calling remote API")))
 				Expect(certProject).To(BeNil())
 				Expect(certImage).To(BeNil())
@@ -112,7 +115,7 @@ var _ = Describe("Pyxis Submit with createRPMManifest 409 Conflict", func() {
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).ToNot(HaveOccurred())
 				Expect(certProject).ToNot(BeNil())
 				Expect(certImage).ToNot(BeNil())
@@ -131,7 +134,7 @@ var _ = Describe("Pyxis Submit with createRPMManifest 401 Unauthorized", func()
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).To(MatchError(errors.New("error calling remote API")))
 				Expect(certProject).To(BeNil())
 				Expect(certImage).To(BeNil())
@@ -150,7 +153,7 @@ var _ = Describe("Pyxis Submit with createRPMManifest 409 Conflict and getRPMMan
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).To(MatchError(errors.New("error calling remote API")))
 				Expect(certProject).To(BeNil())
 				Expect(certImage).To(BeNil())
@@ -169,7 +172,7 @@ var _ = Describe("Pyxis Submit with createTestResults 401 Unauthorized", func()
 	Context("when a project is submitted", func() {
 		Context("and it is not already In Progress", func() {
 			It("should switch to In Progress", func() {
-				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(&CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
+				certProject, certImage, testResults, err := pyxisEngine.SubmitResults(ctx, &CertProject{CertificationStatus: "Started"}, &CertImage{}, &RPMManifest{}, &TestResults{})
 				Expect(err).To(MatchError(errors.New("error calling remote API")))
 				Expect(certProject).To(BeNil())
 				Expect(certImage).To(BeNil())