Python CI CD Help!

Dear All
i am beginner in gitlab cicd.
i need help for create CI for my sample python app.
i install gitlab and gitlab runner as Docker Container on server.
i push app.py and test.py on gitlab repository.
how i create gitlab-ci.yml for run pipeline??
please explain step by step because iam beginner in gitlab.
thanks.

The Gitlab documentation helps here: Get started with GitLab CI/CD | GitLab it even gives you a tutorial for your first pipeline.

There’s plenty of google results on that topic as well, one other which I’ve found: GitLab CI/CD: 3 Quick Tutorials

thanks for your respond !
i read all example
but i need sample python gitlab-ci code.
all example only used echo command in all stages!
i need how install python on my gitlab-runner (container gitlab-runner) for execute script with python command!

i want run this gitlab-ci code on my runner (as shell executor on my runner container) :

Blockquote

before_script:

  • apt install python:3.6-slim
  • python -V
    stages:
  • test
    test_job:
    stage: test
    script:
    • echo “Running tests”
    • python -m unittest discover -s “./tests/”

i want only ci part (for build and test) not cd.

@farhad8463

The docs include an example of how to output python tests into the junit.xml format so you can see a Test Report for the pipeline.

Searching Google for python test gitlab ci cd also returns plenty of good examples like this video.

I hope this helps!

-James H, GitLab Product Manager, Analyze:Product Analytics

2 Likes

Thanks for your respond.
but i have question about gitlab runner !
should i use docker executer or shell executer for run this sample cicd?

@farhad8463

I’m using the SaaS Runners and it looks the docker executor is being used.

-James H, GitLab Product Manager, Analyze:Product Analytics

1 Like

thanks for your respond and your help :pray::pray:
but after run my ci pipeline i face with this error :
Cloning repository…
fatal: repository ‘xxxx.xxxx.xx’ does not exist
ERROR: Job failed: exit code 1
FATAL: exit code 1
could you please help me again for this new issue ?

@farhad8463

Will you post a sanitized copy of your .gitlab-ci.yml in a code block? that’ll be the easiest way to assist with any further troubleshooting.

-James H, GitLab Product Manager, Analyze:Product Analytics

1 Like

This is to thank you for devoting your time to answering my questions and helping me to increase my knowledge on this matter.
my issue related to DNS resolve! after add extra_hosts =“” in config.toml , my problem has been solved!

1 Like