Very weird let’s say around 1 out of 4 times I get this error message:
build_dev: Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
I noticed you did not create your secrets with --pull-request which means the secret is not available to pull requests. Have you considered this as a possible root cause for the error?
Sorry, I am only aware of three possible root causes for failing to pull an image:
missing or invalid secret
secret not available to pull request events
dockerconfig.json file has multiple gcr entries and one is invalid
I recommend making sure you are running the latest version of Drone server (drone/drone:1.8.0) and the latest version of the Docker runner (drone/drone-runner-docker:1.3.0).