Skip to content

Add release `direct_asset_url` to GraphQL

Nathan Friend requested to merge nfriend-add-direct-asset-url-to-graphql into master

What does this MR do?

Adds the direct_asset_url field to the GraphQL endpoint.

Example query/response

Below is an example of a release with two asset links: one that was created with an explicit direct_asset_link (#71) and one without (#72).

Query:

{
  project(fullPath: "root/release-test") {
    releases(first: 1) {
      nodes {
        assets {
          links {
            nodes {
              id
              name
              url
              directAssetUrl
              linkType
              external
            }
          }
        }
      }
    }
  }
}

Response:

{
  "data": {
    "project": {
      "releases": {
        "nodes": [
          {
            "assets": {
              "links": {
                "nodes": [
                  {
                    "id": "gid://gitlab/Releases::Link/72",
                    "name": "An example image link",
                    "url": "https://example.com/image",
                    "directAssetUrl": "https://example.com/image",
                    "linkType": "IMAGE",
                    "external": true
                  },
                  {
                    "id": "gid://gitlab/Releases::Link/71",
                    "name": "An example runbook link",
                    "url": "https://example.com/runbook",
                    "directAssetUrl": "http://0.0.0.0:3000/root/release-test/-/releases/v5.33/permanent/path/to/runbook",
                    "linkType": "RUNBOOK",
                    "external": true
                  }
                ]
              }
            }
          }
        ]
      }
    }
  }
}

Related to #214241 (closed)

Merge request reports