CI release tag building wrong eleas-cli format for powershell?

Trying to use release-cli from .gitlab-ci.yml, it looks to me like the command line isn’t assembled correctly for Powershell.
The following (normally the url is a package link build from variables, but I also tried this one with a fixed dummy url to see whether I fail at that point)

#option to manually push a tagged commit to production
Release:
    stage: release
    #to not let the pipeline wait if noone klicks this
    allow_failure: true 
    when: manual
    only:
        - tags
    needs:
        ["SaveBuild"]
    dependencies:
        ["SaveBuild"]
    script:
        - echo Will do release
    release:
        name: 'Release $CI_COMMIT_TAG'
        description: 'ReleaseDetails.md'
        tag_name: '$CI_COMMIT_TAG'
        ref: '$CI_COMMIT_SHA'
        assets:
            links:
                - name: 'Release binaries'
                  url: 'http://git.com'
                  link_type: 'package'

used from windows/powershell runner leads to

...
$ release-cli create --name "Release $CI_COMMIT_TAG" --description "ReleaseDetails.md" --tag-name "$CI_COMMIT_TAG" --ref "$CI_COMMIT_SHA" --assets-link "{\"name\":\"Release binaries\",\"url\":\"http://git.com\",\"link_type\":\"package\"}"
time="2021-07-05T13:56:56+02:00" level=info msg="Creating Release..." cli=release-cli command=create name="Release 00.07" project-id=102 ref=18683a0eccbe2f078e55e8c90c2755f3ed632ad7 server-url="..." tag-name=00.07 version=0.6.0
time="2021-07-05T13:56:56+02:00" level=fatal msg="new CreateReleaseRequest: failed to parse assets: invalid JSON: \"{\\\\\"" cli=release-cli version=0.6.0

So it seems to me that the JSON string is no given in the correct format because powershell likes to fuck up the quotes.
I also tried to use the notes added here:

To do it by hand. This resulted in a call which looked a lot like the one created by the “release” yml entries, but my resulting scripts also failed. In the moment (after a lot of different tries at escaping the quotes correctly) I fall back to --assets-links-name and --assets-links-url since they don’t rely on an argument being a valid JSON String. :roll_eyes:

Has anyone seen this working on a powershell runner or is it a new issue?

No one? (Also I’d like to add the missing “r” to the title of this thread, but don’t seem to have rights for that :frowning: )

FYI same problem…but no answer, did you find something from the time please ?

Nope:

Those are supposed to be deprecated and link_type can not be set, so not a good solution but “working”.
In complete (as part of script, assuming that release-cli is in the path):

- > # make release
              release-cli create 
              --name "Release $CI_COMMIT_TAG" 
              --description "ReleaseDetails.md"
              --tag-name $CI_COMMIT_TAG 
              --ref $CI_COMMIT_SHA
              --assets-links-name "Release Binaries"
              --assets-links-url http://git.com

It is now handled in this issue:

Short form: Building PS compatible script from the Release Keyword would be a new feature.
Escaping as described in the documentation works as long as you don’t use spaces in the artifact name.

1 Like