1

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?

0

1 Answer 1

3

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.