0

In YAML pipeline I'm attempting to set OS variable on Linux Agent so Cypress can look it up:

  - script: export CYPRESS_key=ala
    displayName: "Set key"

  - script: echo $(CYPRESS_key)
    displayName: "Print key"

unfortunately the OS variable is never set. The output is:

/home/vsts/work/_temp/321aacd-cadd-4a16-a4d1-db7927deacde.sh: line 1: CYPRESS_key: command not found
Yoda
  • 17,363
  • 67
  • 204
  • 344

2 Answers2

0

$(command) and ${variable} you are using wrong brackets

- script: export CYPRESS_key=ala
  displayName: "Set key"

- script: echo ${CYPRESS_key}
  displayName: "Print key"

- script: echo $(cat /etc/os-release)
  displayName: "Print file content"
Facty
  • 472
  • 4
  • 12
0

Environment variables in Linux are accessed as $ENVIRONMENT_VARIABLE_NAME, not $(ENVIRONMENT_VARIABLE_NAME).

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120