Skip to content

Fixes version command

Jay McCure requested to merge fix-version into master

What does this MR do and why?

Closes #683 (closed)

Tells Zeitwerk to ignore the version file to prevent the following error when running gitlab-qa --version.

❯ gitlab-qa --version
Traceback (most recent call last):
	16: from /Users/jmccure/.asdf/installs/ruby/2.7.5/bin/gitlab-qa:25:in `<main>'
	15: from /Users/jmccure/.asdf/installs/ruby/2.7.5/bin/gitlab-qa:25:in `load'
	14: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-qa-8.4.1/exe/gitlab-qa:9:in `<top (required)>'
	13: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-qa-8.4.1/lib/gitlab/qa/runner.rb:25:in `run'
	12: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-qa-8.4.1/lib/gitlab/qa/runner.rb:25:in `new'
	11: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1093:in `initialize'
	10: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-qa-8.4.1/lib/gitlab/qa/runner.rb:75:in `block in run'
	 9: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1680:in `parse'
	 8: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1691:in `parse!'
	 7: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1666:in `permute!'
	 6: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1569:in `order!'
	 5: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1575:in `parse_in_order'
	 4: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1575:in `catch'
	 3: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/2.7.0/optparse.rb:1621:in `block in parse_in_order'
	 2: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-qa-8.4.1/lib/gitlab/qa/runner.rb:50:in `block (2 levels) in run'
	 1: from /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:39:in `require'
/Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:25:in `on_file_autoloaded': expected file /Users/jmccure/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-qa-8.4.1/lib/gitlab/qa/version.rb to define constant Gitlab::QA::Version, but didn't (Zeitwerk::NameError)

An alternative solution would be to move version.rb out of lib so it isn't autoloaded.

How to set up and validate locally

After building and installing gem: gitlab-qa --version

❯ gitlab-qa -v
/Users/jmccure/.asdf/installs/ruby/2.7.5/bin/gitlab-qa : 8.4.1

From gitlab-qa dir: exe/gitlab-qa --version

❯ exe/gitlab-qa -v
exe/gitlab-qa : 8.4.1

Closes #683 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jay McCure

Merge request reports