Skip to content

Output

Introduction

In DevStream's configuration file, we can use Output from one Tool as the options values for another Tool.

For example, if Tool A has an output, we can use its value as Tool B's options.

Notes:

  • At the moment, B using A's output doesn't mean B "depends on" A.
  • If B really needs to "depend on" A, i.e., we want to make sure A runs first before B runs, we still need to use the dependsOn keyword (see the previous section "Core Concepts" for more details.)

Syntax

To use the output, follow this format:

Text Only
${{ TOOL_NAME.TOOL_INSTANCE_ID.outputs.OUTPUT_KEY }}

For example, given config:

YAML
tools:
- name: trello
  instanceID: default
  options:
    owner: IronCore864
    repo: golang-demo
    kanbanBoardName: golang-demo-board
  • TOOL_NAME is "trello"
  • TOOL_INSTANCE_ID is "default"

If the "trello" tool/plugin has an output key name "boardId", then we can use its value by the following syntax:

Text Only
${{ trello.default.outputs.boardId }}

Real-World Usage Example

Config:

YAML
---
tools:
- name: repo-scaffolding
  instanceID: default
  options:
    destinationRepo:
      owner: IronCore864
      org: ""
      repo: golang-demo
      branch: main
      repoType: github
    vars:
      ImageRepo: "ironcore864/golang-demo"
    sourceRepo:
      org: devstream-io
      repo: dtm-scaffolding-golang
      repoType: github
- name: argocd
  instanceID: default
  options:
    repo:
      name: argo
      url: https://argoproj.github.io/argo-helm
    chart:
      chartPath: ""
      chartName: argo/argo-cd
      releaseName: argocd
      namespace: argocd
      wait: true
      timeout: 10m
      upgradeCRDs: true
- name: argocdapp
  instanceID: default
  dependsOn: [ "argocd.default", "repo-scaffolding.golang-github" ]
  options:
    app:
      name: golang-demo
      namespace: argocd
    destination:
      server: https://kubernetes.default.svc
      namespace: default
    source:
      valuefile: values.yaml
      path: helm/golang-demo
      repoURL: ${{ repo-scaffolding.golang-github.outputs.repoURL }} # pay attention here

In this example: - The "default" instance of tool argocdapp depends on the "default" instance of tool repo-scaffolding - The "default" instance of tool argocdapp has an user option "options.source.repoURL", which uses the "default" instance of tool repo-scaffolding's output "repoURL" (${{ repo-scaffolding.golang-github.outputs.repoURL }})