Bundle: command not found when save cucumber report

Hi all, I’m following the document https://circleci.com/docs/2.0/collect-test-data/#cucumber but the build failed due to error:

/bin/bash: line 1: bundle: command not found

This is my config.yml

version: 2.1
jobs:
  build-and-test:
    docker:
      - image: cimg/openjdk:11.0
    steps:
      # Checkout the code as the first step.
      - checkout
      # Use mvn clean and package as the standard maven build phase
      - run:
          name: Build and clean
          command: mvn -B -DskipTests clean package
      # Then run your tests!
      - run:
          name: run tests
          command: mvn test
      - run:
          name: Save test results
          command: |
            mkdir -p ~/cucumber
            bundle exec cucumber --format pretty --format json --out ~/cucumber/tests.cucumber
          when: always
      - store_test_results:
          path: ~/cucumber
      - store_artifacts:
          path: ~/cucumber

workflows:
  sample: 
    jobs:
      - build-and-test

Hi @Kili – great question here!

I think the snippet from the docs you provided is expecting the build to be on one of our Ruby convenience images, which has Bundler installed by default.

Since you are using the openjdk image you’ll just need to install Bundler, you can do this with the following command:

      - run:
          name: Install Bundler
          command: |
            sudo apt update
            sudo apt install bundler

Hope that helps!

-Nick