Gitlab CI: Cannot find output of build stage

For each test gitlab-ci clean the build folder, therefore the output files of the build stage are not available in the deploy stage.

You need to rebuild your project also in the deploy stage.

The "stages" are only useful to order your tests, i.e. avoid to try to do a deploy test if a build test failed.

EDIT: Since Gitlab 8.6, it is possible using dependencies feature


I was surprised to see the same behaviour (on GitLab 8.4).

I use cmake to create makefiles, then make to build, and then make test to run the test. I run all these in a build/ directory.

I don't want to repeat myself and identify easily which steps are failing. As such, I've created different gitlab-ci stages: cmake, make, test, etc. I then tell gitlab-ci to keep the build directory using the cache option:

cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true
    paths:
        - build/

I think that the key option will keep the same build directory for all stages acting on the same branch. See the gitlab-ci doc here: http://doc.gitlab.com/ce/ci/yaml/README.html#cache

EDIT: Don't use the cache for this! GitLab implemented reusable artifacts between stages in 8.4: https://gitlab.com/gitlab-org/gitlab-ce/issues/3423 The CI runners will have to be adapted to support this. See: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/336