Skip to content

Expose last_published_at field from the container registry

Adie (she/her) requested to merge 290949-expose-last-published-at into master

What does this MR do and why?

last_published_at is now available in the Get Repository Details Container Registry API endpoint.

We want to expose this value to the frontend via GraphQL.

query {
  containerRepository(id: "gid://gitlab/ContainerRepository/14") {
    lastPublishedAt
  }
}

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Prerequisites:

A. Check that you have the latest version of the Container Registry, or at least 3.92.0 when this new field was added to the container registry.

B. Check that your Gitlab version locally is 16.11 and later.

C. Push a tag to a container repository

D. Verify that the Gitlab API is supported:

ContainerRegistry::GitlabApiClient..supports_gitlab_api?
#=> true

Steps:

  1. In the GraphQL explorer, http://gdk.test:3000/-/graphql-explorer, give the following query. Replace 16 with the container repository ID that you have locally.
query {
  containerRepository(id: "gid://gitlab/ContainerRepository/16") {
    lastPublishedAt
  }
}
  1. For a container repository that had a tag pushed recently, lastPublishedAt would be filled up:
{
  "data": {
    "containerRepository": {
      "lastPublishedAt": "2024-04-30T06:07:36+00:00"
    }
  }
}

If the lastPublishedAt is still null, verify that you have the latest container registry and gitlab version. Push a new tag to make sure that it gets recorded by the container registry 🙏

  1. For a container repository that did not have a pushed tag, we expect lastPublishedAt to be null
{
  "data": {
    "containerRepository": {
      "lastPublishedAt": null
    }
  }
}

Related to #290949 (closed)

Edited by Adie (she/her)

Merge request reports

Loading