Description
When providing an asset without a label or filepath specified, it seemingly always uses the name "release" with the relative URL of "undefined". This means that if multiple assets do not have a label/filepath, they will collide, and the GitLab API will return a HTTP 400 (Bad Request) with the following error:
HTTPError: Response code 400 (Validation failed: Links have duplicate values (release) for #<Release:0x**************> scope, Links have duplicate values (https://gitlab.***/api/v4/projects/NAMESPACE%2FPROJECT/packages/generic/release/VERSION/undefined) for #<Release:**************> scope)
The body of the HTTP request involved looks something like this:
{
"tag_name": "VERSION",
"description": "DESCRIPTION",
"assets": {
"links": [
{
"name": "release",
"url": "https://gitlab.***/api/v4/projects/NAMESPACE%2FPROJECT/packages/generic/release/VERSION/undefined",
"link_type":"package"
},
{
"name": "metadata.json",
"url": "https://gitlab.***/api/v4/projects/NAMESPACE%2FPROJECT/packages/generic/release/VERSION/metadata.json",
"link_type": "package",
"filepath":"/modules/PROJECT/metadata.json"
},
{
"name": "source.json",
"url":"https://gitlab.***/api/v4/projects/NAMESPACE%2FPROJECT/packages/generic/release/VERSION/source.json",
"link_type": "package",
"filepath": "/modules/PROJECT/VERSION/source.json"
},
{
"name": "PROJECT-VERSION.tar.gz",
"url": "https://gitlab.***/api/v4/projects/NAMESPACE%2FPROJECT/packages/generic/release/VERSION/PROJECT-VERSION.tar.gz",
"link_type": "package",
"filepath":"/src.tar.gz"
},
{
"name": "MODULE.bazel",
"url": "https://gitlab.***/api/v4/projects/NAMESPACE%2FPROJECT/packages/generic/release/VERSION/MODULE.bazel",
"link_type": "package",
"filepath":"/modules/PROJECT/VERSION/MODULE.bazel"
},
{
"name": "release",
"url": "https://gitlab.***/api/v4/projects/NAMESPACE%2FPROJECT/packages/generic/release/VERSION/undefined",
"link_type": "package"
}
]
}
}
Most of the above are unrelated, but the two assets with the name "release" are of note. The relevant config is specified here - note the icon.svg
and dist/**/*
assets which do not have labels nor filepaths and are the only assets not accounted for correctly in the above error.
I am unsure if just specifying a label or a filepath will fix this - as a temporary workaround, we have specified both in later versions of the config. However, there does appear to be an issue here.