Repository: code-ready/crc
Pull request #1629 (2020-11-02 21:43:20)

Use oc executable embedded in the bundle
oc executable is now in the bundle. This removes the hard link between
an openshift/snc release and a crc release. A crc release can use any
bundle compatible: for instance an okd bundle.

---

oc is not available after crc setup now. The bundle needs to be extracted first (with crc start).
still need to double check on Windows

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

This pull-request has been approved by: *<a href="https://github.com/code-ready/crc/pull/1629#" title="Author self-approved">guillaumerose</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=code-ready%2Fcrc).

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/code-ready/crc/blob/master/OWNERS)~~ [guillaumerose]

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-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | f38640dc4ad8d0f1041dd40a4acece3e630954c3 | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1323384840547995648) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | 78f8e8fd4a8f8e99b7dfe04920b5efd5a98c35d1 | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1323516119083913216) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | 7345712ac29de210dd28f3272765b64c56e12aa3 | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1323562903634186240) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
openshift-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/code-ready/crc/pull/1629#pullrequestreview-522405701" title="Approved">cfergeau</a>*, *<a href="https://github.com/code-ready/crc/pull/1629#" title="Author self-approved">guillaumerose</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=code-ready%2Fcrc).

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/code-ready/crc/blob/master/OWNERS)~~ [cfergeau,guillaumerose]

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-robot: New changes are detected. LGTM label has been removed.
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | 0486bd860af708a8ae3e95db714032f440e6224d | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1323613148749500416) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
guillaumerose: /retest
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | 0486bd860af708a8ae3e95db714032f440e6224d | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1323653536700960768) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | 10f4725e770bd3a3670df9c1f94a9d4b9ad27efb | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1323903000137175040) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | 136426b773cdfbf52a7a0bc35be2c7c42068014d | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1324077838323683328) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
openshift-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/code-ready/crc/pull/1629#pullrequestreview-524434435" title="Approved">cfergeau</a>*, *<a href="https://github.com/code-ready/crc/pull/1629#" title="Author self-approved">guillaumerose</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=code-ready%2Fcrc).

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/code-ready/crc/blob/master/OWNERS)~~ [cfergeau,guillaumerose]

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-robot: New changes are detected. LGTM label has been removed.
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | d60980e68ca87c389859d5b545380e25bfaf35d8 | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1324626217671856128) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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 -->
guillaumerose: /retest
retest this please
openshift-merge-robot: @guillaumerose: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e-crc | d60980e68ca87c389859d5b545380e25bfaf35d8 | [link](https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/code-ready_crc/1629/pull-ci-code-ready-crc-master-e2e-crc/1324652380838432768) | `/test e2e-crc`

[Full PR test history](https://prow.ci.openshift.org/pr-history?org=code-ready&repo=crc&pr=1629). [Your PR dashboard](https://prow.ci.openshift.org/pr?query=is:pr+state:open+author:guillaumerose).

<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/Makefile b/Makefile
index 9d074974f..3f3fd5c76 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,6 @@
 SHELL := /bin/bash
 
 BUNDLE_VERSION = 4.6.1
-# OC_VERSION and BUNDLE_VERSION are going to same for release artifacts but
-# different for nightly and CI bits where bundle version would be any random
-# string or dd-mm-yyyy format.
-OC_VERSION ?= ${BUNDLE_VERSION}
 BUNDLE_EXTENSION = crcbundle
 CRC_VERSION = 1.18.0
 COMMIT_SHA=$(shell git rev-parse --short HEAD)
@@ -49,7 +45,6 @@ __check_defined = \
 # Linker flags
 VERSION_VARIABLES := -X $(REPOPATH)/pkg/crc/version.crcVersion=$(CRC_VERSION) \
     -X $(REPOPATH)/pkg/crc/version.bundleVersion=$(BUNDLE_VERSION) \
-    -X $(REPOPATH)/pkg/crc/version.ocVersion=$(OC_VERSION) \
 	-X $(REPOPATH)/pkg/crc/version.commitSha=$(COMMIT_SHA)
 
 # https://golang.org/cmd/link/
diff --git a/cmd/crc-embedder/cmd/embed.go b/cmd/crc-embedder/cmd/embed.go
index 094bf0baa..8175c1f68 100644
--- a/cmd/crc-embedder/cmd/embed.go
+++ b/cmd/crc-embedder/cmd/embed.go
@@ -89,17 +89,14 @@ var (
 		"darwin": {
 			hyperkit.MachineDriverDownloadURL,
 			hyperkit.HyperKitDownloadURL,
-			constants.GetOcURLForOs("darwin"),
 			constants.GetCRCMacTrayDownloadURL(),
 			constants.GetGoodhostsURLForOs("darwin"),
 		},
 		"linux": {
 			libvirt.MachineDriverDownloadURL,
-			constants.GetOcURLForOs("linux"),
 			constants.GetGoodhostsURLForOs("linux"),
 		},
 		"windows": {
-			constants.GetOcURLForOs("windows"),
 			constants.GetGoodhostsURLForOs("windows"),
 			constants.GetCRCWindowsTrayDownloadURL(),
 		},
diff --git a/cmd/crc/cmd/root.go b/cmd/crc/cmd/root.go
index cd654c437..00cc2a860 100644
--- a/cmd/crc/cmd/root.go
+++ b/cmd/crc/cmd/root.go
@@ -40,7 +40,7 @@ var (
 )
 
 func init() {
-	if err := constants.EnsureBaseDirExists(); err != nil {
+	if err := constants.EnsureBaseDirectoriesExist(); err != nil {
 		logging.Fatal(err.Error())
 	}
 	var err error
diff --git a/pkg/crc/cache/cache.go b/pkg/crc/cache/cache.go
index 59ac91597..8856b8dc1 100644
--- a/pkg/crc/cache/cache.go
+++ b/pkg/crc/cache/cache.go
@@ -9,7 +9,6 @@ import (
 
 	"github.com/code-ready/crc/pkg/crc/constants"
 	"github.com/code-ready/crc/pkg/crc/logging"
-	"github.com/code-ready/crc/pkg/crc/version"
 	"github.com/code-ready/crc/pkg/download"
 	"github.com/code-ready/crc/pkg/embed"
 	"github.com/code-ready/crc/pkg/extract"
@@ -39,10 +38,6 @@ func New(executableName string, archiveURL string, destDir string, version strin
 	return &Cache{executableName: executableName, archiveURL: archiveURL, destDir: destDir, version: version, getVersion: getVersion}
 }
 
-func getCurrentOcVersion(executablePath string) (string, error) {
-	return getVersionGeneric(executablePath, "version", "--client")
-}
-
 func (c *Cache) GetExecutablePath() string {
 	return filepath.Join(c.destDir, c.executableName)
 }
@@ -57,7 +52,7 @@ func (c *Cache) GetExecutableName() string {
  *
  * It returns <version> as a string
  */
-func getVersionGeneric(executablePath string, args ...string) (string, error) {
+func getVersionGeneric(executablePath string, args ...string) (string, error) { //nolint:deadcode,unused
 	stdOut, _, err := crcos.RunWithDefaultLocale(executablePath, args...)
 	parsedOutput := strings.Split(stdOut, ":")
 	if len(parsedOutput) < 2 {
@@ -66,10 +61,6 @@ func getVersionGeneric(executablePath string, args ...string) (string, error) {
 	return strings.TrimSpace(parsedOutput[1]), err
 }
 
-func NewOcCache() *Cache {
-	return New(constants.OcExecutableName, constants.GetOcURL(), constants.CrcOcBinDir, version.GetOcVersion(), getCurrentOcVersion)
-}
-
 func NewPodmanCache() *Cache {
 	return New(constants.PodmanExecutableName, constants.GetPodmanURL(), constants.CrcBinDir, "", nil)
 }
diff --git a/pkg/crc/constants/constants.go b/pkg/crc/constants/constants.go
index 868b3d94e..40ce90f59 100644
--- a/pkg/crc/constants/constants.go
+++ b/pkg/crc/constants/constants.go
@@ -37,20 +37,6 @@ const (
 	DefaultContext            = "admin"
 )
 
-var ocURLForOs = map[string]string{
-	"darwin":  fmt.Sprintf("%s/%s/%s", DefaultOcURLBase, version.GetOcVersion(), "openshift-client-mac.tar.gz"),
-	"linux":   fmt.Sprintf("%s/%s/%s", DefaultOcURLBase, version.GetOcVersion(), "openshift-client-linux.tar.gz"),
-	"windows": fmt.Sprintf("%s/%s/%s", DefaultOcURLBase, version.GetOcVersion(), "openshift-client-windows.zip"),
-}
-
-func GetOcURLForOs(os string) string {
-	return ocURLForOs[os]
-}
-
-func GetOcURL() string {
-	return GetOcURLForOs(runtime.GOOS)
-}
-
 var podmanURLForOs = map[string]string{
 	"darwin":  fmt.Sprintf("%s/%s", DefaultPodmanURLBase, "podman-remote-latest-master-darwin-amd64.zip"),
 	"linux":   fmt.Sprintf("%s/%s", DefaultPodmanURLBase, "podman-remote-latest-master-linux---amd64.zip"),
@@ -126,11 +112,15 @@ func GetHomeDir() string {
 	return os.Getenv("HOME")
 }
 
-// EnsureBaseDirExists create the ~/.crc dir if its not there
-func EnsureBaseDirExists() error {
-	_, err := os.Stat(CrcBaseDir)
-	if err != nil {
-		return os.Mkdir(CrcBaseDir, 0750)
+// EnsureBaseDirectoriesExist create the ~/.crc and ~/.crc/oc dirs if they are not present
+func EnsureBaseDirectoriesExist() error {
+	if _, err := os.Stat(CrcBaseDir); err != nil {
+		if !os.IsNotExist(err) {
+			return err
+		}
+		if err := os.Mkdir(CrcBaseDir, 0750); err != nil {
+			return err
+		}
 	}
 	return nil
 }
diff --git a/pkg/crc/logging/logging.go b/pkg/crc/logging/logging.go
index c59a162d0..5110d2c82 100644
--- a/pkg/crc/logging/logging.go
+++ b/pkg/crc/logging/logging.go
@@ -15,7 +15,7 @@ var (
 )
 
 func OpenLogFile(path string) (*os.File, error) {
-	err := constants.EnsureBaseDirExists()
+	err := constants.EnsureBaseDirectoriesExist()
 	if err != nil {
 		return nil, err
 	}
diff --git a/pkg/crc/machine/bundle/metadata.go b/pkg/crc/machine/bundle/metadata.go
index 4e9f9918d..9bb1ea8c1 100644
--- a/pkg/crc/machine/bundle/metadata.go
+++ b/pkg/crc/machine/bundle/metadata.go
@@ -6,12 +6,14 @@ import (
 	"io/ioutil"
 	"os"
 	"path/filepath"
+	"runtime"
 	"strconv"
 	"strings"
 	"time"
 
 	"github.com/code-ready/crc/pkg/crc/constants"
 	"github.com/code-ready/crc/pkg/extract"
+	crcos "github.com/code-ready/crc/pkg/os"
 )
 
 // Metadata structure to unmarshal the crc-bundle-info.json file
@@ -87,9 +89,30 @@ func GetCachedBundleInfo(bundleName string) (*CrcBundleInfo, error) {
 	if err != nil {
 		return nil, err
 	}
+	if err := bundleInfo.installSymlinkOrCopy(); err != nil {
+		return nil, err
+	}
 	return &bundleInfo, nil
 }
 
+func (bundle *CrcBundleInfo) installSymlinkOrCopy() error {
+	ocInBundle := filepath.Join(bundle.cachedPath, constants.OcExecutableName)
+	ocInBinDir := filepath.Join(constants.CrcOcBinDir, constants.OcExecutableName)
+	if _, err := os.Stat(constants.CrcOcBinDir); err != nil {
+		if !os.IsNotExist(err) {
+			return err
+		}
+		if err := os.MkdirAll(constants.CrcOcBinDir, 0750); err != nil {
+			return err
+		}
+	}
+	_ = os.Remove(ocInBinDir)
+	if runtime.GOOS == "windows" {
+		return crcos.CopyFileContents(ocInBundle, ocInBinDir, 0750)
+	}
+	return os.Symlink(ocInBundle, ocInBinDir)
+}
+
 func (bundle *CrcBundleInfo) resolvePath(filename string) string {
 	return filepath.Join(bundle.cachedPath, filename)
 }
diff --git a/pkg/crc/machine/machine.go b/pkg/crc/machine/machine.go
index 62ab29b76..fa506b06e 100644
--- a/pkg/crc/machine/machine.go
+++ b/pkg/crc/machine/machine.go
@@ -69,6 +69,7 @@ func getCrcBundleInfo(bundlePath string) (*bundle.CrcBundleInfo, error) {
 		logging.Infof("Loading bundle: %s ...", bundleName)
 		return bundleInfo, nil
 	}
+	logging.Debugf("Failed to load bundle %s: %v", bundleName, err)
 	logging.Infof("Extracting bundle: %s ...", bundleName)
 	return bundle.Extract(bundlePath)
 }
diff --git a/pkg/crc/preflight/preflight_checks_common.go b/pkg/crc/preflight/preflight_checks_common.go
index 14fe2c659..a66cddcee 100644
--- a/pkg/crc/preflight/preflight_checks_common.go
+++ b/pkg/crc/preflight/preflight_checks_common.go
@@ -15,13 +15,6 @@ import (
 )
 
 var genericPreflightChecks = [...]Check{
-	{
-		configKeySuffix:  "check-oc-cached",
-		checkDescription: "Checking if oc executable is cached",
-		check:            checkOcExecutableCached,
-		fixDescription:   "Caching oc executable",
-		fix:              fixOcExecutableCached,
-	},
 	{
 		configKeySuffix:  "check-podman-cached",
 		checkDescription: "Checking if podman remote executable is cached",
@@ -84,32 +77,6 @@ func fixBundleCached() error {
 	return fmt.Errorf("CRC bundle is not embedded in the executable")
 }
 
-// Check if oc executable is cached or not
-func checkOcExecutableCached() error {
-	// Remove oc executable from older location and ignore the error
-	// We should remove this code after 3-4 releases. (after 2020-07-10)
-	os.Remove(filepath.Join(constants.CrcBinDir, "oc"))
-
-	oc := cache.NewOcCache()
-	if !oc.IsCached() {
-		return errors.New("oc executable is not cached")
-	}
-	if err := oc.CheckVersion(); err != nil {
-		return err
-	}
-	logging.Debug("oc executable already cached")
-	return nil
-}
-
-func fixOcExecutableCached() error {
-	oc := cache.NewOcCache()
-	if err := oc.EnsureIsCached(); err != nil {
-		return fmt.Errorf("Unable to download oc %v", err)
-	}
-	logging.Debug("oc executable cached")
-	return nil
-}
-
 // Check if podman executable is cached or not
 func checkPodmanExecutableCached() error {
 	// Disable the podman cache until further notice
diff --git a/pkg/crc/version/version.go b/pkg/crc/version/version.go
index 60343179c..1cd3c05fd 100644
--- a/pkg/crc/version/version.go
+++ b/pkg/crc/version/version.go
@@ -20,9 +20,6 @@ var (
 
 	// Bundle version which used for the release.
 	bundleVersion = "0.0.0-unset"
-
-	// OC version which should be used.
-	ocVersion = "0.0.0-unset"
 )
 
 const (
@@ -51,10 +48,6 @@ func GetBundleVersion() string {
 	return bundleVersion
 }
 
-func GetOcVersion() string {
-	return ocVersion
-}
-
 func GetCRCMacTrayVersion() string {
 	return crcMacTrayVersion
 }


Test patch:
diff --git a/pkg/crc/preflight/preflight_darwin_test.go b/pkg/crc/preflight/preflight_darwin_test.go
index 7e7044887..652ccdb1b 100644
--- a/pkg/crc/preflight/preflight_darwin_test.go
+++ b/pkg/crc/preflight/preflight_darwin_test.go
@@ -10,10 +10,10 @@ import (
 func TestCountConfigurationOptions(t *testing.T) {
 	cfg := config.New(config.NewEmptyInMemoryStorage())
 	RegisterSettings(cfg)
-	assert.Len(t, cfg.AllConfigs(), 20)
+	assert.Len(t, cfg.AllConfigs(), 18)
 }
 
 func TestCountPreflights(t *testing.T) {
-	assert.Len(t, getPreflightChecks(false), 10)
-	assert.Len(t, getPreflightChecks(true), 16)
+	assert.Len(t, getPreflightChecks(false), 9)
+	assert.Len(t, getPreflightChecks(true), 15)
 }
diff --git a/pkg/crc/preflight/preflight_linux_test.go b/pkg/crc/preflight/preflight_linux_test.go
index 7a649dba8..7fd0de658 100644
--- a/pkg/crc/preflight/preflight_linux_test.go
+++ b/pkg/crc/preflight/preflight_linux_test.go
@@ -12,16 +12,16 @@ func TestCountConfigurationOptions(t *testing.T) {
 	cfg := config.New(config.NewEmptyInMemoryStorage())
 	RegisterSettings(cfg)
 	options := len(cfg.AllConfigs())
-	assert.True(t, options == 40 || options == 32)
+	assert.True(t, options == 38 || options == 30)
 }
 
 func TestCountPreflights(t *testing.T) {
-	assert.Len(t, getPreflightChecksForDistro(crcos.RHEL, false), 21)
-	assert.Len(t, getPreflightChecksForDistro(crcos.RHEL, true), 21)
+	assert.Len(t, getPreflightChecksForDistro(crcos.RHEL, false), 20)
+	assert.Len(t, getPreflightChecksForDistro(crcos.RHEL, true), 20)
 
-	assert.Len(t, getPreflightChecksForDistro("unexpected", false), 21)
-	assert.Len(t, getPreflightChecksForDistro("unexpected", true), 21)
+	assert.Len(t, getPreflightChecksForDistro("unexpected", false), 20)
+	assert.Len(t, getPreflightChecksForDistro("unexpected", true), 20)
 
-	assert.Len(t, getPreflightChecksForDistro(crcos.Ubuntu, false), 17)
-	assert.Len(t, getPreflightChecksForDistro(crcos.Ubuntu, true), 17)
+	assert.Len(t, getPreflightChecksForDistro(crcos.Ubuntu, false), 16)
+	assert.Len(t, getPreflightChecksForDistro(crcos.Ubuntu, true), 16)
 }
diff --git a/pkg/crc/preflight/preflight_windows_test.go b/pkg/crc/preflight/preflight_windows_test.go
index 18c65d041..80998b26b 100644
--- a/pkg/crc/preflight/preflight_windows_test.go
+++ b/pkg/crc/preflight/preflight_windows_test.go
@@ -10,10 +10,10 @@ import (
 func TestCountConfigurationOptions(t *testing.T) {
 	cfg := config.New(config.NewEmptyInMemoryStorage())
 	RegisterSettings(cfg)
-	assert.Len(t, cfg.AllConfigs(), 24)
+	assert.Len(t, cfg.AllConfigs(), 22)
 }
 
 func TestCountPreflights(t *testing.T) {
-	assert.Len(t, getPreflightChecks(false), 14)
-	assert.Len(t, getPreflightChecks(true), 16)
+	assert.Len(t, getPreflightChecks(false), 13)
+	assert.Len(t, getPreflightChecks(true), 15)
 }
diff --git a/test/integration/features/basic.feature b/test/integration/features/basic.feature
index 451ba7803..07185795d 100644
--- a/test/integration/features/basic.feature
+++ b/test/integration/features/basic.feature
@@ -37,7 +37,6 @@ Feature: Basic test
     @linux
     Scenario: CRC setup on Linux
         When executing "crc setup" succeeds
-        Then stderr should contain "Caching oc executable"
         And stderr should contain "Checking if CRC bundle is cached in '$HOME/.crc'"
         And stderr should contain "Checking if running as non-root"
         And stderr should contain "Checking if Virtualization is enabled"
@@ -67,7 +66,6 @@ Feature: Basic test
     @darwin
     Scenario: CRC setup on Mac
         When executing "crc setup" succeeds
-        Then stderr should contain "Caching oc executable"
         And stderr should contain "Checking if running as non-root"
         And stderr should contain "Checking if HyperKit is installed"
         And stderr should contain "Checking if crc-driver-hyperkit is installed"
@@ -79,7 +77,6 @@ Feature: Basic test
     @windows
     Scenario: CRC setup on Windows
         When executing "crc setup" succeeds
-        Then stderr should contain "Caching oc executable"
         Then stderr should contain "Unpacking bundle from the CRC executable" if bundle is embedded
         Then stderr should contain "Checking Windows 10 release"
         Then stderr should contain "Checking if Hyper-V is installed"