[Solved] Keep running pipeline and start other tests

Hello!
I’ve read the multi machine docs and the new 1.0 pipelines guides, but I fail to set-up parallelization.
I basically have 3 services and one step.

    services:
      - build app
      - redis
      - apache
    steps:
      - execute tests against apache

I want to add one more machine to run my tests in parallel.
So I tried splitting things in 3 with backend (redis + apache), frontend (my npm app build), and testing with depends_on. But the apache always stops since no other tests are waiting for it. And of courseif I add a test to keep it running, the two other depends_on pipelines does not starts since they’re supposed to start when the pipeline they depend on is done.

So, is there a way to keep a service running while executing separate steps simultaneously?
Ideally a setting like the detach one but that does not ignore the exit code would be ideal! :thinking:

Here is my current working single-machine test yml:


kind: pipeline
name: cypress-end-to-end-testing

services:
  # clone and build the app
  - name: build
    image: nextcloudci/node:node-4
    commands:
      - npm ci
      - npm run build
  # redis server
  - name: redis
    image: redis

  # nextcloud server
  - name: server
    image: nextcloudci/server:server-10
    environment:
      REDIS: redis
    commands:
      # Add app sources to the app directory
      - export BRANCH=$DRONE_TARGET_BRANCH
      - echo "Testing against $BRANCH"
      - ln -s /drone/src /var/www/html/apps/viewer
      - ls -lLa /var/www/html/apps/viewer
      - mkdir /var/www/html/data
      - chown -R www-data:www-data /var/www/html

      # Check avail free space for nextcloud
      - df -h /var/www/html/data

      # Install nextcloud, watch logs and run apache
      - bash /initnc.sh

steps:
  - name: testing
    image: cypress/browsers:chrome69
    environment:
      CYPRESS_RECORD_TOKEN: 
        from_secret: cypress_record_token
      CYPRESS_baseUrl: http://server/index.php/
      LOGIN: login
    commands:
      - WAIT_ON=$CYPRESS_baseUrl$LOGIN
      - $(npm bin)/cypress install
      - $(npm bin)/wait-on -i 500 -t 300000 $WAIT_ON
      - $(npm bin)/cypress run --record --key $CYPRESS_RECORD_TOKEN --parallel

trigger:
  branch:
    - master
    - stable*

Thanks a lot!

Services are meant for long running daemons, and should not be used for parallel steps. Instead you define parallel steps using the depends_on keyword. See How to setup parallel Pipeline steps (1.0+)

For example, the build step should definitely be defined under the steps section instead of the services section.

1 Like

Thanks a lot!
I will try that and report back!

@bradrydzewski it works very nicely!
Thanks a lot!!