"$VAR = [all]" custom deployment condition does not work

In my config file, I am defining a build matrix (2 dimensions: python version and an env variable) like so:

python:
    - "3.6"
    - "3.7"
    - "3.8"
env:
    - DEP=[all]
    - DEP=[dev]

and a deploy stage that should only be run by one specific build. To achieve this, I am specifying the python variable and a condition for the env variable, like so:

deploy:
  provider: pages:git
  skip_cleanup: true
  verbose: true
  token: $GITHUB_TOKEN
  edge: true
  local_dir: ./docs/_build/html/
  keep_history: true
  on:
    all_branches: true
    python: 3.8
    condition: $DEP = [all]

However, the condition isn’t met for any of my jobs (Message: “Skipping a deployment with the pagesgit provider because a custom condition was not met”), not even for the one with Python 3.8 and $DEP = [all].

See this link for the job:

What am I doing wrong here? Are the env variables defined above not accessible in the deploy stage? Or is there some syntax error in the condition line?

Additional question: Some of the jobs print out two messages with regards to skipping the deployment:

Skipping a deployment with the pagesgit provider because this is not on the required runtime
Skipping a deployment with the pagesgit provider because a custom condition was not met

What does the first line mean?

As per https://docs.travis-ci.com/user/deployment-v2/conditional#condition, a custom condition is evaluated as a Bash conditional expression like this:

if [[ <condition> ]]; then <deploy>; fi

In double brackets in the = comparison, if the right argument is without quotes, it’s treated as an extended regex:

$ export DEP=[all]
$ (set -x; if [[ $DEP = [all] ]]; then echo foo; fi)
+ [[ [all] = [all] ]]

$ (set -x; if [[ $DEP = "[all]" ]]; then echo foo; fi)
+ [[ [all] = \[\a\l\l\] ]]
+ echo foo
foo

So you need to quote the right-hand = argument in the custom condition.

As an aside, heed the build config validation error in https://travis-ci.org/github/Happy-Algorithms-League/hal-cgp/jobs/708736293/config . Your deployment wouldn’t work even with correct condition due to it.

Skipping a deployment with the pagesgit provider because this is not on the required runtime means that the python: 3.8 condition is not met.

Thank you very much for the reply, this solved my problem. :+1: