【发布时间】:2018-02-22 14:53:23
【问题描述】:
这是我所拥有的:
#!/usr/bin/env groovy
pipeline {
agent none
stages {
stage('Checkout SCM') {
agent { label 'win' && 'apple' && 'rhel' }
steps {
echo "Cloning Repository"
checkout([$class: 'GitSCM',
branches: [[name: "*/develop"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'WipeWorkspace']],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'UNAME', url: 'URL']],
browser: [$class: 'BitbucketWeb', repoUrl: 'URL'],
])}}
stage('Building Win64, Linux764, MacOS') {
agent { label 'win&&rhel&&apple' }
steps {
script {
echo '************************'
echo '*****BUILDING JOBS******'
echo '************************'
sh 'python build.py'
sh 'cd ion-js && npm run prepublishOnly'
}}}
}
}
但是我得到了There are no nodes with the label ‘win && rhel && apple’ 错误。有谁碰巧知道如何运行声明式 jenkins 管道,其中一个阶段在多个代理标签上并行运行?
我想同时将同一个 git repo 签出到 3 个不同的节点。我试过agent { label 'win' && 'apple' && 'rhel' } 和agent { label 'win&&apple&&rhel' } 但它只是说找不到那个标签。
Here they say you can use || 和使用 && 应该可以工作,但我不确定我错过了什么。我可以编写 3 个不同的结帐阶段,但我认为有更好的方法
【问题讨论】:
-
我也遇到了类似的问题,你知道怎么解决吗?
标签: jenkins groovy jenkins-pipeline