Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
281 views
in Technique[技术] by (71.8m points)

python - File not found error in jenkinsfile script

Can anyone explain why I get the following error : + python unittests.py python: can't open file 'unittests.py': [Errno 2] No such file or directory

This is my jenkinsfile:

pipeline {
agent any
stages {
    stage('prepare') {
         steps {
            git credentialsId: 'git-cred', url: 'https://github.com/nada809/DockerProject.git'
        }
    }
    stage('Test') {
        agent {
            docker {
                 image 'python:3.8-slim-buster'
            }
        }
        steps {
            
             sh 'pip install flask && pip install xmlrunner'
             dir("app"){
             sh 'python unittests.py'}
        }
        
    }
   
        
        
    }
}

And this is my project structure: enter image description here

the unittests file is under app folder. Thanks in advance.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

"main" seems to be your new default branch (which is empty). Please try to

  1. merge your "master" branch into "main" or
  2. set your "master" branch as your default again or
  3. define "master" explicitly in your git step

Fyi: seems like GitHub did apply their recent plan to get rid off "master" branches


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...