Reputation: 566
I have created a pipeline to run a series of jobs that deploy my application to a sandbox environment automatically. My configuration of .gitlab-ci.yml
is:
stages:
- pull
- build
pull-code-job:
stage: deploy
script:
- cd /usr/share/nginx/html
- git pull http://myuser:[email protected]/user/my-app.git master
build-code-job:
stage: deploy
script:
- npm install
- npm run alpha
When I view the pipelines log, I always find that they have failed:
Unknown option: -c
I no call git -c
.
My version os GitLab CE is 12.0.3 and the version of git that use runners is 1.7.1.
Upvotes: 1
Views: 1728
Reputation: 7705
For every job that you define, the code associated with the pipeline will always be fetched or cloned into the job environment before any of your script, before_script, or after_script sections are run. If you job should be running against the code in the repository, you don't have to git clone
or git pull
at all; it will happen automatically for you. The output you're seeing in the job is from this automatic fetch.
If you need to, you can disable the automatic fetch using the GIT_STRATEGY
variable set to none:
pull-code-job:
stage: deploy
variables:
GIT_STRATEGY: none
script:
- cd /usr/share/nginx/html
- git pull http://myuser:[email protected]/user/my-app.git master
For this job, the repository will not be fetched/cloned from Gitlab. This is useful if you have another job in your pipeline that pulls down your code, then builds an artifact like npm dependencies, compiled binaries from the source code, etc.
Since you're using the shell
executor, the job is running directly on the host the runner is on (as opposed to within a Docker container). Looking at the git usage
output, there doesn't appear to be a -c
option for that git version. Try upgrading git
on the host where your gitlab-runner
ALPHA is running and run your pipeline again.
Upvotes: 1