Cloud development

Cloud Workstations in Google Cloud let you develop SDV without needing a local machine. You need access to a Google Cloud project before continuing. Reach out to your Google point of contact if you don't have access to a Google Cloud project. Qwiklabs environments are available for temporary evaluation.

Workflows

This guide applies to both:

  • Individual developers: For individual developers setting up their own environment.

  • Organizations: For administrators setting up a reusable workstation configuration for their organization. After following this guide, proceed to Organization setup.

Environment setup

Follow these steps to configure your Google Cloud environment and deploy the workstation resources.

Set environment variables

  1. Launch Cloud Shell in your Google Cloud project.

  2. Set the environment variables specific to your Google Cloud project. These variables are used in the scripts that follow.

    • If you're using the Qwiklabs environment:
      1. Run the script from the Qwiklabs page.
    • If you're using your own Google Cloud project:

      1. Find your project ID and username in Cloud Shell.

        Regions and zones can be found in Cloud locations. If they aren't specified, us-central1 is used as the region and us-central1-c is used as the zone.

      2. Edit the following script with the correct information and run it:

        # REQUIRED
        export TF_VAR_gcp_project_id=GCP Project ID
        export TF_VAR_gcp_username=GCP Username
        # OPTIONAL
        export TF_VAR_gcp_region=Region to use for the resources (default: us-central1)
        export TF_VAR_gcp_zone=Zone to use for the resources (default: us-central1-c)
        

Get the setup scripts

  1. To access the setup scripts, see Get access.
  2. Clone the setup scripts:

    # Create a work directory
    mkdir ~/dev
    cd ~/dev
    
    # Ensure the cloned repository has the correct file permissions
    umask 0022
    
    # Clone the setup scripts
    git clone https://sdv.googlesource.com/external/sdv-setup
    

Create a container repository

Apply the Terraform configuration to create a container repository:

cd ~/dev/sdv-setup/tf/container_repo
terraform init
terraform apply -auto-approve

This script completes in about two minutes.

Build the Docker container image

Build the Docker image for Cloud Workstations:

cd ~/dev/sdv-setup/docker/android-studio-for-platform
gcloud builds submit --timeout=3h --substitutions=_IMAGE_NAME=${TF_VAR_gcp_region}-docker.pkg.dev/${TF_VAR_gcp_project_id}/aaos-sdv/android-studio-for-platform-canary,_ASFP_VERSION=canary

This script completes in about one hour. After it finishes, the container image is stored in Artifact Registry.

Deploy the developer environment

Apply the Terraform configuration to create the developer environment:

cd ~/dev/sdv-setup/tf/dev_env
terraform init
terraform apply -auto-approve

This script completes in about 20 minutes.

Use Cloud Workstations

Learn how to launch your workstation, access the clipboard, and manage activities.

Launch the workstation

  1. In the Google Cloud console, enter "Cloud Workstations" into the search bar. Under the Products & pages section, click Cloud Workstations.
  2. In the navigation menu, click Workstations.

  3. In the list of workstations, click Start in the Quick actions column for the workstation named work-station.

  4. After the workstation starts, click Launch in the Quick actions column for the same workstation.

    A new window opens showing a desktop interface. If an error appears, wait one minute and refresh the page.

Clipboard access

You can copy and paste between your local machine and Cloud Workstations through a special interface. On the screen's left edge, a small gray arrow is centered vertically. Clicking the arrow opens a small menu with five buttons. Click the Clipboard icon.

Manage your clipboard in the workstation using the text area that appears. To paste text from your local machine to the workstation, add text to the box, then paste it. To copy text from the workstation, copy it. The text then appears in the box, where you can copy it again and paste it onto your local machine.

Activities overview

You can start apps in the activities overview:

  1. In the top bar, go to Activities overview.

  2. To filter the list of apps, enter the name of the app in the top search bar.

  3. To launch an app, click the respective icon.

Next steps

Your development environment is set up and you're ready to start building with SDV. Follow the next steps depending on your workflow: