I have a gitlab ci configuration that I want to run locally. I can see that I can do that using gitlab-runner docker exec
in this answer: Use GitLab CI to run tests locally?. However, my gitlab configuration uses a default before_script, and when I run a job with gitlab-runner docker exec <job-id>
, the default before_script doesn't get run.
Here is an example configuration that demonstrates the issue
image: openjdk:8
default:
before_script:
- echo TEST1
- echo TEST1
- echo TEST1
- echo TEST1
test:
script:
- echo TEST3
I can get default before_script to run in the gitlab pipeline, just not locally. If I run gitlab-runner exec docker test
with this configuration, only the TEST3 gets printed. How can I get the default before_script to run?