Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple assets without labels/filepaths causes collisions (HTTP Error 400, "Links have duplicate values") #722

Closed
JoshuaLeivers opened this issue May 21, 2024 · 3 comments
Labels

Comments

@JoshuaLeivers
Copy link

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.

@fgreinacher
Copy link
Contributor

I think this is the same error as #265, correct?

@JoshuaLeivers
Copy link
Author

I think this is the same error as #265, correct?

It may be the same root cause, yes.

@fgreinacher
Copy link
Contributor

Thanks for the feedback, I'll close this one then. Please follow along progress over there.

@fgreinacher fgreinacher closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants