This example demonstrates 3 different env variable declarations: inline, exported + inline, and in task.yaml.

Prerequisites

Setup

  1. Create shell variable with export EXPORT_VAR="test1" before launching or during launch (as shown below)

Current Working Directory

$ ls
task.yaml

Launching

export EXPORT_VAR="test1" && konduktor launch --env EXPORT_VAR --env INLINE_VAR="test2" task.yaml

Task.yaml

name: env

resources:
  cpus: 1
  memory: 1
  image_id: ubuntu
  labels:
    kueue.x-k8s.io/queue-name: user-queue
    maxRunDurationSeconds: "3200"

envs:
  TEST_VAR: "test3"

run: |
  if [[ -z "${EXPORT_VAR}" ]]; then
    echo "EXPORT_VAR is not set"
    exit 1
  else
    echo "EXPORT_VAR is set to ${EXPORT_VAR}"
  fi
  if [[ -z "${INLINE_VAR}" ]]; then
    echo "INLINE_VAR is not set"
    exit 1
  else
    echo "INLINE_VAR is set to ${INLINE_VAR}"
  fi
  if [[ -z "${TEST_VAR}" ]]; then
    echo "TEST_VAR is not set"
    exit 1
  else
    echo "TEST_VAR is set to ${TEST_VAR}"
  fi