Handle 404 on pre-import API calls
🔥 Problem
When we call the Container Registry API to start the pre-import, we could end up in a situation where the image repository exists on the rails backend but not on the container registry. There are a few reasons why a repository may exist on Rails but not on the registry:
- A user requested an auth token for the repository (which is when records are created on the Rails side) but never pushed anything to it (so it wasn't created on the registry side);
- All repository data has been deleted on the registry (without using the "delete repository" operation on the Rails side).
In those cases, a 404
will be raised.
Currently, in rails, a 404
will not be handled properly: the related migration will get aborted.
🚒 Solution
- Handle the possible
404
from the pre-import API call- Bonus: handle it for the import API call too. Although, this case should not happen (the pre-import call went well but the import call is
404
)
- Bonus: handle it for the import API call too. Although, this case should not happen (the pre-import call went well but the import call is
- Skip the migration with
skip_reason: :not_found
Edited by João Pereira