source repository does not work to publish messages on pub/sub

233 Views Asked by At

I've followed below link in order to integrate my repository to pubsub. https://cloud.google.com/source-repositories/docs/quickstart-adding-pubsub-notifications#before-you-begin

However, my repository does not work to publish pubsub messages. This is the description of my repository:

$ gcloud beta source repos describe test
name: projects/[my-project-id]/repos/test
pubsubConfigs:
  projects/[my-project-id]/topics/test:
    messageFormat: JSON
    serviceAccountEmail: [email protected]
    topic: projects/[my-project-id]/topics/test
size: '2425'
url: https://source.developers.google.com/p/[my-project-id]/r/test

The topic 'test' has a subscription named 'test-subscription'.

$ gcloud pubsub subscriptions describe test-subscription
ackDeadlineSeconds: 10
expirationPolicy:
  ttl: 2678400s
messageRetentionDuration: 604800s
name: projects/[my-project-id]/subscriptions/test-subscription
pushConfig: {}
topic: projects/[my-project-id]/topics/test

So I tried to pull messages after pushing new changes. But, there is no messages from source repository. What's the problem with me? What can I do more? Please help me.

2

There are 2 best solutions below

0
On BEST ANSWER

I replicated your scenario and it worked for me, it could have been a transient issue. When you followed it, it appeared to be in Beta state.

This was the tutorial I followed, although, the only difference was that I used the gcloud commands without the "beta" argument:

i.e.

gcloud source repos update hello-world --add-topic=csr-test

Instead of

gcloud beta source repos update hello-world --add-topic=csr-test

Here is a reference for the PubSubConfig Rest API

0
On

I ran into the same issue trying to verify that a cloud source repository published change to a topic. The problem was I needed the full name of the subscription in the pull command:

gcloud pubsub subscriptions pull projects/[my-project-id]/subscriptions/test-subscription

The documentation uses only the base ID of test-subscription but that doesn't seem to be reliable.