0

I'm struggling to make work a simple CI/CD pipeline with dependencies between stages. This is my .gitlab-ci.yml file:

image: gcc

stages:
    - build
    - test

build_app:
  stage: build
  script:
    - make
    - make install

test_app:
  stage: test
  script:
    - run app ...
  dependencies:
    - build_app

So the build stage will compile the application and install it under /usr/local/bin/. The above example will fail because the test stage does not find the executable, even when it is states as dependent on the build step (it seems it is not attached by default).

If I define /usr/local/bin/app as an artifact it will also fail, because these must be relative and child of $CI_PROJECT_DIR (reference).

So I'm now trying to do some modifications on it but I feel I do not really understand what is going on there. I finally tried to attach the file compiled (APP) in the repository directory as an artifact (without using make install), and calling that binary for testing (eg. ./APP instead of APP). This way, it works, but I feel like I had to renounce to the make install instruction, and also that there is probably a much better and straightforward way to implement this.

Is there a recommended way to perform this task?

elcortegano
  • 2,444
  • 11
  • 40
  • 58

1 Answers1

0

cache won't work either. It is restricted (though not documented) to the same limitations as artifacts.

These are both security measures since it would otherwise provide access to the entire filesystem the gitlab-ci-runner is installed.

The solution would be to install the binary in a path relative to your build directory instead of /usr/local/bin/app and use artifacts.

Stefan van Gastel
  • 4,330
  • 23
  • 25