Skip to content

Commit

Permalink
Use digest instead of tags in scorecard images (#6393)
Browse files Browse the repository at this point in the history
* Use digest instead of tags in scorecard images

The use of tags breaks disconnected environments when using mirrored
images.

Signed-off-by: Tony Garcia <[email protected]>

* Update internal/cmd/operator-sdk/scorecard/cmd.go

Co-authored-by: Tatiana Krishtop <[email protected]>
Signed-off-by: Tony Garcia <[email protected]>

* Fix typo in image

Signed-off-by: Tony Garcia <[email protected]>

---------

Signed-off-by: Tony Garcia <[email protected]>
Co-authored-by: Tatiana Krishtop <[email protected]>
  • Loading branch information
tonyskapunk and tkrishtop authored Apr 13, 2023
1 parent 3af4acb commit 82b28e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions internal/cmd/operator-sdk/scorecard/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,15 @@ If the argument holds an image tag, it must be present remotely.`,
"Disable resource cleanup after tests are run")
scorecardCmd.Flags().DurationVarP(&c.waitTime, "wait-time", "w", 30*time.Second,
"seconds to wait for tests to complete. Example: 35s")
// Please note that for Operator-sdk + Preflight + DCI integration in disconnected environments,
// it is necessary to refer to storage-image and untar-image using their digests instead of tags.
// If you need to make changes to these images, please ensure that you always use the digests.
scorecardCmd.Flags().StringVarP(&c.storageImage, "storage-image", "b",
"quay.io/operator-framework/scorecard-storage:latest",
"quay.io/operator-framework/scorecard-storage@sha256:f7bd62664a0b91034acb977a8bb4ebb76bc98a6e8bdb943eb84c8e364828f056",
"Storage image to be used by the Scorecard pod")
// Use the digest of the latest scorecard-untar image
scorecardCmd.Flags().StringVarP(&c.untarImage, "untar-image", "u",
"quay.io/operator-framework/scorecard-untar:latest",
"quay.io/operator-framework/scorecard-untar@sha256:56c88afd4f20718dcd4d4384b8ff0b790f95aa4737f89f3b105b5dfc1bdb60c3",
"Untar image to be used by the Scorecard pod")
scorecardCmd.Flags().StringVarP(&c.testOutput, "test-output", "t", "test-output",
"Test output directory.")
Expand Down
6 changes: 4 additions & 2 deletions internal/cmd/operator-sdk/scorecard/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ var _ = Describe("Running the scorecard command", func() {
flag = cmd.Flags().Lookup("storage-image")
Expect(flag).NotTo(BeNil())
Expect(flag.Shorthand).To(Equal("b"))
Expect(flag.DefValue).To(Equal("quay.io/operator-framework/scorecard-storage:latest"))
// Use the digest of the latest scorecard-storage image
Expect(flag.DefValue).To(Equal("quay.io/operator-framework/scorecard-storage@sha256:f7bd62664a0b91034acb977a8bb4ebb76bc98a6e8bdb943eb84c8e364828f056"))

flag = cmd.Flags().Lookup("untar-image")
Expect(flag).NotTo(BeNil())
Expect(flag.Shorthand).To(Equal("u"))
Expect(flag.DefValue).To(Equal("quay.io/operator-framework/scorecard-untar:latest"))
// Use the digest of the latest scorecard-untar image
Expect(flag.DefValue).To(Equal("quay.io/operator-framework/scorecard-untar@sha256:56c88afd4f20718dcd4d4384b8ff0b790f95aa4737f89f3b105b5dfc1bdb60c3"))
})
})

Expand Down
4 changes: 2 additions & 2 deletions website/content/en/docs/cli/operator-sdk_scorecard.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ operator-sdk scorecard [flags]
-l, --selector string label selector to determine which tests are run
-s, --service-account string Service account to use for tests (default "default")
-x, --skip-cleanup Disable resource cleanup after tests are run
-b, --storage-image string Storage image to be used by the Scorecard pod (default "quay.io/operator-framework/scorecard-storage:latest")
-b, --storage-image string Storage image to be used by the Scorecard pod (default "quay.io/operator-framework/scorecard-storage@sha256:f7bd62664a0b91034acb977a8bb4ebb76bc98a6e8bdb943eb84c8e364828f056")
-t, --test-output string Test output directory. (default "test-output")
-u, --untar-image string Untar image to be used by the Scorecard pod (default "quay.io/operator-framework/scorecard-untar:latest")
-u, --untar-image string Untar image to be used by the Scorecard pod (default "quay.io/operator-framework/scorecard-untar@sha256:56c88afd4f20718dcd4d4384b8ff0b790f95aa4737f89f3b105b5dfc1bdb60c3")
-w, --wait-time duration seconds to wait for tests to complete. Example: 35s (default 30s)
```

Expand Down

0 comments on commit 82b28e8

Please sign in to comment.