Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 4 additions & 56 deletions dev-docs/create-gce-windows-build-vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ ensure the build VM has enough power/disk space to do the builds.

Note: Using `ssd` speeds up the build.

## Option 1: Create VM from a Public Image
## Create VM from a Public Image

1. Create the VM:
```shell
# VM image family.
export WIN_BUILD_VM_OS_IMAGE_FAMILY=windows-2019
# VM image family. Use the Windows Server version that matches
# WINDOWS_VERSION in Dockerfile.windows (ltsc2022 by default).
export WIN_BUILD_VM_OS_IMAGE_FAMILY=windows-2022

# Your dev GCP project ID.
export VM_PROJECT_ID=${USER}-sandbox
Expand Down Expand Up @@ -45,56 +46,3 @@ Note: Using `ssd` speeds up the build.
```

Record the password to use for connecting to this VM as `$WIN_BUILD_VM_PASSWORD`.


## Option 2: Create VM from a Pre-configured Custom Image

We maintain pre-configured Windows custom images internally to simplify the creation of VMs.

Current available images:

| Project ID | Image Name | Base Image | Family |
|-------------------------|-----------------------------------------------------------------|-------------------------------------------------|-----------------------------|
| stackdriver-test-143416 | ops-agent-build-windows-server-2019-dc-for-containers-v20220713 | windows-server-2019-dc-for-containers-v20220713 | windows-2019-for-containers |


1. Create the VM:
```shell
# Custom VM image.
export CUSTOM_IMAGE_NAME=ops-agent-build-windows-server-2019-dc-for-containers-v20220713
export CUSTOM_IMAGE_PATH=projects/stackdriver-test-143416/global/images/${CUSTOM_IMAGE_NAME}

# Your dev GCP project ID.
export VM_PROJECT_ID=${USER}-sandbox

# The zone to create the VM in.
export VM_ZONE=us-central1-a

# The VM name to use.
export WIN_BUILD_VM_NAME=${USER}-win-build-vm

gcloud compute instances create \
--project $VM_PROJECT_ID \
--zone $VM_ZONE \
--image $CUSTOM_IMAGE_PATH \
--machine-type e2-highmem-8 \
--boot-disk-type pd-ssd \
--boot-disk-size 200GB \
--scopes storage-rw,logging-write,monitoring-write \
$WIN_BUILD_VM_NAME
```

2. Once the VM is running, reset the password:

```shell
gcloud compute reset-windows-password --quiet \
--project $VM_PROJECT_ID \
--zone $VM_ZONE \
--user=opsagentdev \
$WIN_BUILD_VM_NAME
```

Note that the default user for the VM is `opsagentdev`.
Record the password to use for connecting to this VM as `$WIN_BUILD_VM_PASSWORD`.

Skip the steps in [Set up a Windows VM](set-up-windows-vm.md); follow the steps in [Connect to a Windows VM](connect-to-windows-vm.md) to connect via RDP.
7 changes: 2 additions & 5 deletions dev-docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,8 @@ See [Create a GCE Windows test VM](create-gce-windows-test-vm.md).
test.

Note: If you are testing the binary directly on the build VM, you can skip
this step. There is some downside of doing so because the build VM is
optimized for container usage (e.g. Windows Event Logs from `Application`
channel do not work. But it's
sufficient for a quick sanity check. If you are testing the binary on a
separate Windows VM, continue.
this step. That is sufficient for a quick sanity check. If you are testing
the binary on a separate Windows VM, continue.

Download the artifacts from the GCS bucket you uploaded the artifacts to in
the previous step.
Expand Down
4 changes: 1 addition & 3 deletions dev-docs/set-up-windows-vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Install Git if you would like to clone the repo and build.

## Install Docker

Docker is preinstalled on GCE container images such as `Windows Server 2019 for Containers`.

Check if Docker is installed and running:

1. Run PowerShell as Administrator, and execute
Expand All @@ -60,7 +58,7 @@ Check if Docker is installed and running:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
```

For GCE images not built for containers, install Docker following steps [here](https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce#windows-server-2).
If Docker is not installed, install it following the steps [here](https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce#windows-server-2).


## [Optional] Install VSCode
Expand Down
Loading