在 jenkins 管道中运行 cypress 测试出现错误

时间:2021-06-10 04:10:27

标签: jenkins jenkins-pipeline cypress

在 jenkins 管道中运行以下 cypress 测试时,出现以下错误。有人可以告诉我为什么我收到错误是阶段吗?之前我在 agent 部分下使用过 Docker,但出现错误,因此删除了 docker 并添加了 agent any

 pipeline {
        agent any
        stages {
        
            stage('Checkout Reactcoding') {
                steps {
                    git branch: 'master', credentialsId: 'some-ssh-Id-here', url: 'ssh://git@github.com:<repo_name>/testcoding.git'
                }
            }
    
            stage('Run cypress') {
                steps {
                    script {
                        def baseUrlConfig="-e CYPRESS_baseUrl=http://localhost:3000/reactcoding"
                        def cypressArgs = "run --spec cypress/integration/**/*.spec.js --headless --browser chrome"
                        sh """
                        docker run ${baseUrlConfig} \
                        -e CYPRESS_BOOK_UNITS=\"10\" \
                        -e CYPRESS_BOOK_PRICE=\"15\" \
                        -e CYPRESS_BASE_URL=\"http://localhost:3000/reactcoding\" \
                        cypress:latest \
                            /node_modules/.bin/cypress ${cypressArgs}
                        """
                    }
                }
            }
          
        }
    }

enter image description here

错误:

Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
No credentials specified
 > git.exe rev-parse --resolve-git-dir C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\CypressRun\.git # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url https://github.com/testproject/reactcoding.git # timeout=10
Fetching upstream changes from https://github.com/testproject/reactcoding.git
 > git.exe --version # timeout=10
 > git --version # 'git version 2.28.0.windows.1'
 > git.exe fetch --tags --force --progress -- https://github.com/testproject/reactcoding.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
Checking out Revision dde780feae5d8b8b976ba148bc100d093a55f096 (refs/remotes/origin/master)
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f dde780feae5d8b8b976ba148bc100d093a55f096 # timeout=10
Commit message: "Updated jenkins file"
 > git.exe rev-list --no-walk f7989feb1fa35329d382ed1470db65dc803af26d # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Run cypress)
Stage "Run cypress" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:444)
    at java.lang.ProcessImpl.start(ProcessImpl.java:140)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

0 个答案:

没有答案
相关问题