Repository: code-ready/crc
Pull request #1980 (2021-02-11 08:30:48)

Extract the bundle at the end of crc setup
This improves the UX by failing fast if something is wrong with the
machine or OS. For instance, it will not uncompress the bundle and then
fail because virtualization is not enabled.

We can then check if the bundle is in place to know if crc setup was run.

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

This pull-request has been approved by: *<a href="https://github.com/code-ready/crc/pull/1980#" 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":[]} -->

Patch:
diff --git a/README.adoc b/README.adoc
index 601ffa167..d764d73c9 100644
--- a/README.adoc
+++ b/README.adoc
@@ -22,7 +22,7 @@ If you are looking for a solution for running OpenShift 3.x, you will need tools
 
 === Getting CodeReady Containers
 
-CodeReady Containers binaries with an embedded OpenShift disk image can be downloaded from link:https://cloud.redhat.com/openshift/install/crc/installer-provisioned[this page].
+CodeReady Containers binaries with an embedded OpenShift disk image can be downloaded from link:https://cloud.redhat.com/openshift/create/local[this page].
 
 === Using CodeReady Containers
 
diff --git a/docs/source/meta/product-attributes.adoc b/docs/source/meta/product-attributes.adoc
index b5855f217..1c3167765 100644
--- a/docs/source/meta/product-attributes.adoc
+++ b/docs/source/meta/product-attributes.adoc
@@ -28,7 +28,7 @@
 :crc-gsg: {rh-prod} Getting Started Guide
 
 // URLs
-:crc-download-url: https://cloud.redhat.com/openshift/install/crc/installer-provisioned
+:crc-download-url: https://cloud.redhat.com/openshift/create/local
 :crc-gsg-url: https://code-ready.github.io/crc/
 
 :oc-download-url: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/
diff --git a/docs/source/topics/proc_starting-the-virtual-machine.adoc b/docs/source/topics/proc_starting-the-virtual-machine.adoc
index 4f05a9bf2..8a0bdb080 100644
--- a/docs/source/topics/proc_starting-the-virtual-machine.adoc
+++ b/docs/source/topics/proc_starting-the-virtual-machine.adoc
@@ -10,7 +10,7 @@ The [command]`{bin} start` command starts the {prod} virtual machine and OpenShi
 For more information, see link:{crc-gsg-url}#setting-up-codeready-containers_gsg[Setting up {prod}].
 * On {msw}, ensure that your user account can elevate to Administrator privileges.
 * You have a valid OpenShift user pull secret.
-Copy or download the pull secret from the Pull Secret section of the link:https://cloud.redhat.com/openshift/install/crc/installer-provisioned[Install on Laptop: {rh-prod}] page on cloud.redhat.com.
+Copy or download the pull secret from the Pull Secret section of the link:https://cloud.redhat.com/openshift/create/local[Install on Laptop: {rh-prod}] page on cloud.redhat.com.
 +
 [NOTE]
 ====
diff --git a/pkg/crc/constants/constants.go b/pkg/crc/constants/constants.go
index de82315ad..1f9a0b8bd 100644
--- a/pkg/crc/constants/constants.go
+++ b/pkg/crc/constants/constants.go
@@ -27,7 +27,7 @@ const (
 	ConfigFile                = "crc.json"
 	LogFile                   = "crc.log"
 	DaemonLogFile             = "crcd.log"
-	CrcLandingPageURL         = "https://cloud.redhat.com/openshift/install/crc/installer-provisioned" // #nosec G101
+	CrcLandingPageURL         = "https://cloud.redhat.com/openshift/create/local" // #nosec G101
 	DefaultPodmanURLBase      = "https://storage.googleapis.com/libpod-master-releases"
 	DefaultAdminHelperCliBase = "https://github.com/code-ready/admin-helper/releases/download/0.0.2"
 	CRCMacTrayDownloadURL     = "https://github.com/code-ready/tray-macos/releases/download/v%s/crc-tray-macos.tar.gz"
diff --git a/pkg/crc/preflight/preflight_checks_common.go b/pkg/crc/preflight/preflight_checks_common.go
index 0c0a56eb0..6d7663c85 100644
--- a/pkg/crc/preflight/preflight_checks_common.go
+++ b/pkg/crc/preflight/preflight_checks_common.go
@@ -17,6 +17,15 @@ import (
 	"github.com/pkg/errors"
 )
 
+var bundleCheck = Check{
+	configKeySuffix:  "check-bundle-extracted",
+	checkDescription: "Checking if CRC bundle is extracted in '$HOME/.crc'",
+	check:            checkBundleExtracted,
+	fixDescription:   "Extracting bundle from the CRC executable",
+	fix:              fixBundleExtracted,
+	flags:            SetupOnly,
+}
+
 var genericPreflightChecks = [...]Check{
 	{
 		configKeySuffix:  "check-podman-cached",
@@ -32,14 +41,6 @@ var genericPreflightChecks = [...]Check{
 		fixDescription:   "Caching admin-helper executable",
 		fix:              fixAdminHelperExecutableCached,
 	},
-	{
-		configKeySuffix:  "check-bundle-extracted",
-		checkDescription: "Checking if CRC bundle is extracted in '$HOME/.crc'",
-		check:            checkBundleExtracted,
-		fixDescription:   "Extracting bundle from the CRC executable",
-		fix:              fixBundleExtracted,
-		flags:            SetupOnly,
-	},
 	{
 		configKeySuffix:  "check-ram",
 		checkDescription: "Checking minimum RAM requirements",
diff --git a/pkg/crc/preflight/preflight_darwin.go b/pkg/crc/preflight/preflight_darwin.go
index cb551ce6c..c8eef86a8 100644
--- a/pkg/crc/preflight/preflight_darwin.go
+++ b/pkg/crc/preflight/preflight_darwin.go
@@ -126,5 +126,6 @@ func getPreflightChecks(experimentalFeatures bool, mode network.Mode) []Check {
 		checks = append(checks, traySetupChecks[:]...)
 	}
 
+	checks = append(checks, bundleCheck)
 	return checks
 }
diff --git a/pkg/crc/preflight/preflight_linux.go b/pkg/crc/preflight/preflight_linux.go
index b2820c42c..76a9f3850 100644
--- a/pkg/crc/preflight/preflight_linux.go
+++ b/pkg/crc/preflight/preflight_linux.go
@@ -252,6 +252,7 @@ func getPreflightChecksForDistro(distro *linux.OsRelease, networkMode network.Mo
 	if networkMode == network.DefaultMode {
 		checks = append(checks, libvirtNetworkPreflightChecks[:]...)
 	}
+	checks = append(checks, bundleCheck)
 	return checks
 }
 
diff --git a/pkg/crc/preflight/preflight_windows.go b/pkg/crc/preflight/preflight_windows.go
index 5ac5f376d..e39adbb45 100644
--- a/pkg/crc/preflight/preflight_windows.go
+++ b/pkg/crc/preflight/preflight_windows.go
@@ -155,5 +155,6 @@ func getPreflightChecks(experimentalFeatures bool, networkMode network.Mode) []C
 		checks = append(checks, traySetupChecks[:]...)
 	}
 
+	checks = append(checks, bundleCheck)
 	return checks
 }


Test patch:
diff --git a/pkg/crc/preflight/preflight_linux_test.go b/pkg/crc/preflight/preflight_linux_test.go
index 020da1455..6bc0b3b3c 100644
--- a/pkg/crc/preflight/preflight_linux_test.go
+++ b/pkg/crc/preflight/preflight_linux_test.go
@@ -65,7 +65,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -86,6 +85,7 @@ var checkListForDistros = []checkListForDistro{
 			{check: checkCrcNetworkManagerDispatcherFile},
 			{check: checkLibvirtCrcNetworkAvailable},
 			{check: checkLibvirtCrcNetworkActive},
+			{check: checkBundleExtracted},
 		},
 	},
 	{
@@ -96,7 +96,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -110,6 +109,7 @@ var checkListForDistros = []checkListForDistro{
 			{check: checkMachineDriverLibvirtInstalled},
 			{cleanup: removeCrcVM},
 			{check: checkVsock},
+			{check: checkBundleExtracted},
 		},
 	},
 	{
@@ -120,7 +120,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -140,6 +139,7 @@ var checkListForDistros = []checkListForDistro{
 			{check: checkCrcDnsmasqConfigFile},
 			{check: checkLibvirtCrcNetworkAvailable},
 			{check: checkLibvirtCrcNetworkActive},
+			{check: checkBundleExtracted},
 		},
 	},
 	{
@@ -150,7 +150,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -164,6 +163,7 @@ var checkListForDistros = []checkListForDistro{
 			{check: checkMachineDriverLibvirtInstalled},
 			{cleanup: removeCrcVM},
 			{check: checkVsock},
+			{check: checkBundleExtracted},
 		},
 	},
 	{
@@ -174,7 +174,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -194,6 +193,7 @@ var checkListForDistros = []checkListForDistro{
 			{check: checkCrcDnsmasqConfigFile},
 			{check: checkLibvirtCrcNetworkAvailable},
 			{check: checkLibvirtCrcNetworkActive},
+			{check: checkBundleExtracted},
 		},
 	},
 	{
@@ -204,7 +204,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -218,6 +217,7 @@ var checkListForDistros = []checkListForDistro{
 			{check: checkMachineDriverLibvirtInstalled},
 			{cleanup: removeCrcVM},
 			{check: checkVsock},
+			{check: checkBundleExtracted},
 		},
 	},
 	{
@@ -228,7 +228,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -250,6 +249,7 @@ var checkListForDistros = []checkListForDistro{
 			{check: checkCrcNetworkManagerDispatcherFile},
 			{check: checkLibvirtCrcNetworkAvailable},
 			{check: checkLibvirtCrcNetworkActive},
+			{check: checkBundleExtracted},
 		},
 	},
 	{
@@ -260,7 +260,6 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: adminhelper.CleanHostsFile},
 			{check: checkPodmanExecutableCached},
 			{check: checkAdminHelperExecutableCached},
-			{check: checkBundleExtracted},
 			{configKeySuffix: "check-ram"},
 			{cleanup: removeCRCMachinesDir},
 			{cleanup: removeOldLogs},
@@ -275,6 +274,7 @@ var checkListForDistros = []checkListForDistro{
 			{cleanup: removeCrcVM},
 			{configKeySuffix: "check-apparmor-profile-setup"},
 			{check: checkVsock},
+			{check: checkBundleExtracted},
 		},
 	},
 }