Google IDX icon

Google IDX

Google IDX

Run Command Workstation

AI-generated

Overview

This node integrates with Google Cloud Workstations, allowing users to manage and interact with their cloud-based development environments programmatically. It supports various operations such as running commands inside a workstation, starting or stopping workstations, generating access tokens, retrieving status, and more.

A key feature is the ability to run arbitrary shell commands inside a specified Google Cloud Workstation via SSH through a Docker container running the Google Cloud CLI. This enables automation of tasks like environment setup, software installation, or executing scripts remotely within the workstation.

Practical examples:

  • Running build or deployment scripts inside a cloud workstation.
  • Automating start/stop cycles of workstations based on workload.
  • Fetching real-time status of multiple workstations for monitoring.
  • Generating access tokens to securely connect to workstations.

Properties

Name Meaning
Project ID Select or enter your Google Cloud project ID. Can be chosen from a list of projects or entered manually as an ID string.
Gcloud CLI The name of the Docker container running the Google Cloud CLI used to execute commands. Default is "n8n-gcloud-1".
Command The shell command(s) to run inside the selected Google Cloud Workstation. Supports multiline input.
Is Global Data Boolean flag indicating whether to use global workflow data storage for workspace information.
Global Data JSON object containing global data to be used if "Is Global Data" is true.

Output

The node outputs JSON objects representing the results of the requested operation. For the "Run Command Workstation" operation specifically, the output JSON includes:

  • timestamp: The time when the command was executed.
  • accessToken: The OAuth2 access token used for authentication.
  • project: The Google Cloud project ID extracted from the workstation URL.
  • region: The region of the workstation.
  • cluster: The cluster name of the workstation.
  • config: The workstation configuration name.
  • workstation: The specific workstation identifier.
  • exitCode: The exit code returned by the executed command.
  • stdout: Standard output from the command execution.
  • stderr: Standard error output from the command execution.

If the node runs other operations, the output structure varies accordingly, typically returning JSON with relevant data or status information about the workstations.

The node does not output binary data.

Dependencies

  • Requires an API authentication token credential configured in n8n to authenticate with Google Cloud services.
  • Depends on having a Docker container running the Google Cloud CLI (gcloud) accessible by the node, named as specified in the "Gcloud CLI" property (default: n8n-gcloud-1).
  • The node executes shell commands inside this Docker container to interact with Google Cloud Workstations via SSH.
  • Requires network access to Google Cloud APIs and the target workstations.

Troubleshooting

  • Missing or invalid Project ID: The node throws an error if the Project ID is not provided or invalid when running commands. Ensure the Project ID is correctly set.
  • Docker container not found or inaccessible: If the specified Docker container running the Google Cloud CLI is not running or cannot be accessed, command execution will fail. Verify the container is up and named correctly.
  • Authentication errors: If OAuth2 credentials are missing, expired, or invalid, API requests will fail. Refresh or reconfigure the API authentication token.
  • Command execution errors: Errors during command execution inside the workstation (e.g., syntax errors, permission issues) will be reflected in the stderr output. Review the command and permissions.
  • Invalid input format for manual commands: When using manual workstation commands, ensure the input matches the expected pattern; otherwise, the node throws descriptive errors.
  • Unsupported operations: Attempting to use an unsupported operation will result in an explicit error message.

Links and References

Discussion