Why would a build fail on one parallel box but not the other?


#1

In my config, you can see that I’m doing the same setup steps in parallel across three containers.

In a recent build, two of my containers failed - they couldn’t find the Rakefile, which is required to set up the database and other items.

The other container found the Rakefile just fine and ran the tests with no problem. What gives?

One caveat is that I’m doing a nonstandard thing here by tar-ing the app up and unzipping that archive to the container in my Dockerfile instead of using COPY to get all the files across (a massive timesaver). However this technique is used by countless base images on Dockerhub, with the only major difference being the source of the tar - I’m creating my own instead of using wget to retrieve one.

---
version: 2
jobs:
  build_and_test:
    machine:
      image: circleci/classic:latest
      docker_layer_caching: true

    parallelism: 3

    working_directory: ~/company

    steps:
      - checkout
      - run: rm -rf .git
      - run: chmod +x script/tar.sh && script/tar.sh
      - run: docker build . -f docker/Dockerfile --build-arg BUNDLE_GITHUB__COM="$(echo $BUNDLE_GITHUB__COM)"
      - run: docker-compose up -d && sleep 60
      - run: cd ~/company && TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
      # - run: chmod +x script/circle-post-tar.sh && script/circle-post-tar.sh
      - run: docker exec company_app_1 bash -c "bundle exec rake db:create db:migrate elastic:create RAILS_ENV=test"      
      - run:
          command: |
            docker exec company_app_1 bash -c "RUBYOPT='-W0' bin/rspec \
              --exclude 'features/**/*' \
              --deprecation-out /tmp/rspec/deprecations.txt \
              --format documentation \
              --format RspecJunitFormatter \
              --out /tmp/rspec/rspec_2.xml \
              $TEST_FILES"

workflows:
  version: 2
  build_and_test:
    jobs:
      - build_and_test