简体   繁体   中英

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

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: xxx-compute@developer.gserviceaccount.com
    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.

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:

ie

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM