Setting the recursive option to true when triggering the GCR cleaner server from the Pub Sub causes it to fail. I've observed this when deployed in cloud run and also replicated it running the server locally.
Resulting log message:
{"error":"failed to list child repositories for \"\": failed to fetch all repositories from registry europe-west2-docker.pkg.dev: context canceled","message":"failed to clean","severity":"ERROR","time":"2022-03-18T08:54:36Z"}
I believe this is because in the Pub Sub handler, the server.clean function is handed off to a goroutine while the original request is completed, closing the request context while server.clean is still working. However, the call to gcrremote.Catalog in cleaner.ListChildRepositories requires the context to still be open to succeed.
Setting the
recursive
option to true when triggering the GCR cleaner server from the Pub Sub causes it to fail. I've observed this when deployed in cloud run and also replicated it running the server locally.Resulting log message:
I believe this is because in the Pub Sub handler, the
server.clean
function is handed off to a goroutine while the original request is completed, closing the request context whileserver.clean
is still working. However, the call togcrremote.Catalog
incleaner.ListChildRepositories
requires the context to still be open to succeed.