FMCorz / mdk

Moodle Development Kit. A collection of tools meant to make developers' lives easier.
GNU General Public License v3.0
85 stars 47 forks source link

Fix error handling when CI could not find branch #125

Closed FMCorz closed 8 years ago

FMCorz commented 8 years ago

Run mdk precheck without pushing the branch.

fred@fmc:~/www/sm$ mdk precheck
/usr/bin/git remote -v
/usr/bin/git config --get remote.origin.url
/usr/bin/git symbolic-ref -q HEAD
Invoking the build on the CI server...
Waiting for the build to complete, please wait...
AttributeError: 'dict' object has no attribute 'url'
  File "/home/fred/code/python/mdk/mdk/__main__.py", line 99, in main
    Runner.run(args, prog='%s %s' % (os.path.basename(sys.argv[0]), cmd))
  File "/home/fred/code/python/mdk/mdk/command.py", line 147, in run
    self.command.run(args)
  File "/home/fred/code/python/mdk/mdk/commands/precheck.py", line 102, in run
    logging.warning('Build failed, please refer to:\n  %s', infos.url)
mudrd8mz commented 8 years ago

I just experienced yet another weird behaviour with this.

I executed mdk precheck and had forgotten to push the branch to github. This led to the failed job as expected: http://integration.moodle.org/job/Precheck%20remote%20branch/21203/console

But locally I got false positive result:

mudrd8mz@glux ~/www/mdk/m29/moodle $ mdk precheck 
Invoking the build on the CI server...
Waiting for the build to complete, please wait...
Precheck passed, good work!

So I tried to execute once again. It again failed indeed http://integration.moodle.org/job/Precheck%20remote%20branch/21206/console but this time I got the error reported here:

mudrd8mz@glux ~/www/mdk/m29/moodle $ mdk precheck 
Invoking the build on the CI server...
Waiting for the build to complete, please wait...
AttributeError: 'dict' object has no attribute 'url'

Just in case it matters: When in the first case I received the false positive result, I had executed three mdk precheck in parallel, each for one branch. Two of the branches were available at github and they passed ok: http://integration.moodle.org/job/Precheck%20remote%20branch/21204/ and http://integration.moodle.org/job/Precheck%20remote%20branch/21205/. It was just the job no. 21203 that did not have the branch available and should report the error. But it did not ...

FMCorz commented 8 years ago

Fixed in d83d87d.