【发布时间】:2021-11-27 03:12:46
【问题描述】:
我正在尝试将管道配置为在每个 PR 到 dev 分支上运行自动化 e2e 测试。
为此,我正在拉动项目,构建它,当我想运行我的测试时,我不能这样做,因为当项目运行时,管道不会切换到第二阶段。
问题是当我在 Jenkins 中构建项目并运行时,如何强制我的测试运行?
我尝试了并行阶段执行,但它也不起作用,因为我的测试在项目开始构建时开始运行。
我的管道:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Cloning..'
git branch: 'dev', url: 'https://github.com/...'
echo 'Building..'
sh 'npm install'
sh 'npm run dev'
}
}
stage('e2e Test') {
steps {
echo 'Cloning..'
git branch: 'cypress-tests', url: 'https://github.com/...'
echo 'Testing..'
sh 'cd cypress-e2e'
sh 'npm install'
sh 'npm run dev'
}
}
}
}
【问题讨论】:
-
“e2e 测试”阶段无法运行的唯一原因是“构建”阶段出现异常或错误。你能分享管道的控制台输出吗?
标签: jenkins jenkins-pipeline devops pipeline