Skip to content

WIP: Added custom per-job BuildsDir

What does this MR do?

Adds the ability to add a "builddir" option per-job within your .gitlab-ci.yml file

Why was this MR needed?

There are a few use cases for this. My particular issue was that I wanted to use a Docker executor with a custom per-job image that required my code and artifacts to be in different directories at each stage or job. For example, the golang:1.7.1 image sets the $GOPATH to /go/. By default, my code would be checked out in /build/ or the value that is set for builds_dir in the runner configuration. I didn't want to reconfigure my runner to use /go as the builds_dir because I intend on using the same runner for multiple jobs through the pipeline that use different images.

Are there points in the code the reviewer needs to double check?

Keep in mind that this currently affects all executors and shells, from what I understand. This may not be the best approach since there are no checks or options to push the custom build directories down the stack. It might be nice to add an option for SSH / SHELL executors to have a prepended parent directory defined in the runner configuration.

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

Merge request reports