Code Monkey home page Code Monkey logo

buildbot-slack's Introduction

Hi there ๐Ÿ‘‹, my name is Norman!

I am a fullstack developper who specializes in Golang, Python and React. I love unusual but simple solutions for complex problems. Below are my primary technical skills:

  • Golang: web API's, websockets, gopacket for DPI
  • Python: asyncio, aiohttp, C-API, django, pytest
  • Frontend: React
  • Databases: Postgresql, Oracle, MongoDB
  • Git, Docker, CI/CD (on Drone and Github), Unix-like scripting, Documentation (Hugo, Sphinx, Dinosaurus)

Here are some of the things that I want to learn (or learn further) in 2023:

  • ๐Ÿค” Rust
  • ๐ŸŒฑ Svelte

buildbot-slack's People

Contributors

blag avatar oprs avatar rockwelln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

buildbot-slack's Issues

Cannot start master after added service with treq-20.9.0

master.cfg

ssp = reporters.SlackStatusPush(
    endpoint="https://hooks.slack.com/services/*******************************")
c['services'].append(ssp)

twistd.log

2020-11-09 22:30:38+0800 [-] Loading buildbot.tac...
2020-11-09 22:30:39+0800 [-] Loaded.
2020-11-09 22:30:39+0800 [-] twistd 20.3.0 (/usr/bin/python3.6 3.6.8) starting up.
2020-11-09 22:30:39+0800 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2020-11-09 22:30:39+0800 [-] Starting BuildMaster -- buildbot.version: 2.8.4
2020-11-09 22:30:39+0800 [-] Loading configuration from '/home/buildbot/master/master.cfg'
2020-11-09 22:30:39+0800 [-] Setting up database with URL 'sqlite:/state.sqlite'
2020-11-09 22:30:39+0800 [-] setting database journal mode to 'wal'
2020-11-09 22:30:39+0800 [-] adding 2 new services, removing 0
2020-11-09 22:30:39+0800 [-] while starting BuildMaster
        Traceback (most recent call last):
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
            result = g.send(result)
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 145, in getService
            yield instance.setServiceParent(parent)
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
            return _cancellableInlineCallbacks(gen)
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
            _inlineCallbacks(None, g, status)
        --- <exception caught here> ---
          File "/usr/local/lib/python3.6/site-packages/buildbot/master.py", line 302, in startService
            yield self.reconfigServiceWithBuildbotConfig(self.config)
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 49, in reconfigServiceWithBuildbotConfig
            yield svc.reconfigServiceWithBuildbotConfig(new_config)
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 498, in reconfigServiceWithBuildbotConfig
            yield defer.maybeDeferred(child.setServiceParent, self)
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 62, in setServiceParent
            yield self.parent.addService(self)
          File "/usr/local/lib/python3.6/site-packages/buildbot/reporters/http.py", line 50, in startService
            yield super().startService()
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 232, in startService
            yield self.configureService()
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 221, in reconfigServiceWithSibling
            **kwargs)
          File "/usr/local/lib/python3.6/site-packages/buildbot_slack/reporter.py", line 85, in reconfigService
            verify=self.verify,
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 145, in getService
            yield instance.setServiceParent(parent)
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
            result = g.send(result)
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 62, in setServiceParent
            yield self.parent.addService(self)
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/service.py", line 117, in addService
            return service.startService()
          File "/usr/local/lib/python3.6/site-packages/buildbot/util/httpclientservice.py", line 130, in startService
            classname=self.__class__.__name__))
        builtins.ImportError: HTTPClientService requires either txrequest or treq install. Users should call HTTPClientService.checkAvailable() during checkConfig() to properly alert the user.

2020-11-09 22:30:39+0800 [-] BuildMaster startup failed
2020-11-09 22:30:39+0800 [-] Initiating clean shutdown
2020-11-09 22:30:39+0800 [-] No running jobs, starting shutdown immediately
2020-11-09 22:30:39+0800 [-] Main loop terminated.
2020-11-09 22:30:39+0800 [-] Server Shut Down.
2020-11-09 22:30:39+0800 [-] Unhandled error in Deferred:
2020-11-09 22:30:39+0800 [-] Unhandled Error
        Traceback (most recent call last):
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 460, in callback
            self._startRunCallbacks(result)
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
            self._runCallbacks()
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 1475, in gotResult
            _inlineCallbacks(r, g, status)
        --- <exception caught here> ---
          File "/usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
            result = g.send(result)
          File "/usr/local/lib/python3.6/site-packages/buildbot/master.py", line 344, in stopService
            yield super().stopService()
        twisted.internet.defer.FirstError: FirstError[#0, [Failure instance: Traceback: <class 'twisted.internet.defer.FirstError'>: FirstError[#0, [Failure instance: Traceback: <class 'AttributeError'>: 'SlackStatusPush' object has no attribute '_buildCompleteConsumer'
        /usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py:1613:unwindGenerator
        /usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py:1529:_cancellableInlineCallbacks
        /usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py:1418:_inlineCallbacks
        /usr/local/lib/python3.6/site-packages/buildbot/util/service.py:99:stopService
        --- <exception caught here> ---
        /usr/local/lib64/python3.6/site-packages/twisted/internet/defer.py:151:maybeDeferred
        /usr/local/lib/python3.6/site-packages/buildbot/reporters/http.py:62:stopService
        ]]
        --- <exception caught here> ---
        /usr/local/lib/python3.6/site-packages/buildbot/util/service.py:102:stopService
        ]]

Triggered builds don't send status

Hey and congrats for the new plugin - it's proven useful to me and my team.

When a build is triggered via commits (e.g. SingleBranchScheduler) the reporter works fine. However, when it is triggered via a buildstep (Trigger) that uses a Triggerable Scheduler, the notification doesn't happen.

My first assumption is that this is due to that HttpStatusPushBase on buildbot's behalf is not running the getBuildDetailsAndSendMessage in the first place. If you're up to it and have a debugging environment setup up, it would be nice to validate this and propagate to buildbot if necessary.

module 'buildbot.reporters' has no attribute 'SlackStatusPush'

I added to my master.cfg, like in ReadMe - getting error:

Python 3.7.3
Buildbot 2.5.1

    c['services'].append(reporters.SlackStatusPush(
builtins.AttributeError: module 'buildbot.reporters' has no attribute 'SlackStatusPush'

Configuration Errors:
  error while parsing config file: module 'buildbot.reporters' has no attribute 'SlackStatusPush' (traceback in logfile)

EDIT:

I have changed import to following:

from buildbot.reporters import reporter

I copied file reporter.py to buildbot/reporters/.

Config is fine, parsing. Restarting buildmaster, getting error in twisted.log following:

2020-01-24 09:03:28+0100 [-] BuildMaster startup failed 2020-01-24 09:03:28+0100 [-] Initiating clean shutdown 2020-01-24 09:03:28+0100 [-] No running jobs, starting shutdown immediately 2020-01-24 09:03:28+0100 [-] Main loop terminated. 2020-01-24 09:03:28+0100 [-] Server Shut Down. 2020-01-24 09:03:28+0100 [-] Unhandled error in Deferred: 2020-01-24 09:03:28+0100 [-] Unhandled Error Traceback (most recent call last): File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 460, in callback self._startRunCallbacks(result) File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks self._runCallbacks() File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1475, in gotResult _inlineCallbacks(r, g, status) --- <exception caught here> --- File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks result = g.send(result) File "/usr/local/lib/python3.7/dist-packages/buildbot-2.5.1-py3.7.egg/buildbot/master.py", line 339, in stopService yield super().stopService() twisted.internet.defer.FirstError: FirstError[#0, [Failure instance: Traceback: <class 'twisted.internet.defer.FirstError'>: FirstError[#0, [Failure instance: Traceback: <class 'AttributeError'>: 'SlackStatusPush' object has no attribute '_buildCompleteConsumer' /usr/lib/python3/dist-packages/twisted/internet/defer.py:1613:unwindGenerator /usr/lib/python3/dist-packages/twisted/internet/defer.py:1529:_cancellableInlineCallbacks /usr/lib/python3/dist-packages/twisted/internet/defer.py:1418:_inlineCallbacks /usr/local/lib/python3.7/dist-packages/buildbot-2.5.1-py3.7.egg/buildbot/util/service.py:99:stopService --- <exception caught here> --- /usr/lib/python3/dist-packages/twisted/internet/defer.py:151:maybeDeferred /usr/local/lib/python3.7/dist-packages/buildbot-2.5.1-py3.7.egg/buildbot/reporters/http.py:62:stopService ]] --- <exception caught here> --- /usr/local/lib/python3.7/dist-packages/buildbot-2.5.1-py3.7.egg/buildbot/util/service.py:102:stopService ]]

Error while parsing config file: 'str' object has no attribute 'error' (traceback in logfile)

Hi,

There is an error due to the use of the attribute "error" which doesn't exist for a string in reporter.py at these lines:

        if not isinstance(endpoint, str):
            endpoint.error("endpoint must be a string")
        elif not endpoint.startswith("http"):
            endpoint.error('endpoint should start with "http..."')
        if channel and not isinstance(channel, str):
            channel.error("channel must be a string")
        if username and not isinstance(username, str):
            username.error("username must be a string")
        if host_url and not isinstance(host_url, str):  # deprecated
            host_url.error("host_url must be a string")

This create the following error when I launch buildbot:

buildbot_1  | error while parsing config file:
buildbot_1  | Traceback (most recent call last):
buildbot_1  |   File "/usr/lib/python3.6/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred
buildbot_1  |     result = f(*args, **kw)
buildbot_1  |   File "/usr/lib/python3.6/site-packages/buildbot/scripts/upgrade_master.py", line 128, in upgradeMaster
buildbot_1  |     master_cfg = base.loadConfig(config, configFile)
buildbot_1  |   File "/usr/lib/python3.6/site-packages/buildbot/scripts/base.py", line 112, in loadConfig
buildbot_1  |     config['basedir'], configFileName).loadConfig()
buildbot_1  |   File "/usr/lib/python3.6/site-packages/buildbot/config.py", line 166, in loadConfig
buildbot_1  |     self.basedir, self.configFileName)
buildbot_1  | --- <exception caught here> ---
buildbot_1  |   File "/usr/lib/python3.6/site-packages/buildbot/config.py", line 128, in loadConfigDict
buildbot_1  |     execfile(filename, localDict)
buildbot_1  |   File "/usr/lib/python3.6/site-packages/twisted/python/compat.py", line 247, in execfile
buildbot_1  |     exec(code, globals, locals)
buildbot_1  |   File "/var/lib/buildbot/master.cfg", line 256, in <module>
buildbot_1  |     endpoint=os.environ.get("SLACK_WEBHOOK_URL", ""),
buildbot_1  |   File "/usr/lib/python3.6/site-packages/buildbot/util/service.py", line 180, in __init__
buildbot_1  |     self.checkConfig(*args, **kwargs)
buildbot_1  |   File "/usr/lib/python3.6/site-packages/buildbot_slack/reporter.py", line 46, in checkConfig
buildbot_1  |     endpoint.error('endpoint should start with "http..."')
buildbot_1  | builtins.AttributeError: 'str' object has no attribute 'error'
buildbot_1  | 
buildbot_1  | checking basedir
buildbot_1  | checking for running master
buildbot_1  | checking master.cfg
buildbot_1  | Errors loading configuration:
buildbot_1  |   error while parsing config file: 'str' object has no attribute 'error' (traceback in logfile)
buildbot_1  | Can't upgrade master yet. Waiting for database ready?

I am using buildbot with docker and I installed it in the container with pip3 install buildbot-slack

Please add dependency of treq or txrequests

Thanks for this plug and play buildbot plugin.

Could you add a line about installing either treq or txrequests in your readme?

I followed the installation steps and it wouldn't run.

I ended up with treq. That seems to be the most actively maintained of the two packages.

Might it make sense to contribute this reporter to buildbot core?

It looks like there were a number of stabs at adding Slack reporters to buildbot, but they stalled on making sure they had testing. Would it make sense to contribute this reporter to buildbot core?

One feature that would probably helpful (at least for me) is to allow this reporter to respect builder tags, and that might be appropriate to do when updating for #13

The undocumented HttpStatusPushBase class has been deprecated in buildbot > 2.x

Python version: 3.6.8
Buildbot version: 3.1.0
Twisted version: 21.2.0

Looking at https://github.com/buildbot/buildbot/blob/master/master/docs/relnotes/2.x.rst we can see this:

The undocumented HttpStatusPushBase class has been deprecated. Please use ReporterBase directly.

The send method of the reporters based on HttpStatusPushBase has been deprecated. This affects only users who implemented custom reporters that directly or indirectly derive HttpStatusPushBase. Please use sendMessage as the replacement. The following reporters have been affected:

HttpStatusPush
BitbucketStatusPush
BitbucketServerStatusPush
BitbucketServerCoreAPIStatusPush
GerritVerifyStatusPush
GitHubStatusPush
GitLabStatusPush
HipChatStatusPush
ZulipStatusPush

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.