Cue Remote Template Generator

Action ID: cue:cueflow
NPM Package:

@shoukoo/backstage-plugin-scaffolder-cuelang

Description

Fetches and generates template files from a specified URL using Cue configuration parameters.

Input Schema

PropertyTypeDescriptionRequired
urlstringRelative path or absolute URL pointing to the directory tree to fetch
cueCmdstringCue command name
cuePkgstringCue package name
valuesobjectValues to pass on to the templating engine
cueOutDirstringCue output dir
targetPathstringTarget path within the working directory to generate contents to. Defaults to the working directory root.

Output Schema

No output schema defined for this action.

Usage Examples

Generate a Node.js service from a local Cue template

Generates a Node.js service scaffold from a template directory checked into the same repository. Use when your templates are versioned alongside your Backstage templates.

Copy
steps:
  - id: cue-generate-service
    action: cue:cueflow
    input:
      url: ./templates/node-service
      values:
        name: ${{ parameters.componentId }}
        owner: ${{ parameters.owner }}
        port: 8080
        image: ghcr.io/acme/${{ parameters.componentId }}:0.1.0
        env:
          NODE_ENV: production
          LOG_LEVEL: info
      targetPath: services/${{ parameters.componentId }}

Generate Kubernetes manifests from a remote template repo

Fetches a Cue-based Kubernetes template from a remote Git repository and renders manifests into an environment-specific folder. Use when you want reproducible deployments per environment.

Copy
steps:
  - id: cue-generate-k8s
    action: cue:cueflow
    input:
      url: https://github.com/acme/cueflow-templates/k8s?ref=v1.3.0
      cuePkg: charts
      cueCmd: run
      cueOutDir: manifests
      values:
        app: ${{ parameters.componentId }}
        image: ghcr.io/acme/${{ parameters.componentId }}:${{ parameters.version }}
        replicas: 3
        namespace: ${{ parameters.environment }}
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "256Mi"
      targetPath: deploy/${{ parameters.environment }}/${{ parameters.componentId }}

Minimal usage with defaults

Fetches a template using only the required URL and relies on default Cue package, command, and output directory. Use when the template encodes sensible defaults and does not require extra values.

Copy
steps:
  - id: cue-generate-minimal
    action: cue:cueflow
    input:
      url: https://example.com/templates/static-content

Export JSON configuration into a docs directory

Runs Cue export to materialize a JSON API configuration into a docs folder. Use when you want to publish machine-readable configuration as part of your repository documentation.

Copy
steps:
  - id: cue-export-config
    action: cue:cueflow
    input:
      url: ./templates/api-config
      cuePkg: docs
      cueCmd: export
      cueOutDir: api
      values:
        service:
          id: ${{ parameters.componentId }}
          owner: ${{ parameters.owner }}
          endpoints:
            - path: /healthz
              method: GET
            - path: /v1/items
              method: POST
        version: ${{ parameters.version }}
      targetPath: docs

Generate a monorepo workspace with multiple packages

Produces files for a monorepo layout by passing an array of packages to the Cue template. Use when bootstrapping multiple modules in a single repository.

Copy
steps:
  - id: cue-generate-monorepo
    action: cue:cueflow
    input:
      url: ./templates/monorepo
      cuePkg: workspace
      cueCmd: run
      cueOutDir: out
      values:
        workspace: ${{ parameters.repoName }}
        owner: ${{ parameters.owner }}
        packages:
          - name: api
            language: go
            port: 7007
          - name: web
            language: react
            port: 3000
          - name: worker
            language: python
            queue: orders
      targetPath: packages