-
Notifications
You must be signed in to change notification settings - Fork 18k
builders: use the buildlet for Windows builds #8640
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
Comments
Alex, couple questions: 1) How do I make a Windows program start on boot and run as a daemon? 2) How do I run all.bat with exec/Command? Do I pass it to cmd.exe or something? Or just directly? 3) Does the Go build work if nobody is logged in to the console? Does it run as Administrator then? |
Notes: The GCE Internet security policy is so restrictive that browsing the web is useless. We want to download Winstrap and MinGW, etc. Winstrap does all that: http://storage.googleapis.com/winstrap/ The Windows GCE instance has "bitsadmin" available. Click the shell icon (Powershell) on the start bar and paste (right click in Microsoft's Remote Desktop Client): bitsadmin /transfer mydownloadjob /download /priority normal http://storage.googleapis.com/winstrap/winstrap-20140711.exe c:\users\windows-test\Desktop\winstrap.exe Then double-click winstrap.exe on the desktop. |
RE #2.1: To run something at boot and run as a daemon is what windows calls a service. You could either find a shim program that launches an exec from it, or to write it yourself, use Alex's http://code.google.com/p/winsvc/ (or mine bitbucket.org/kardianos/service which now uses Alex's package). RE #2.3: A windows service can be run with different permissions and as different users. If you have it run as your administrator user, it would probably work fine, though it may work fine as the default system user if the FS ACLs are set correctly. |
> ... 1) How do I make a Windows program start on boot and run as a daemon? Like Daniel said in #7 these are called windows services. But we don't want to run like that, service have completely different environment (security and other parameters). I am certain our builder will have multiple problems in that environment. I think we want to do what we do now - run builder as desktop program. We should login as administrator and start builder program on login. We can configure windows to login as administrator automatically (I have never done it, but I am sure it is easy enough - I can ask my admin friends or google). As to starting builder on login, it is just a matter of creating short-cut to the program in "Startup" menu. 2) How do I run all.bat with exec/Command? Do I pass it to cmd.exe or something? Or just directly? Our current builder just calls all.bat, I believe. 3) Does the Go build work if nobody is logged in to the console? Does it run as Administrator then? Or current builder runs inside user session, with Administrator as user logged in. I see you have builders running on GCE manually already. This is a good start. Hopefully we can do everything you have plans for. I don't see why we cannot. Alex |
For autologin do this in the registry (using regedit or anything else you like): Go to HKLM\Software\Microsoft\Windows NT\CurrentVersion\winlogon Set these keys: AutoAdminLogon = "1" DefaultUserName = Administrator DefaultPassword = PasswordOfTheAdministrator Of course replacing the username and password with your own. For making sure an application or bat file starts upon logon, navigate to: HKCU\Software\Microsoft\Windows\CurrentVersion\Run Create a new entry witha ny name you'd like. As the value, set the full path to the executable or .bat file you want to run. If you want I can automate this into a script, should it be useful. |
> what should we do for an ssh server on Windows? > > Could we use Go's ssh server package with cmd.exe as a child process somehow? Or is there another ssh server we should use? I am not aware of any particular ssh server for Windows. But I am sure there are many available. Windows used to come (maybe still does) with built-in telnet server itself. Or we can, probably, build our own out of Go’s ssh server package. But what are you going to do once connected to that remote cmd.exe? I fear you won’t be able to do much. Windows command line tools are pathetic as far as I am aware. You will be able to build Go programs, maybe run gdb, but nothing else. What are you planning to do once connected? > RDP isn't a great answer. RDP will allow you to do anything you want. It is the only way commonly supported by Microsoft. RDP will work in pretty much any situation. > We want a common interface (ssh) to all builders. Fair enough. But, like I said earlier, it might work in a particular scenario, but not for a general purpose access. Alex |
RDP is easy and we can provide it. But what I want is for us to have a general tool, like: $ go tool debug --builder=windows-amd64 --hg=71b41b413359 $ go tool debug --builder=windows-amd64 --cl=134560043 .. which will then prepare that environment + patches and ssh you into it automatically, with no knowledge of passwords or IP address or ssh public keys. So if we're going to have that work for all the Unix builders, I also want an equivalent for Windows, even if it's an anemic CLI environment. Perhaps we also have: $ go tool debug --rpd ... which brings up an RDP viewer at that environment. But I'd like to think about how we do ssh if possible. |
If you just want our builder to execute specific commands on request, than sure it can be done. It is just good old tcp client / server. If you want to use ssh for that, that should be fine too. But I am not sure if there are ready to use tools for that. So perhaps just use Go ssh server package. Alex |
There's quite a lot of SSH servers for Windows: https://en.wikipedia.org/wiki/Comparison_of_SSH_servers#Platform , not all of them free though. I've used OpenSSH for Windows once years ago (not on the Wiki list, http://sshwindows.sourceforge.net/) but I don't know if it's still up to snuff. A quick google search leads to this: http://serverfault.com/questions/8411/what-is-a-good-ssh-server-to-use-on-windows which might help you. |
This is the basics: untar a tar.gz file to a directory, and execute a command. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I5917ed8bd0e4c2fdb4b3fab34ca929caca95cc8a Reviewed-on: https://go-review.googlesource.com/2180 Reviewed-by: Andrew Gerrand <[email protected]>
This isn't used yet, but will be for the new-style builders (VMs on GCE running the buildlet, started by the coordinator). From the code's comments: cleanUpOldVMs periodically enumerates virtual machines and deletes any which have a "delete-at" attribute having a unix timestamp before the current time. These VMs are created to run a single build and should be shut down by a controlling process. Due to various types of failures, they might get stranded. To prevent them from getting stranded and wasting resources forever, we instead set the "delete-at" metadata attribute on them when created to some time that's well beyond their expected lifetime, and then this is the backup mechanism to delete them if they get away. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I489e97926e7ab56487571c2bf0bd255cdf49570d Reviewed-on: https://go-review.googlesource.com/2199 Reviewed-by: Burcu Dogan <[email protected]>
Started instructions in https://go-review.googlesource.com/2269 |
Updates golang/go#8640 Change-Id: I3f0b10c237f437137ed46415d7cc443d4c6a419b Reviewed-on: https://go-review.googlesource.com/2269 Reviewed-by: Alex Brainman <[email protected]> Reviewed-by: Andrew Gerrand <[email protected]>
Added a "stage0" command in https://go-review.googlesource.com/#/c/2268/ to bake into the Windows VM which downloads the real buildlet at boot. Other OSes do this with a couple lines of shell, but I don't know BAT or PowerShell, so Go it is. |
This is the basics: untar a tar.gz file to a directory, and execute a command. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I5917ed8bd0e4c2fdb4b3fab34ca929caca95cc8a Reviewed-on: https://go-review.googlesource.com/2180 Reviewed-by: Andrew Gerrand <[email protected]>
This isn't used yet, but will be for the new-style builders (VMs on GCE running the buildlet, started by the coordinator). From the code's comments: cleanUpOldVMs periodically enumerates virtual machines and deletes any which have a "delete-at" attribute having a unix timestamp before the current time. These VMs are created to run a single build and should be shut down by a controlling process. Due to various types of failures, they might get stranded. To prevent them from getting stranded and wasting resources forever, we instead set the "delete-at" metadata attribute on them when created to some time that's well beyond their expected lifetime, and then this is the backup mechanism to delete them if they get away. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I489e97926e7ab56487571c2bf0bd255cdf49570d Reviewed-on: https://go-review.googlesource.com/2199 Reviewed-by: Burcu Dogan <[email protected]>
Updates golang/go#8640 Change-Id: I3f0b10c237f437137ed46415d7cc443d4c6a419b Reviewed-on: https://go-review.googlesource.com/2269 Reviewed-by: Alex Brainman <[email protected]> Reviewed-by: Andrew Gerrand <[email protected]>
This is now done & running at https://build.golang.org/ Final changes are in https://go-review.googlesource.com/4132 |
The old C-based dist accepted merged flags (-wp) but the Go-based dist requires -w -p This should get the Windows race builder running properly, along with https://go-review.googlesource.com/#/c/4132/ Update #8640 Change-Id: Ic17bbe9ea6c8b3d3e9b29f94e234d014f2926439 Reviewed-on: https://go-review.googlesource.com/4133 Reviewed-by: Brad Fitzpatrick <[email protected]>
The text was updated successfully, but these errors were encountered: