Can you confirm if this is a bug with interactive ...
# atmos-dev
b
Can you confirm if this is a bug with interactive workflows and custom commands? Should the new interactive step types (eg,
choose
,
input
, etc support non-tty? I think it should. It would mean a single workflow could work for local and ci usage. Example:
Copy code
workflows:
  build-manifests:
    dependencies:
      tools:
        kustomize: v5.0.3
    steps:
      - name: account
        type: choose
        prompt: "Account"
        options: [dev, prod]
        default: !env STACK_ACCOUNT dev
      - name: region
        type: choose
        prompt: "Region"
        options: [use1, euc1]
        default: !env STACK_REGION use1
      - name: tag
        type: input
        prompt: "Release tag"
        default: !env RELEASE_TAG latest
      - command: atmos kube build "{{ .steps.account.value }}-{{ .steps.region.value }}/tao" --tag "{{ .steps.tag.value }}" --env "{{ .steps.account.value }}" --output ".argocd/manifests/common-tao/kustomized.yaml"
        type: shell
      - command: atmos kube build "{{ .steps.account.value }}-{{ .steps.region.value }}/zen" --tag "{{ .steps.tag.value }}" --env "{{ .steps.account.value }}" --output ".argocd/manifests/common-zen/kustomized.yaml"
        type: shell
In this example, the
STACK_ACCOUNT
and
STACK_REGION
envs would be set before executing the workflow CI. When running locally, it is intended to be interactive.
If this a bug, I can get a PR ready soon.
e
Help me understand the non-tty use-case for inputs?
In other words, input is inherently interactive, and most interactive use cases have a TTY
Reading the example it sounds like if no TTY (aka non interactive) you want it to gracefully degrade to use the default
b
Right now, I have 2 nearly identical workflows. One is basically the last two steps of the example workflow with the values coming envs (see below). There are nearly identical except one is interactive.
Copy code
workflows:  
  build-manifests-ci:
    description: Build tao+zen manifests for ${STACK_ACCOUNT}-${STACK_REGION}
    dependencies:
      tools:
        kustomize: v5.0.3
    steps:
      - command: atmos kube build "${STACK_ACCOUNT}-${STACK_REGION}/tao" --tag "${RELEASE_TAG}" --env "${STACK_ACCOUNT}" --output ".argocd/manifests/common-tao/kustomized.yaml"
        type: shell
      - command: atmos kube build "${STACK_ACCOUNT}-${STACK_REGION}/zen" --tag "${RELEASE_TAG}" --env "${STACK_ACCOUNT}" --output ".argocd/manifests/common-zen/kustomized.yaml"
        type: shell
> Reading the example it sounds like if no TTY (aka non interactive) you want it to gracefully degrade to use the default Yes. This already works for some step/command types.
👍 1
e
I think it would make sense if we introduced tolerance for downgrading to default if no, TTY or stdin available
b
Okay. I will put a new PR in to allow choose, input, confirm, and filter types to use default without erroring if non-tty. I am going to keep the current error behavior for those same types if non-tty without a default set.
👍 1
e
Thanks, Brian! That makes sense