Ruby tools a pipeline runs
Why so many tools are Ruby
A pipeline is a list of commands, and several of the commands it runs are
Ruby programs. That is why a Ruby job on a CI
runner is often not about Rails at all: the runner installs Ruby because
one of the tools needs it.
The four below appear in real pipelines often enough to recognise:
- Fastlane builds and releases mobile apps; it is the usual way an iOS or Android release runs from CI.
- Jekyll builds static sites from Markdown, so its build step is a Ruby command.
- Chef configures servers; its recipes are Ruby code and its chef-client runs on the machine being configured.
- Vagrant starts development virtual machines from a Vagrantfile, which is Ruby.
The same list explains why a container image for a build job sometimes carries Ruby even when the project is not Ruby: the tool that builds the artifact is.
Ask RubyGems what is current
The gem command can query the index without installing anything. The --exact flag keeps the answer to one gem:
gem list --remote --exact fastlane
fastlane (2.241.2)
gem list --remote --exact jekyll
jekyll (4.4.1)
That is a useful first step when a pipeline pins a tool version: the number on the remote is what a new install would pick today, and the difference from the pin is the reason a build changed without a commit.
What each one does in a pipeline
Fastlane runs a lane, a named sequence of build and upload steps, and
the pipeline calls it as one command. Jekyll builds the site into a
folder that the deploy step copies. Chef runs at the end of a deploy to
put the machine into the declared state. Vagrant is a developer tool; it
rarely runs in a pipeline, but a pipeline that tests it needs a
hypervisor.
Each tool is a gem, so each one arrives the same way as minitest or rake.
The difference is what a failure means: a failed Jekyll build is a broken
page, a failed Chef run is a half-configured server, and both are worth
stopping the pipeline for.
What to watch for
Pin the version of a tool that runs in the pipeline. Fastlane in
particular changes its output and its lanes often, and an unpinned tool
turns a green release into a red one without a line of your code
changing.
Install the tool in the job that needs it, not in the project bundle,
unless the project really depends on it. A linter belongs in the Gemfile;
a deployment tool usually does not.
Next: A pipeline for a CLI gem
Article author: Arthur Isaev