Way to expand env var in pipeline?

Way to expand env var in pipeline?

Im trying to use the release-cli tool to release multiple binaries. Im trying to do it in a way that can dynamically add more binaries as I make them available. I am able to create an environmental variable that contains the arguments for the program. The problem I am running into is it seems the env var is being mangled when used as an argument. It appears from this error (https://gitlab.com/DeepHorizons/gitlabfilesystem/-/jobs/839803461) that is is eating the first hyphen, but I’m not sure. All variables seem to be OK from echo.

I have tried:

  • release-cli $ARGS
  • echo "release-cli $ARGS" | bash

I am using Gitlab.com & Runner: 13.5 & 13.6

Relevant CI section:

  variables:
    GENERIC_REPO_URL: $CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/$CI_PROJECT_NAME/$CI_COMMIT_TAG
  script:
    - export ASSETS=
    # Upload the files
    - >
        for f in *.deb ; do
          echo "Uploading $f"
          curl --header "JOB-TOKEN: $CI_JOB_TOKEN" \
            --upload-file $f \
            $GENERIC_REPO_URL/$f
          export ASSETS="$ASSETS --asset-link '{\"name\":\"$f\",\"url\":\"$GENERIC_REPO_URL/$f\"}'"
          echo "Assets; $ASSETS"
        done
    - echo "Uploading assets; $ASSETS"
    - export COMMAND="release-cli create --name $CI_PROJECT_NAME --description \"Get artifacts from the filesystem\" $ASSETS"
    - echo $COMMAND
    - echo $COMMAND | bash

One result when trying to pipe into bash

export COMMAND="release-cli create --name $CI_PROJECT_NAME --description \"Get artifacts from the filesystem\" $ASSETS"
$ echo $COMMAND
release-cli create --name gitlabfilesystem --description "Get artifacts from the filesystem" --asset-link '{"name":"gitlabfilesystem_0.1.1_amd64.deb","url":"https://gitlab.com/api/v4/projects/20030410/packages/generic/gitlabfilesystem/0.1.1/gitlabfilesystem_0.1.1_amd64.deb"}' --asset-link '{"name":"ubuntu16.04_gitlabfilesystem_0.1.1_amd64.deb","url":"https://gitlab.com/api/v4/projects/20030410/packages/generic/gitlabfilesystem/0.1.1/ubuntu16.04_gitlabfilesystem_0.1.1_amd64.deb"}'
$ echo "$COMMAND" | bash
Incorrect Usage: flag provided but not defined: -asset-link