Develop portions of an application independently in Cloud Code for Cloud Shell

Stay organized with collections Save and categorize content based on your preferences.

You can develop and debug parts of your application independently by splitting your application into Skaffold modules. For a sample skaffold.yaml file with Skaffold modules and dependencies defined, see the skaffold.yaml file in the Bank of Anthos sample.

Defining Skaffold modules and configuration dependencies

To define Skaffold modules and configuration dependencies:

  1. Open the project where you want to define the modules.
  2. Open the skaffold.yaml file.
  3. If your skaffold.yaml file has multiple configurations, to make a configuration a Skaffold module, specify the following line:
      name: MODULE_NAME_1
  4. For configurations that rely on another configuration being deployed before the current configuration can be deployed, define dependencies. To specify a dependency, use the configs tag. The following sample shows a dependency that's defined in the same file. The configs tag can also reference other skaffold.yaml files in the current project.
        - configs: [DEPENDENCY_NAME]
  5. Test your configuration dependencies by building each of the Skaffold modules separately to make sure that they're deployed with their dependencies by following the steps in Building select Skaffold modules and their dependencies.

Building select Skaffold modules and their dependencies

If your project doesn't have a launch.json file defined, when you run Cloud Code: Run on Kubernetes or Cloud Code: Debug on Kubernetes, you're prompted to select the modules to build:

  1. Open the Command Palette (Ctrl/Cmd+Shift+P) and then run Cloud Code: Run on Kubernetes.
  2. Click Select modules.
  3. Choose the modules that you want to deploy and then click OK. Each module is built with its dependencies.
  4. When prompted, choose an image registry and then press Enter.

If your project has a launch.json, follow these steps to choose the Skaffold modules to build:

  1. Open your project's launch.json file.
  2. Edit the launch configuration to add the skaffoldFlags option with a comma-delimited list of modules to build. If skaffoldFlags is omitted, all modules are built.
        "name": "Run on Kubernetes",
        "type": "cloudcode.kubernetes",
        "request": "launch",
        "skaffoldConfig": "${workspaceFolder}/skaffold.yaml",
        "skaffoldFlags": {
           "modules": ["MODULE_NAME_2,MODULE_NAME_2"]
  3. Run the launch configuration you edited.