Included env in job repeated when is run in docker

I deploy my tests environment in docker containers. So, I separated deployment into 2 parts: building docker image with all needed environment and running every tests suite in he second job test. Here is my travis file:
Travis.yml

Here is build in Travis:
https://travis-ci.com/murcraft/ProtractorGoogleTest/builds/105824144

Could anyone help me, I cannot find out why I have 2 jobs for suite1.

You have two jobs defined with env:


These belong to the default Test stage, as described in https://docs.travis-ci.com/user/build-stages/#naming-your-build-stages.

You have 2 additional jobs in


one in Build docker image, and the other in Test.

Ok, thanks. How can I have only 2 jobs in stage test? Used env “suite” should define new job, i.e.
test
1t job - env = suite1
2d job - env = suite2
But I use the same script for yhese two suites. I cannot find where I have to set env for stage test.

Drop the “test” job in jobs.include. If the script is meant to be shared by the two jobs in the “test” stage (one with suite1, and the other with suite2), then defining script at the top level will result in the configuration you want.

env:
  - suite=suite1
  - suite=suite2
script: # this will be shared by the two jobs above
  - mkdir allure-results
  ⋮
jobs:
  include:
  - stage: build docker image
    env: suite=null
    script: # this will override the `script` defined at the top level
    - echo …
  ⋮

Thanks, it works. But if I want to run the stage: build docker image firstly and after finishing this job - to run suite1 and suite2. Because my suite1 and suite2 are depended from Docker image.

Please read the document. https://docs.travis-ci.com/user/build-stages/#specifying-stage-order-and-conditions

It helps, thanks!
I deleted test from jobs and included
services:
- docker
So, this configuration works in right way:

dist: trusty
services:
- docker

stages:
- docker-build
- test

env:
- suite=suite1
- suite=suite2

script:
- mkdir allure-results
...

jobs:
include:
- stage: docker-build
env: suite=null
script:
- echo ...