Version tag parsing fails when a tag is malformed
athompson-r7 opened this issue · comments
I saw this when trying to run build version current
on a repo that had the tag help
, exception is below.
I can quickly repo this:
No tag is set
~/code/malformed-tag-test[master*]% be build version current
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/tasks/version.rb:27:in `current': undefined method `ref' for nil:NilClass (NoMethodError)
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/bin/build:4:in `<top (required)>'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bin/build:23:in `load'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bin/build:23:in `<main>'
Set initial 0.0.0 tag
~/code/malformed-tag-test[master*]% g commit --allow-empty -m 'Initial commit'
[master (root-commit) d07f51a] Initial commit
~/code/malformed-tag-test[master*]% git tag 0.0.0
~/code/malformed-tag-test[master*]% be build version current
version 0.0.0 (d07f51a8086fd707d48cbad86f480e5d53d17440)
Set some invalid tags
~/code/malformed-tag-test[master*]% git tag 0.0.1.1.1
~/code/malformed-tag-test[master*]% be build version current
version 1.1.1 (d07f51a8086fd707d48cbad86f480e5d53d17440)
~/code/malformed-tag-test[master*]% git tag this_is_not_a_version
~/code/malformed-tag-test[master*]% be build version current
/Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version.rb:61:in `from_string': Builderator::Control::Version.from_string: this_is_not_a_version is not a supported semver string (RuntimeError)
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:16:in `block in tags'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:16:in `map'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:16:in `tags'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:52:in `tags'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version.rb:34:in `current'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/lib/builderator/tasks/version.rb:27:in `current'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/builderator-1.0.0.pre.rc.12/bin/build:4:in `<top (required)>'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bin/build:23:in `load'
from /Users/athompson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bin/build:23:in `<main>'
12:41:23 /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version.rb:61:in `from_string': Builderator::Control::Version.from_string: help is not a supported semver string (RuntimeError)
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:16:in `block in tags'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:16:in `map'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:16:in `tags'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version/scm.rb:52:in `tags'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/lib/builderator/control/version.rb:34:in `current'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/lib/builderator/tasks/version.rb:27:in `current'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
12:41:23 from /home/jenkins/.rvm/gems/ruby-2.1.5@bakery-3/gems/builderator-1.0.0.pre.rc.12/bin/build:4:in `<top (required)>'
12:41:23 from /home/jenkins/workspace/image-rapid7-db7-master/bin/build:16:in `load'
12:41:23 from /home/jenkins/workspace/image-rapid7-db7-master/bin/build:16:in `<main>'