I have a “Release Job” whose script does the following:
- Write-Output "assets_list.txt:"
- $assetsContent = Get-Content -Path assets_list.txt
- Write-Output $assetsContent
- release-cli create --name "Release $CI_COMMIT_TAG" --description "No description" --ref $CI_COMMIT_TAG --tag-name $CI_COMMIT_TAG --assets-link="$assetsContent"
The “assets_list.txt” variable content is:
[
{"name":"project1_name.elf","url":"https://gitlab.../project1_name-9fb112c5-jkh.elf"},
{"name":"project1_name.hex","url":"https://gitlab.../project1_name-9fb112c5-jkh.hex"},
{"name":"project1_name.map","url":"https://gitlab.../project1_name-9fb112c5-jkh.map"},
{"name":"project2_name.elf","url":"https://gitlab.../project2_name-9fb112c5-jkh.elf"},
{"name":"project2_name.hex","url":"https://gitlab.../project2_name-9fb112c5-jkh.hex"},
{"name":"project2_name.map","url":"https://gitlab.../project2_name-9fb112c5-jkh.map"}
]
As you can see, there are 4 spaces before each “{” (I don’t know if this is a problem).
I am running GitLab Runner on Windows 10 64-bit using PowerShell console.
The problem is when I do the “release-cli” command. The error is:
time="2024-11-29T10:53:47+01:00" level=info msg="Creating Release..." catalog-publish=false cli=release-cli command=create name="Release test" project-id=2081 ref=test server-url="[https://gitlab....](https://gitlab.....)" tag-message= tag-name=test version=0.18.0
(https://gitlab..../jobs/64634#L52)time="2024-11-29T10:53:47+01:00" level=fatal msg="run app" cli=release-cli error="new CreateReleaseRequest: failed to parse assets: 1 error occurred:\n\t* invalid array of assets: \"[ {name:project1_name.elf,url:https://gitlab.../project1_name-9fb112c5-jkh.elf}, {name:project1_name.hex,url:https://gitlab.../project1_name-9fb112c5-jkh.hex}, {name:project1_name.map,url:https://gitlab.../project1_name-9fb112c5-jkh.map}, {name:project2_name.elf,url:https://gitlab.../project2_name-9fb112c5-jkh.elf}, {name:project2_name.hex,url:https://gitlab.../project2_name-9fb112c5-jkh.hex}, {name:project2_name.map,url:https://gitlab.../project2_name-9fb112c5-jkh.map} ]\" invalid character 'n' looking for beginning of object key string\n\n" version=0.18.0
(https://gitlab......./jobs/64634#L53)Cleaning up project directory and file based variables
(https://gitlab..../jobs/64634#L54)ERROR: Job failed: exit status 1
Does anyone know how to solve this problem?
I have been formatting the variable ‘assets_list.txt’ with PowerShell functions like ConvertFrom-Json and ConvertTo-Json but I can’t get it to work.
I hope someone knows how to solve it.
Thanks!
Best regards
NOTE: URLs are shortened to make them easier to read. They are correct at my site