stages:
    - build
    - test
    - report


build image:
    stage: build
    before_script:
        - df
        - cat /etc/resolv.conf
        - cat /etc/hosts

    script:
        - docker build -t image-test:$CI_COMMIT_SHORT_SHA --no-cache .    
    when: manual

test run:
    stage: test
    needs: 
        - build image
    script:
        - docker run --rm
                     --name test 
                     -e MAIN_HOST=$MAIN_HOST
                     -v /data/allure-results:/app/allure-results
                     image-test:$CI_COMMIT_SHORT_SHA
    after_script:
        - docker rmi image-test:$CI_COMMIT_SHORT_SHA
    allow_failure: true

create report:
    stage: report
    needs:
        - test run
    script:
        - echo "report has been created"
