Reputation: 974
I am trying to set up continuous integration on a gitlab repository.
I have added the following gitlab-ci.yml
file:
stages:
- test
test:
image: python:3.7
script:
- python -v
tags:
- python
On gitlab, in settings->CI / CD, I have followed the instructions in 'Set up a specific Runner manually'. During the step 'please enter the executor:', I entered 'shell'.
When I try to commit the above yml
file, the runner starts running, although it then gives the following error message:
Running with gitlab-runner 11.9.2 (fa86510e)
on wsf-1102 HUx_zvP8
Using Shell executor...
Running on WSF-1102...
DEPRECATION: this GitLab server doesn't support refspecs, gitlab-runner 12.0 will no longer work with this version of GitLab
Fetching changes...
Clean repository
From [my_repo]
e327c9f..2f0e41f [my_branch]-> origin/[my_branch]
Checking out 2f0e41f1 as [my_branch]...
Skipping Git submodules setup
$ python -v
'python' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Job failed: exit status 9009
How should I properly write the yml
file, so that I can use python
as a command to later run a test.py
file?
Upvotes: 1
Views: 2861
Reputation: 5717
the problem is not in the runner is inside your docker image. inside the runner context, you don't have python installed to confirm this first test that python is properly installed in your terminal path. then, start with shell executer only for debugging before using and docker image
try to run this command
gitlab-runner exec shell test
on this simple .gitlab-ci.yml (put the file inside your git repo folder )
stages:
- test
test:
script:
- python -v
then try to work with the python image when you want to use this image you need to specify you want to run with docker runner after you test the above cases run again on your local machine
gitlab-runner exec docker test
if you still dosent figure it out try following this guide https://substrakt.com/journal/how-to-debug-gitlab-ci-builds-locally/
Upvotes: 3