Command passed as variable always fails

There is cyrcle.yml:

deployment:
  development:
    branch:
      - develop
    commands:
      - ${DEPLOY_STAGING_COMMAND}

And DEPLOY_STAGING_COMMAND is defined in Environment variables with value:

ssh ubuntu@54.165.245.171 "cd /home/ubuntu/crab && git pull && composer install --prefer-dist --no-dev"

Result always fails with error:

Warning: Permanently added '54.165.245.171' (ECDSA) to the list of known hosts.
bash: cd /home/ubuntu/crab && git pull && composer install --prefer-dist --no-dev: No such file or directory
${DEPLOY_STAGING_COMMAND} returned exit code 127
Action failed: ${DEPLOY_STAGING_COMMAND}

But if I replace ${DEPLOY_STAGING_COMMAND} with original value in cyrcle.yml, like this:

deployment:
  development:
    branch:
      - develop
    commands:
      - ssh ubuntu@54.165.245.171 "cd /home/ubuntu/crab && git pull && composer install --prefer-dist --no-dev"

It works fine! Also it works if I replace some string with variables:

deployment:
  development:
    branch:
      - develop
    commands:
      - ssh ${DEPLOY_USER}@${DEPLOY_SERVER} "cd ${DEPLOY_PATH} && git pull && composer install --prefer-dist --no-dev"

But, in my case, I need to customize deploy command from CircleCI project settings GUI.

Is there anybody who can explain why CircleCI fails with No such file or directory error when binding deploy command to ${DEPLOY_STAGING_COMMAND} variable?

Thank you!

Is this done via the Environment Variables page on the website? Or somewhere else?

Is this done via the Environment Variables page on the website? Or somewhere else?

Exactly. From Environment Variables page on website.

And there is solution:

deployment:
  development:
    branch:
      - develop
    commands:
      - eval ${DEPLOY_STAGING_COMMAND}
1 Like