Page MenuHomePhabricator

Define a CI entry point for Ruby code
Closed, ResolvedPublic

Description

For the ruby projects, we are using bundler to ship the dependency and then have a job per target to execute a single command (ex: bundle exec cucumber).

For other languages, we defined entry points invoked by Jenkins jobs, that let the developers define whatever command they want to run. Ex:

LanguageCommand
PHPcomposer test
JavaScriptnpm test
Pythontox

For python we are using tox and it is being made generic with T103251

They key points are:

  • let devs define the commands that are run by Jenkins
  • reduce the number of jobs triggered per change, and hence the number of VM consume by Continuous-Integration-Scaling

This task is about defining an entry point for ruby projects. I think rake would make much sense. We do not have RVM, so to run the job against different version of ruby we will need to generate different jobs tied to the different distribution we have that each comes with different rubies (i.e. Precise is 1.9.3, Trusty has 2.0 and Jessie 2.1 IIRC).

Doc:
https://www.mediawiki.org/wiki/Continuous_integration/Entry_points

@dduvall and @zeljkofilipin Can we reach an agreement as to what is going to be the entry point for ruby? (hint: rake).

Event Timeline

hashar created this task.Jun 26 2015, 8:52 PM
hashar raised the priority of this task from to Needs Triage.
hashar updated the task description. (Show Details)
hashar added subscribers: hashar, dduvall, zeljkofilipin and 2 others.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 26 2015, 8:52 PM
hashar triaged this task as Normal priority.Jun 29 2015, 9:51 AM
hashar set Security to None.

@hashar, rake sounds good to me. @dduvall, what do you think?

hashar added a comment.Jul 6 2015, 8:43 AM

From a 1/1 with Zeljko, Dan and Zeljko will look at it during the Wikimania hackathon.

hashar updated the task description. (Show Details)Jul 6 2015, 8:44 AM
Krinkle removed a subscriber: Krinkle.Jul 6 2015, 8:25 PM

@dduvall and I talked about this yesterday. @dduvall, could you please document the conclusions here?

We will also need the ruby entry point to be documented at https://www.mediawiki.org/wiki/Continuous_integration/Entry_points#Ruby and add related JJB job templates :)

What is the status of this task, now that Wikimania 2015 is over? Did this hacking project take place and was successfully finished? If yes: Please provide an update and potentially summarize findings / provide a link to anything relevant (and if the task is not completely finished yet, please move the project to the "Work continues after Mexico City" column on the #Wikimania-Hackathon-2015 workboard). If no: Please edit this task by removing the #Wikimania-Hackathon-2015 project from this task. Thanks for your help and keeping this task updated!

hashar added a comment.EditedJul 24 2015, 8:56 AM

From a discussion between @dduvall and @zeljkofilipin during the Mexico hackathon, introducing rake as an entry point would cause developers to learn yet another tool.

Instead Dan suggested to move to make which is pretty standard and let developers reuse whatever they want as the actual ruby runner.

That also leverage the possibilities to migrate all the other entry points such as npm/tox/composer to be unified as simply make test.

A potential issue is we still need to pass some specific settings for caching packages. Something to investigate later on.

Another possibility would be to reuse the npm entry point to run the ruby commands. So in npm package.json we could add a grunt task to run bundle exec rubocop.

That is similar to a proposal I made back in February to generate documentations and having a single entry point make docs. We will probably want to write a short RFC to have agreement from all devs.

A message to all open tasks related to the #Wikimania-Hackathon-2015. What do you need to complete this task? Do you need support from the Wikimedia Foundation to push it forward? Help promoting this project? Finding an intern to work on it? Organizing a developer sprint? Pitching it to WMF teams? Applying for a grant? If you need support, share your request at T107423: Evaluate which projects showcased at the Wikimania Hackathon 2015 should be supported further or contact me personally. Thank you!

hashar lowered the priority of this task from Normal to Low.Sep 16 2015, 10:18 AM
hashar removed a project: Wikimania-Hackathon-2015.

@Qgil being discussed in the Release-Engineering-Team team by @dduvall and @zeljkofilipin . No strong agreement yet and it is not that much of a priority for us right now.

hashar raised the priority of this task from Low to High.Oct 6 2015, 2:10 PM
hashar added a comment.Oct 6 2015, 3:27 PM

From our weekly triages, we can use rake. Dan proposed to namespace the entry point with a ci:: prefix to let us split local / CI tests.

So we would end up with something like:

rake test
rake ci::test

Note, it is possible to detect whether rake test is running in Jenkins by looking at a Jenkins environment variable. tox looks for JENKINS_URL.

Qgil removed a subscriber: Qgil.Oct 6 2015, 5:28 PM
zeljkofilipin renamed this task from Define an entry point for ruby material to Define an CI entry point for Ruby code.Oct 8 2015, 8:55 PM
zeljkofilipin renamed this task from Define an CI entry point for Ruby code to Define a CI entry point for Ruby code.

Change 246194 had a related patch set uploaded (by Hashar):
Run various commands via rake in the bundler env

https://gerrit.wikimedia.org/r/246194

We gave it a try on mediawiki/vagrant and that seems to play well.

I proposed a similar change to mediawiki/selenium https://gerrit.wikimedia.org/r/246253 . The Rakefile has:

# pre-flight
require 'rubygems'
require 'bundler/setup'

require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:rubocop)
YARD::Rake::YardocTask.new(:yard)

task default: [:test]

desc 'Run all build/tests commands (CI entry point)'
task test: [:rubocop, :spec, :yard]

desc 'Generate all documentations'
task doc: [:yard]

Doc:

$ rake -T
rake doc                   # Generate all documentations
rake rubocop               # Run RuboCop
rake rubocop:auto_correct  # Auto-correct RuboCop offenses
rake spec                  # Run RSpec code examples
rake test                  # Run all build/tests commands (CI entry point)
rake yard                  # Generate YARD Documentation
hashar closed this task as Resolved.Oct 27 2015, 1:08 PM

{done} see above for reference implementation that has been applied to mediawiki/vagrant with https://gerrit.wikimedia.org/r/#/c/246194/

I have updated the wiki https://www.mediawiki.org/w/index.php?title=Continuous_integration/Entry_points&diff=1923617&oldid=1922704

Change 246194 merged by jenkins-bot:
Run various commands via rake in the bundler env

https://gerrit.wikimedia.org/r/246194