Skip to content
Snippets Groups Projects

Include referrers data for container repository tags query

Merged Daniel Tian requested to merge 442848-add-container-registry-tag-referrers-data into master
All threads resolved!

What does this MR do and why?

On the Project -> Settings -> Deploy -> Container Registry page, we show a list of Docker container tags:

ksnip_20240506-161709

Each tag can be signed with a signature. We recently added the ability to fetch signatures in the GraphQL query. This MR actually does the fetching by sending a referrers: true variable to the GraphQL query. Note that this MR only fetches the signatures but doesn't use it; a follow-up MR will show them in the UI.

How to set up and validate locally

It's extremely involved to set up a local environment that can create the signatures and return it in the GraphQL data. You can see what the production data looks like by running this query (source project):

GraphQL query
query {
  containerRepository(id:"gid://gitlab/ContainerRepository/6340028") {
    manifest(reference: "sha256:ce9645c76a4695781d93febc2c259fe70b29c7d3bc9ad3750337e783ba1029da")
    tags(first: 100, referrers: true) {
      nodes {
        digest
        name
        referrers {
          artifactType
          digest
          
        }
      }
    }
  }
}

But locally, we will just verify that the GraphQL query is sending the referrers variable for the query rather than checking the response.

  1. On your local machine, you must set up Docker and a local GitLab runner using the docker executor.
  2. Stop your local GDK.
  3. Edit your config/gitlab.yml file. Find the top-level registry: key and change enabled: false to enabled: true:
registry:
  enabled: true
  1. Start your local GDK. Verify that the last line of output says A container registry is available at 127.0.0.1:5000.
  2. Clone this project locally: https://gitlab.com/bwill/container-signing/
  3. Check if the Settings -> Deploy -> Container Registry nav item is shown. If not, try restarting your GDK. This happens because the image is still starting up and is not ready by the time GDK has started. The registry stays running between GDK restarts.
  4. Run a pipeline against the master branch.
  5. Go to Settings -> Deploy -> Container Registry. There should be one registry shown. Click on it.
  6. A list of tags should be shown. Open DevTools and on the Network tab, verify that the getContainerRepositoryTags request is sending referrers: false:
ksnip_20240506-170630
  1. Enable the :show_container_registry_tag_signatures feature flag.
  2. Refresh the tags list page. Verify that the getContainerRepositoryTags request is sending referrers: true this time.

Related to #442848

Edited by Daniel Tian

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Daniel Tian
  • Daniel Tian
  • Daniel Tian
  • Daniel Tian
  • Daniel Tian
    • Author Developer
      Resolved by Mario Celi

      @ahuntsman Would you be able to do the initial backend review for this one? :bow: In particular, I'm concerned about this discrepancy between what production returns and what the test returns for manifest data. Since you're likely the only person who has the signature-aware container registry working locally, I was wondering if you could check to see what data is returned locally (JSON or serialized Ruby object?).

  • requested review from @ahuntsman and @lorenzvanherwaarden

  • Lorenz van Herwaarden
  • Lorenz van Herwaarden approved this merge request

    approved this merge request

    • Resolved by Mario Celi

      :wave: @lorenzvanherwaarden, thanks for approving this merge request.

      This is the first time the merge request has been approved. To ensure we don't only run predictive pipelines, and we don't break master, a new pipeline will be started shortly.

      Please wait for the pipeline to start before resolving this discussion and set auto-merge for the new pipeline. See merging a merge request for more details.

  • E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :white_check_mark: test report for 76f15ec7

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Package     | 19     | 0      | 12      | 19    | 31    | ✅     |
    | Create      | 101    | 0      | 9       | 94    | 110   | ✅     |
    | Plan        | 51     | 0      | 2       | 47    | 53    | ✅     |
    | Monitor     | 7      | 0      | 0       | 7     | 7     | ✅     |
    | Verify      | 31     | 0      | 1       | 30    | 32    | ✅     |
    | Govern      | 66     | 0      | 0       | 43    | 66    | ✅     |
    | Data Stores | 31     | 0      | 0       | 22    | 31    | ✅     |
    | Analytics   | 2      | 0      | 0       | 1     | 2     | ✅     |
    | Release     | 5      | 0      | 0       | 5     | 5     | ✅     |
    | Manage      | 0      | 0      | 1       | 0     | 1     | ➖     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 313    | 0      | 25      | 268   | 338   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+

    e2e-package-and-test: :white_check_mark: test report for 76f15ec7

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Package     | 176    | 0      | 80      | 1     | 256   | ✅     |
    | Create      | 183    | 0      | 20      | 0     | 203   | ✅     |
    | Plan        | 44     | 0      | 4       | 0     | 48    | ✅     |
    | Verify      | 10     | 0      | 0       | 0     | 10    | ✅     |
    | Data Stores | 22     | 0      | 0       | 0     | 22    | ✅     |
    | Govern      | 28     | 0      | 0       | 0     | 28    | ✅     |
    | Monitor     | 8      | 0      | 0       | 0     | 8     | ✅     |
    | Release     | 2      | 0      | 0       | 0     | 2     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 473    | 0      | 104     | 1     | 577   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
  • Aaron Huntsman requested review from @xanf

    requested review from @xanf

  • Aaron Huntsman approved this merge request

    approved this merge request

  • requested review from @mcelicalderonG

  • Illya Klymov approved this merge request

    approved this merge request

  • Illya Klymov removed review request for @xanf

    removed review request for @xanf

  • Daniel Tian added 927 commits

    added 927 commits

    Compare with previous version

  • Daniel Tian reset approvals from @xanf, @ahuntsman, and @lorenzvanherwaarden by pushing to the branch

    reset approvals from @xanf, @ahuntsman, and @lorenzvanherwaarden by pushing to the branch

  • Mario Celi approved this merge request

    approved this merge request

  • Mario Celi resolved all threads

    resolved all threads

  • Mario Celi enabled an automatic merge when all merge checks for 76f15ec7 pass

    enabled an automatic merge when all merge checks for 76f15ec7 pass

  • merged

  • Mario Celi mentioned in commit 619b74ce

    mentioned in commit 619b74ce

  • added workflowstaging label and removed workflowcanary label

  • mentioned in issue #460226 (closed)

  • resolved all threads

  • mentioned in issue #461391

  • mentioned in issue #423814 (closed)

  • Please register or sign in to reply
    Loading