blob: e7dcba9dd3ded22418c89abe0f7901273de3291d [file] [log] [blame]
Unlike the other operating systems which have a bash script that runs
on Linux and scripts qemu to prepare a GCE image, the Windows image
builder image is prepared by hand, following this list of
instructions:
-- In the GCE project's Networks > Default network, edit the "RDP" rule and
set its "Target tag" to "allow-rdp". (VMs will require the "allow-rdp" tag
to have any RDP access from the outside)
-- in GCE, create a new Windows 2008 server instance. Set its initial
username to "wingopher" and the password to something. Be sure to
uncheck "Delete the boot disk when instance terminates".
-- boot it. first boot is slow.
-- Connect with RDP to it. (I used the OS X Microsoft Remote Desktop
in the Mac App Store)
-- In initial “Initial Configuration Tasks” window:
* disable automatic installation of updates. They’ll just interrupt
the builds later. And we don't care about security since this isn't
going to be Internet-facing. No ports will be accessible
* disable Windows Error Report (“Not participating”)
* disable the Windows firewall (GCE provides its own)
-- Enable auto-login:
* Start > Run > Open: "control userpasswords2" [OK]
* Uncheck the "Users must enter a user name..." box (it already was
unchecked for me)
* Click to highlight the sole user (this makes it be the auto-login user)
* Press "OK"
* Enter password twice.
-- Prevent password expiration. This bit us once, and I'm not sure this is yet
sufficient, but:
User Accounts (from above) > Advanced (tab) > Advanced (button) >
[lusrmgr]: for all three users, disable password expiration (right click
and then Properties and it's a checkbox)
-- Download winstrap.
* Bring up cmd.exe (Start > Run > "cmd" [OK])
* Copy/paste (Right click: paste) this into cmd.exe:
bitsadmin /transfer mydownloadjob /download /priority normal https://storage.googleapis.com/winstrap/winstrap-2015-02-11-046f2a8.exe c:\users\wingopher\Desktop\winstrap.exe
* It should appear on the desktop.
-- double click winstrap. type "go" and press <enter>. abort it once
it's downloaded everything. (close the window)
-- make the Buildlet start on boot:
* Start > All Programs > right click "Startup"
* Right-mouse-drag "Start Buildlet" from the desktop (from winstrap) to the
Startup folder and "Create shortcuts here"
-- Install wix35 (ignore the warning about notinstalling "Votive" something)
-- Install git with middle option: "Use Git from Windows Command Prompt",
otherwise all the defaults.
-- click yes yes yes on the tdm64-gcc installer question defaults.
Then do the tdm64-gcc installer again but do 32-bit this time. You
should then have two TDM installs at c:\TDM-GCC-64 and
c:\TDM-GCC-32. Dont pick other locations. The gobuilder adds
those to your path.
-- disable GCE service so things boot quickly and don't kill the user
we've configured on boot.
- Run Regedit,
- Go to the registry entry "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services"
- delete the Google Compute Engine folder.
-- disable GCEStartupTask in the "Task Scheduler", for the same reason.
Maybe only one of these two is required. Might as well do both.
-- shutdown the machine
-- delete the GCE image (but not its boot disk)
-- Go to GCE Compute > Images > New Image and create an image named "windows-buildlet" with
"Source Type" of "Disk" and pick the Source Disk from the previously-deleted image.
You can now delete the old disk if you want.
** Misc docs:
http://www.win2008workstation.com/configure-auto-logon/
https://cloud.google.com/compute/docs/operating-systems/windows
-- notably "windows-startup-script-cmd" ala:
gcloud compute instances add-metadata <INSTANCE> --zone <ZONE> --metadata windows-startup-script-cmd="net user <USERNAME> <PASSWORD>"
https://github.com/golang/winstrap
http://golang.org/s/windowsbuilderhowto