Skip to content

Skip container repository on import 404

Steve Abrams requested to merge 356371-import-404 into master

What does this MR do and why?

We are working on migrating all container repositories to the new container registry. The GitLab rails project is in charge of kicking off the imports by making API requests to the registry to start either the pre-import or import process.

In testing on staging, we discovered that there are cases where a repository might exist in the rails database, but not actually exist on the registry, so when rails says "hey, please import this repository", the registry says "uh...what repository" and returns a 404 Not Found.

On the rails side, when we receive a 404 Not Found we update the container repository to have an import_aborted state. The problem is, rails retries container repositories that have previously been aborted, which we don't want to happen in this case.

This MR updates the rails logic so that if we receive a 404 from the registry when making an import or pre-import request, we update the container repository to the import_skipped state, which means it will not be tried again.

This MR does not contain a changelog because the feature being fixed is behind a feature flag.

Screenshots or screen recordings

N/A

How to set up and validate locally

This is not very easy to test locally since it depends on having a registry with a metadata-database working locally and configuring a fair amount of application settings and feature flags to enable the imports. Luckily, we are spending this entire milestone testing the import functionality on staging (which is what led to this MR and its related issue being opened), so this will be tested as soon as it hits staging.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #356371 (closed)

Edited by Steve Abrams

Merge request reports