I am trying to read the sent notifications from Google Cloud Container Registry after an image has been altered using the Pub/Sub service but I am unable to make it work. I have followed the steps described here: https://cloud.google.com/container-registry/docs/configuring-notifications
- I created the subscription
foo
for the topicprojects/[PROJECT-ID]/topics/gcr
(this topic already existed) and gave the permissions to the service account I created the following script in ruby taken from the doc to test the subscription:
require 'google/cloud/pubsub' pubsub = Google::Cloud::Pubsub.new( project_id: '[PROJECT-ID]', credentials: 'my-credentials.json' ) sub = pubsub.subscription 'foo' subscriber = sub.listen do |received_message| puts received_message.message.data received_message.acknowledge! end subscriber.start sleep
After that, I published a message within in the Google Cloud Console and the content is actually printed, so, the subscription seems to work fine.
The problem is that if I a push an image to the Google Cloud Container Registry, the image is available in the console as well, but I did not receive any message.
The only thing that might be slightly different is that I am pushing the the image using the regular docker
command instead of gcloud docker
(I previously logged in into the registry using the credentials), but I assume that's not the problem.