Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Function (1st gen) failing to update to use Artifact Registry

After getting all of the emails that Container Registry is going away, I'm trying to update my legacy Google Cloud Function (1st gen) to use Artifact Registry (instead of Container Registry).

I followed the instructions to use the cloud console to edit the function, go to "Security and Image Repo", change the "Image repository: Container location" to "Google managed Artifact Registry", and continued to deploy the function. However, once the function finishes deployment, when I return to the "Security and Image Repo" section, I can see that "Google Container Registry" is still selected under "Container location". (Also, under Details > Equivalent Rest, it still has "buildConfig"."dockerRegistry": "CONTAINER_REGISTRY".)

Does this mean it silently failed to update to Artifact Registry? What is wrong and how can I move my function to Artifact Registry?

I looked at the logs and do not see any errors or warnings.

I checked permissions and the service worker has full "Editor" permissions including artifact registry read/write.

I am only using Cloud Functions and Firebase and had no knowledge of Container Registry until they started sending the emails that it is going away.

1 10 944
10 REPLIES 10

That's strange. Can you try to find Artifact Registry in your GCP console and see if an image was auto-created for you? 

It'd be tough to help you debug without knowing more information about your project. I think you should also open a support ticket at the same time so we can dive into more ofyour project details if we need to

I found the Artifact Registry page and it says "No repositories to display".

Do I need to first create a repository? Or run the migration command? (I don't currently have the command line tools installed.)

No, you don't need to create the repository again. You can run the migration command directly from Google Cloud Shell where the gcloud command is already installed.

Oh, that's good to know. I also wasn't able to find much information about how the migration command will affect my cloud functions. Will they continue working exactly the same as before? Or will they have a new URL or need other changes? I'm trying to avoid any downtime for my customers.

After moving to the artifact registry, the image URL will change. You’ll need to update the image URL in Cloud Run for the new deployment revision.

i notice that if you change to Customer managed Artifact Registry, it will works but Google managed Artifact Registry does not

I tried running the migration command in Google Cloud Shell.

gcloud artifacts docker upgrade migrate --projects=##my-project-id##

It asked to create 4 separate repos for different geographic areas. I never had anything like that with my old cloud functions. And when I create brand new cloud functions (2nd gen) with default settings, they don't create multiple repos for different geographic areas. I don't want all that extra complexity in my project. I thought cloud functions were supposed to be simple! So now I don't trust the migrate command.

Instead I decided to create new (2nd gen) cloud functions and just copy over the code and settings from my old cloud functions. Then delete the old functions so I can make yet another copy using the same names as the old functions in order to get the same URLs that my applications expect. Then delete the intermediate copies. This involves an annoying amount of manual labor and a few minutes of downtime, but the new functions work fine. I wish Google just had a button to upgrade simple cloud functions like this to the latest version of their stack (or upgraded it automatically). This whole thing is such a waste of my time. But I will continue down this path unless someone can recommend a better option.

Slightly more efficient, but without upgrading to 2nd gen functions, this also worked:

  1. In the cloud console, "..." menu actions > "Copy function" to create a temporary copy
  2. Delete the original function
  3. Copy the temporary function and use the original function's name, being sure to select the "Google managed Artifact Registry" option
  4. Delete the temporary function

This has the same effect as my original goal of simply editing the function and choose "Google managed Artifact Registry". 🤜 (Which kicked off this thread because that method appears to work, but silently fails.)

Any update of this tool actually working? I am seeing the exact same behaviour when trying to migrate to the artifact registry. 

I see the same thing.  Using the console, changing Google Container Registry to Google managed Artifact Registry DOES NOT WORK!

You click Next then Deploy which builds properly, but it stays as Container Registry.  This needs to be addressed ASAP.

img.png

UPDATE:  Tried this again the next day and it DID WORK!