OLD | NEW |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package buildbot | 5 package buildbot |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "compress/gzip" | 9 "compress/gzip" |
10 "compress/zlib" | 10 "compress/zlib" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // Get the name of the subscription on luci-config | 306 // Get the name of the subscription on luci-config |
307 settings, err := common.GetSettings(c) | 307 settings, err := common.GetSettings(c) |
308 if err != nil { | 308 if err != nil { |
309 logging.WithError(err).Errorf(c, | 309 logging.WithError(err).Errorf(c, |
310 "Cannot load settings to check subscription name.") | 310 "Cannot load settings to check subscription name.") |
311 // This is a configuration error. Tell PubSub to retry until we
fix our | 311 // This is a configuration error. Tell PubSub to retry until we
fix our |
312 // configs. | 312 // configs. |
313 return http.StatusInternalServerError | 313 return http.StatusInternalServerError |
314 } | 314 } |
315 switch msg.Subscription { | 315 switch msg.Subscription { |
316 » case settings.Buildbot.PublicTopic: | 316 » case settings.Buildbot.PublicSubscription: |
317 internal = false | 317 internal = false |
318 » case settings.Buildbot.InternalTopic: | 318 » case settings.Buildbot.InternalSubscription: |
319 // internal = true, but that's already set. | 319 // internal = true, but that's already set. |
320 default: | 320 default: |
321 logging.Errorf( | 321 logging.Errorf( |
322 c, "Subscription name %s does not match %s or %s", | 322 c, "Subscription name %s does not match %s or %s", |
323 » » » msg.Subscription, settings.Buildbot.PublicTopic, | 323 » » » msg.Subscription, settings.Buildbot.PublicSubscription, |
324 » » » settings.Buildbot.InternalTopic) | 324 » » » settings.Buildbot.InternalSubscription) |
325 // This is a configuration error. Tell PubSub to retry until we
fix our | 325 // This is a configuration error. Tell PubSub to retry until we
fix our |
326 // configs. | 326 // configs. |
327 return http.StatusInternalServerError | 327 return http.StatusInternalServerError |
328 } | 328 } |
329 logging.Infof( | 329 logging.Infof( |
330 c, "Message ID \"%s\" from subscription %s is %d bytes long", | 330 c, "Message ID \"%s\" from subscription %s is %d bytes long", |
331 msg.Message.MessageID, msg.Subscription, r.ContentLength) | 331 msg.Message.MessageID, msg.Subscription, r.ContentLength) |
332 bbMsg, err := msg.GetData() | 332 bbMsg, err := msg.GetData() |
333 if err != nil { | 333 if err != nil { |
334 logging.WithError(err).Errorf(c, "Could not base64 decode messag
e %s", err) | 334 logging.WithError(err).Errorf(c, "Could not base64 decode messag
e %s", err) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 } | 406 } |
407 if master != nil { | 407 if master != nil { |
408 code := doMaster(c, master, internal) | 408 code := doMaster(c, master, internal) |
409 if code != 0 { | 409 if code != 0 { |
410 return code | 410 return code |
411 } | 411 } |
412 } | 412 } |
413 return http.StatusOK | 413 return http.StatusOK |
414 } | 414 } |
OLD | NEW |