If you set up Cloud Workstations for an organization, you can create a user workstation configuration with predownloaded and prebuilt code. This lets developers start working immediately without waiting for the build process to complete.
To create a user workstation configuration, you create an admin workstation, run the build process once, create a snapshot of the persistent disk, and then use that snapshot to create a new workstation configuration.
Create an admin workstation
Follow the steps in Launch the workstation to create and launch a single workstation. This serves as your base image.
Build the targets
On the admin workstation, download the source code and build the targets. You can either manually build the targets or automate the build using the provided script.
Manual build
Before running the build script, gain access to the code as described in Source code access. Then manually build the targets as described in Download, build, and run.
Automated build
Run the setup.sh script provided in the sdv-setup repository. This
script automates cloning the Android source code and building the targets.
- Open a terminal on the workstation.
Set your Git credentials:
git config --global user.email "Your email address" git config --global user.name "Your name"Authenticate to
partner-android.googlesource.com:- Sign in to partner-android-review.googlesource.com with your Android partner account.
- Go to Settings, and then select Profile.
- Go to the HTTP Credentials section, and then click Obtain password.
- Follow the on-screen instructions, and then paste the authentication
script into the workstation terminal. This creates the
~/.gitcookiesfile, which is required for access.
Run the setup script by completing the following steps:
- Follow the authentication steps in Get access. This provides access to the setup script repository.
- Clone the
sdv-setuprepository, and then run the setup script:
# Change directories to the home directory cd ~/ # Clone the sdv-setup repository git clone https://sdv.googlesource.com/external/sdv-setup # Ensure the setup script is executable chmod +x sdv-setup/setup/setup.sh # Run the setup script ./sdv-setup/setup/setup.sh
The script takes several hours to complete. It clones the Android source code (approximately 30 minutes), and then builds the SDV IVI (2 hours), Media (30 minutes), and Core (10 minutes) targets.
(Optional) Set up an Android Studio for Platform project
Android Studio for Platform (ASfP) is an IDE preinstalled on the Cloud Workstation. If your developers all work on the same project, you can configure an ASfP project in the disk snapshot that everyone can use. Follow the instructions in Set up an AAOS SDV project to configure the project.
Create a disk snapshot
After the build completes, create a snapshot of the admin workstation's persistent disk.
Remove your Git configuration and cookies to prevent sharing personal credentials with other users:
rm ~/.gitcookies rm ~/.gitconfigRemove the
sdv-setuprepository to keep the base image clean:rm -rf ~/sdv-setupFind the admin workstation disk:
- Keep the admin workstation running.
- In the Google Cloud console, enter
VM Instancesin the search bar, and then click the top result. - In the Filter bar, enter
workstation_id:work-station.work-stationshould match the ID of your admin workstation. Press Enter to filter the results. - Click the remaining entry.
- On the VM instance page, two different disks are listed in Storage. Click the disk that has a Size (GB) of 1000 and a Type of Regional SSD persistent disk. This disk contains the home directory that you want to snapshot.
Stop the admin workstation:
- Keep the disk page open.
- In a new browser tab or window, open the Google Cloud console and
navigate to the Cloud Workstations page. In the search bar, enter
Cloud Workstations, and then click the top result. - Click Workstations in the side panel.
- Click the admin workstation (with workstation ID work-station) in the table.
- Click Stop in the toolbar, and then wait for the workstation to stop.
Create the disk snapshot:
- Switch back to the disk page, and then click Create snapshot in the toolbar.
- In the Name field, enter
aaos-sdv-dev-snapshot. - Leave the remaining fields at their default values.
- At the bottom of the page, click Create.
After a short time, the disk snapshot is created and ready for use.
Create the user workstation configuration
Create a new workstation configuration that uses the snapshot as a starting point:
- Follow the instructions in Set environment variables to launch Cloud Shell, and then set the environment variables.
Apply the Terraform configuration to create the user workstation configuration:
cd ~/dev/sdv-setup/tf/user_dev_env terraform init terraform apply -auto-approve
Create a user workstation
- In the Google Cloud console, navigate to the Cloud Workstations page. Enter
Cloud Workstationsinto the search bar, and then click the top result. - Click Workstations in the side panel.
- Click Create workstation in the toolbar.
- Enter an ID for the workstation, or leave the default.
- Enter a Display Name for the workstation. If you leave this blank, the ID is used.
- Select user-workstation-config as the Configuration.
- Click Create.
- In the workstation list, find the workstation you just created. Click Start under the Quick actions column.
- After the workstation starts, click Launch under the Quick actions column to start using the workstation.
- Open a file explorer to verify that the home directory contains the files from the disk snapshot.
Your organization can now create workstations for its developers. For more information about setting up access to Cloud Workstations, see Access control with IAM.