Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use win32-background-launcher to start the daemon task #3901

Merged
merged 4 commits into from
Dec 21, 2023

Conversation

anjannath
Copy link
Member

@anjannath anjannath commented Oct 31, 2023

Needs:

@openshift-ci openshift-ci bot requested review from cfergeau and gbraad October 31, 2023 09:40
@anjannath
Copy link
Member Author

/hold

till required tasks are finished as mentioned in #3901 (comment) and #3879 (comment)

@anjannath anjannath force-pushed the background-launcher-spike branch 2 times, most recently from 2de34a4 to bd749ff Compare November 6, 2023 11:42
@anjannath
Copy link
Member Author

/test e2e-microshift-crc

@anjannath anjannath force-pushed the background-launcher-spike branch 2 times, most recently from da98ad6 to 985ebe3 Compare November 21, 2023 06:33
@gbraad
Copy link
Contributor

gbraad commented Nov 24, 2023

can we rename the application on Windows to crc-background-launcher instead of the cryptic win32-...
or background-launcher. This way people can identify where it belongs to, as paths are not shown in Task Manager.

@adrianriobo
Copy link
Contributor

Tested on windows 11 https://crcqe-asia.s3.amazonaws.com/nightly/ocp/4.14.3/20231123/11-pro/qe-results/e2e-non-ux.xml cluster behaves as expected

@anjannath
Copy link
Member Author

anjannath commented Nov 24, 2023

can we rename the application on Windows to crc-background-launcher instead of the cryptic win32-... or background-launcher. This way people can identify where it belongs to, as paths are not shown in Task Manager.

yes, can do, first have to first change the name of the executable in crc-org/win32-background-launcher

edit: created crc-org/win32-background-launcher#3

@cfergeau
Copy link
Contributor

can we rename the application on Windows to crc-background-launcher instead of the cryptic win32-... or background-launcher. This way people can identify where it belongs to, as paths are not shown in Task Manager.

Well the launcher is generic and has nothing crc specific. Dunno if there's a way to provide a description to indicate which process it launched?

Copy link
Contributor

@cfergeau cfergeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks fine, a few comments here and there.

DaemonLogFile = "crcd.log"
CrcLandingPageURL = "https://console.redhat.com/openshift/create/local" // #nosec G101
DefaultAdminHelperURLBase = "https://github.com/crc-org/admin-helper/releases/download/v%s/%s"
CRCWin32BackgroundLauncherURL = "https://github.com/crc-org/win32-background-launcher/releases/download/v%s/%s"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the CRC prefix is really useful here, and I'd also drop "win32". This does not need to be exported.

@@ -47,6 +48,8 @@ const (

OpenShiftIngressHTTPPort = 80
OpenShiftIngressHTTPSPort = 443

Win32BackgroundLauncherExeName = "win32-background-launcher.exe"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For admin-helper, we call it Executable, not ExeName

pkg/crc/preflight/preflight_windows.go Show resolved Hide resolved
@anjannath anjannath force-pushed the background-launcher-spike branch from 985ebe3 to 89aeb34 Compare November 28, 2023 08:27
@@ -187,6 +194,11 @@ func GetKubeAdminPasswordPath() string {
return filepath.Join(MachineInstanceDir, DefaultName, "kubeadmin-password")
}

func GetCRCWindowsBackgroundLauncherDownloadURL() string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetWin32BackgroundLauncher...?

@anjannath anjannath force-pushed the background-launcher-spike branch 2 times, most recently from 87484bc to f6b64de Compare December 1, 2023 08:19
@@ -20,6 +20,7 @@ type Cache struct {
executablePath string
archiveURL string
version string
nameMismatch bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoreNameMismatch would be more explicit.

@@ -33,8 +34,8 @@ func (e *VersionMismatchError) Error() string {
return fmt.Sprintf("%s version mismatch: %s expected but %s found in the cache", e.ExecutableName, e.ExpectedVersion, e.CurrentVersion)
}

func newCache(executablePath string, archiveURL string, version string, getVersion func(string) (string, error)) *Cache {
return &Cache{executablePath: executablePath, archiveURL: archiveURL, version: version, getVersion: getVersion}
func newCache(executablePath string, archiveURL string, version string, nameMismatch bool, getVersion func(string) (string, error)) *Cache {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I'd add this arg by default, might be better to explicitly set it for the background launcher after creating the cache with the default values (cache.IgnoreNameMismatch() or cache.ignoreNameMismatch = true)

@anjannath anjannath force-pushed the background-launcher-spike branch from f6b64de to ed08a91 Compare December 5, 2023 10:09
Copy link
Contributor

@cfergeau cfergeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 minor comments, but fine with me with or without changes
/lgtm
/approve

return fmt.Errorf("Missing background launcher binary at: %s", constants.Win32BackgroundLauncherPath())
}

binPathWithArgs := fmt.Sprintf(`"%s" daemon`, crcBinPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to be daemonCmdArgs := daemon --log-level debug`, is it intentional that you removed the debug logs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we have no way to look at the stdout of the process, and logs to the log file crcd.log is always at debug/trace level, so this flag was not useful

@@ -23,4 +23,6 @@ func NewWin32BackgroundLauncherCache() *Cache {
return strings.TrimSpace(stdOut), nil
},
)
cache.ignoreNameMismatch = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth an explanatory comment? upstream binary is win32-..., we want to name it crc-...?

Copy link

openshift-ci bot commented Dec 5, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfergeau

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Dec 5, 2023
@anjannath anjannath force-pushed the background-launcher-spike branch from ed08a91 to b74d3a2 Compare December 6, 2023 04:03
Copy link

openshift-ci bot commented Dec 6, 2023

New changes are detected. LGTM label has been removed.

crc-embedder is updated to download win32-background-launcher.exe
from its github release at crc-org/win32-backgroun-launcher so
that it is available while building the msi

it'll be used to start the crc daemon as a background process
this removes the powershell script we used earlier to start the daemon
task as a hidden process and uses the background launcher executable
installed by the msi to start the daemon task

updates the preflight checks that installs the daemon task to use the
background launcher executable
on a released crc version the win32-background-laucher will be installed
in the install location of crc by the msi, but while using a non
installer version this'll help to download the win32-background-launcher
binary by running `crc setup`

this is also helpful for testing different versions of the background
launcher during development
the background-launcher upstream is released as
win32-background-launcher.exe since its function
is generic and does nothing crc specific

however when we install it and use it to launch the
daemon process in background on windows it is useful
to name it as crc-background-launcher.exe to make it
easy for users to identify it with crc
@anjannath anjannath force-pushed the background-launcher-spike branch from 363d501 to ce335c0 Compare December 18, 2023 05:08
Copy link

openshift-ci bot commented Dec 18, 2023

@anjannath: The following tests 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/integration-crc ce335c0 link true /test integration-crc
ci/prow/e2e-crc ce335c0 link true /test e2e-crc
ci/prow/e2e-microshift-crc ce335c0 link true /test e2e-microshift-crc

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants