将赛普拉斯与詹金斯集成

时间:2019-10-24 20:33:52

标签: jenkins continuous-integration jenkins-pipeline cypress

这是我在Jenkins中的配置,我创建了一个新的测试管道。我不确定配置是否正确,因为在遇到“ Cypress Run”时,构建始终会失败

Jenkins配置:

 node(label: 'FAKE_BUILDER') {
    stage('Checkout Git Repo') {
        git credentialsId: '12345',
        branch: 'master',
        url: 'https://github.com/fake'
    }
    stage('install') {
        sh label: 'NPM install', script: 'npm install'
        sh label: 'NPM start', script: 'npm start'
        sh label: 'Cypress Run', script: 'npx cypress run'
    }
}

在我的项目中,詹金斯文件:

pipeline {
    notifySparkRoomId = "Y2EK"
    buildVersion = this.env.BUILD_NUMBER
    numToKeep = this.isMasterBranch() ? 50 : 3
    services = []

    builder = "FAKE_BUILDER"

    build = {
        this.sh "./bin/install.sh"
        this.sh "./bin/cypresstestscript.sh"

        if (this.isMasterBranch() || this.isHotfixBranch()) {
          this.sh "./bin/run.sh ./bin/build.sh"
          this.sh "tar -czf fake.tar.gz -C dist ."
          this.archiveArtifacts artifacts: "fake.tar.gz", allowEmptyArchive: true
      }
    }

    junitPattern = null
    spotbugsOpts = null

    deployTo = this.isMasterBranch() || this.isHotfixBranch() ? ['integration', 'production'] : []

    integration.deployMode = this.isMasterBranch() ? 'deploy' : 'input'
    integration.postDeployTests = []
    integration.runConsumerTests = false
}

1 个答案:

答案 0 :(得分:0)

显然,您的Jenkins服务器上未安装xvfb

通过以下方式安装:

apt-get update && apt-get -y install xvfb