Skip to content

Workspace as code

Keep your workspace's stages and automations in Git, and change them with the SuperPlane CLI.

Workspace as code keeps your workspace’s workflow in files you can review in a pull request. The manifest, .superplane/main.yml, defines the workspace name, its stages in order, and which automations run in each stage. Each automation is its own file in .superplane/automations/.

You need the SuperPlane CLI, connected to your organization.

Export the workspace from the root of your repository. Replace WEB with your workspace key or ID.

Terminal window
superplane workspace export --workspace WEB

The export writes the .superplane/ folder with the manifest and every automation file it references. Use --output-dir to write it somewhere else, and --overwrite to replace an earlier export.

apiVersion: v2
kind: Factory
name: Checkout
stages:
# Keep Backlog and the other exported stages here.
- id: deploy
name: Deploy
auto_advance: false
automations:
- id: prepare-release
name: Prepare release
uses: automations/prepare-release.yml
# Keep the exported Done stage last.

The manifest uses kind: Factory for a workspace. Each stage has an id, a name, an optional auto_advance setting, and its automations. Each automation entry points to its file with a uses path relative to the manifest. See Stages and Steps for what goes in each.

When you edit an export, keep the existing stages and automations with their IDs, and keep the fields you don’t change, such as run. The repositories section describes the workspace’s current repository connections. Change repositories in the workspace’s Agent settings and export again.

Preview the change from the repository root:

Terminal window
superplane workspace plan --workspace WEB

The plan compares the manifest and its automation files with the workspace and lists every change, including removals. Commit the manifest and the automation files together. After review, apply the change from the approved revision:

Terminal window
superplane workspace apply --workspace WEB

The CLI makes a fresh plan and asks you to confirm it. Add --yes to apply without the prompt, for example from CI.

Two workspaces can use separate manifests that reference the same automation file. Pass a manifest with -f and its workspace with --workspace:

Terminal window
superplane workspace plan -f .superplane/web.yml --workspace WEB

Each workspace keeps its own tasks, automation run history, and repository connections.

  • Existing automations stay in their current stage. To move one, remove it and add a new one in the other stage.
  • Removing a stage you added also removes its automations. Backlog, Done, and the stages a workspace starts with stay.
  • Automation names are unique in the workspace.
  • YAML anchors and aliases aren’t supported.
  • Secrets that a step names must already exist in your organization. See Secrets.

GitHub push sync is planned. Track GitHub sync support.