Passing a cicd variable from a trigger pipeline

How can I pass a CICD variable when triggering a pipeline from one job?

I have a job which needs to trigger another job.
The job that trigger the pipeline is this

deploy.with-modelmesh-crd-upgrades:
  image: my-image
  environment: $GCP_PROJECT
  stage: deploy
  when: manual
  variables:
    ZONE: europe-west1-b
  script:
    - !reference [ .deploy_auth, script ]
    - gcloud container clusters get-credentials ewx-k8s --zone $ZONE --project ${CI_ENVIRONMENT_NAME}
 
    # Triggering deploy.uninstall-ml-serving-helm-release-and-deploy
    - |
      response_body=$(mktemp)  # Create a temporary file and store its name in $response_body
      response_code=$(curl --request POST \
                           --fail \
                           --form token=$TRIGGER_TOKEN \
                           --form ref=$CI_COMMIT_REF_NAME \
                           --form "variables[TRIGGERED_FROM]=deploy.with-modelmesh-crd-upgrades" \
                           --write-out "%{http_code}" \
                           --verbose \
                           --output "$response_body" \
                           "https://gitlab.com/api/v4/projects/47198141/trigger/pipeline")
      echo "Checking the response:"
      cat $response_body
      echo $TRIGGERED_FROM
      if [[ "$response_code" -ne 201 ]]; then
        cat $response_body
        echo "Failed to trigger deploy.uninstall-ml-serving-helm-release-and-deploy job with response code: $response_code."
        rm $response_body
        exit 1
      fi
      rm $response_body

If we check basically my curl command is

curl --request POST \
    --fail \
    --form token=$TRIGGER_TOKEN \
    --form ref=$CI_COMMIT_REF_NAME \
    --form "variables[TRIGGERED_FROM]=deploy.with-modelmesh-crd-upgrades" \
    --write-out "%{http_code}" \
    --verbose \
    --output "$response_body" \
    "https://gitlab.com/api/v4/projects/project-id/trigger/pipeline"

and this is the job that I want to be triggered from the above. I have there the follwing config:

deploy.uninstall-ml-serving-helm-release-and-deploy:
  # only for modelmesh module
  image:
    name: hashicorp/terraform:1.5.5
    entrypoint: [ "" ]
  environment: $GCP_PROJECT
  stage: deploy
  script:
    - echo "TRIGGERED_FROM = $TRIGGERED_FROM"
    - env
    - export GOOGLE_CREDENTIALS=$(base64 -d ${GCP_SA_KEY_B64})
    - cd terraform
    - terraform init
    - terraform workspace select ${CI_ENVIRONMENT_NAME} || terraform workspace new ${CI_ENVIRONMENT_NAME}
    # Destroying resources
    - |
      destroy_cmd="terraform destroy -input=false -auto-approve --var-file=env/${CI_ENVIRONMENT_NAME}.tfvars --var=ml_deployer_image_tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA::7} --var=ray_image_tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA::7}"
      for target in \
        "module.modelmesh[0].helm_release.modelmesh" \
        "google_compute_disk.modelmesh-disc" \
      do
        destroy_cmd="$destroy_cmd -target=\"$target\""
      done
      eval $destroy_cmd
    # Apply changes
    - terraform apply -input=false -auto-approve --var-file=env/${CI_ENVIRONMENT_NAME}.tfvars --var=ml_deployer_image_tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA::7} --var=ray_image_tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA::7}
  rules:
    - if: '$TRIGGERED_FROM == "deploy.with-modelmesh-crd-upgrades"'
      when: always
    - when: manual

Notice that the idea here is that pass the TRIGGERED_FROM variable that is being set on
deploy.with-modelmesh-crd-upgrades job, at curl command runtime, and ask for that variable on the deploy.uninstall-ml-serving-helm-release-and-deploy job since there I have this rule that defines:

rules:
    - if: '$TRIGGERED_FROM == "deploy.with-modelmesh-crd-upgrades"'
      when: always
    - when: manual

The point is that the TRIGGERED_FROM env variable is not being set when I declare it in the curl command, in the deploy.with-modelmesh-crd-upgradesjob, it seems there is a problem when doing that command.
I also try to simplify the curl command to do it like this:

- 'curl --fail --request POST --form token=$TRIGGER_TOKEN --form ref=$CI_COMMIT_REF_NAME --form "variables[TRIGGERED_FROM]=deploy.with-modelmesh-crd-upgrades" "https://gitlab.com/api/v4/projects/47198141/trigger/pipeline"'

but without luck, the TRIGGERED_FROM env variable is simply not being set.

Cheking the documentation, it seems my two curl command approaches seems to be in line with the way it says here: Trigger pipelines by using the API | GitLab

What could be wrong? Why the TRIGGERED_FROM env variable is simply not being set.?

Have you tried --form variables[TRIGGERED_FROM]="deploy.with-modelmesh-crd-upgrades"?