Pipeline configuration for Ruby on Rails?

What commans should I use to run rspec test in pipeline?

If I use documenation example:

 - step:
script: # Modify the commands below to build and test your repository.
 - ruby --version
- bundler --version
- bundle install

I have an error: + + ruby --version bash: ruby: command not foundruby --version bash: ruby: command not found

+ ruby --version bash: ruby: command not found

by: command not fMound

 Maybe there is more working example?


4 answers

1 accepted

1 vote
Accepted answer

The issue here is that you're not using an image with the required dependencies for your project.

There are a few ways you could approach this.

The first is to run a command as part of your build that downloads the dependencies using apt-get (or another appropriate package manager).

The other option is to build your own docker image (either from scratch or by extending the existing ruby image), publish it to dockerhub and then use the image you pushed. Documentation for this can be found here https://docs.docker.com/engine/tutorials/dockerimages/

Are you using the right image?


# You can use a Docker image from Docker Hub or your own container registry
image: ruby:2.3.1


Thanks with 'image' option ruby is working.

Now rails need JS runtime. 

+ bundle exec rspec
bundler: failed to load command: rspec (/usr/local/bundle/bin/rspec)
Bundler::GemRequireError: There was an error while trying to load the gem 'coffee-rails'.
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.

Often I use nodejs localy. Could I add nodejs support? Or somehow set up js runtime?

Can you share how you have solved this one?

Any resolution?

I just added the following to my script section and it solves the problem

apt-get update && apt-get install -y build-essential nodejs

Image already added

Like 1 person likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,916 views 7 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you