lundi 4 mars 2019

rails tests not working in gitlab pipeline

After I want to test my rails code automatic after pushing it to master my test's not running.

my stage to test my code looks like this:

test_code:
  stage: test_code
  script:
    - docker pull $CONTAINER_IMAGE:test || true
    - docker build -f Dockerfile.test --cache-from $CONTAINER_IMAGE:test --tag $CONTAINER_IMAGE:test .
    - docker run --rm $CONTAINER_IMAGE:test rails db:migrate RAILS_ENV=test && rails test
    - docker push $CONTAINER_IMAGE:test

this is the output from the pipeline:

$ docker run --rm $CONTAINER_IMAGE:test rails db:migrate RAILS_ENV=test && bundle exec rails test
== 20181005152311 CreateUsers: migrating ======================================
-- create_table(:users)
   -> 0.0014s
== 20181005152311 CreateUsers: migrated (0.0014s) =============================

/bin/sh: eval: line 86: rails: not found
ERROR: Job failed: exit code 127

I don't understand why the command after the "&&" isn't recognized.

Aucun commentaire:

Enregistrer un commentaire