我是詹金斯的初学者。我有这样的代码管道结构
Repo1 -> Repo2 -> Repo3 -> Deploy
我已经通过GUI创建了这样的层次结构,但我想通过管道创建它作为代码。我想创建管道链,我克隆不同的repos并对其执行测试,然后根据当前管道发布结果继续到另一个repo。
这是我的jenkinsfile - (伪造的代码,因为它给我构建错误)
pipeline {
agent any
stages {
stage('Build Repo1') {
steps {
sh 'echo "repo1 build!"'
}
}
stage('Test Repo1') {
steps {
sh 'echo "repo success!"'
}
}
}
post {
success {
pipeline {
agent any
stages {
stage('Build Repo2') {
steps {
sh 'echo "build repo2!"'
}
}
stage('Test Repo2') {
steps {
sh 'echo "test repo2!"'
}
}
}
post {
success {
# continue to generate pipeline for repo3
echo 'This will always run'
}
failure {
echo 'This will run only if failed'
}
}
}
}
failure {
echo 'This will run only if failed'
}
unstable {
echo 'This will run only if the run was marked as unstable'
}
changed {
echo 'This will run only if the state of the Pipeline has changed'
echo 'For example, if the Pipeline was previously failing but is now successful'
}
}
}
请帮忙!