bud*_*ano 5 groovy jenkins jenkins-pipeline
我有一个詹金斯工作,有一个包含以下命令的 shell 步骤。运行得很棒!
sudo yum install python36
virtualenv -p python3 test
source test/bin/activate
<some other command>
Run Code Online (Sandbox Code Playgroud)
现在我想把它变成一个管道。我如何在 groovy 中编写相同的内容?我尝试使用这样的语法但失败了:
stage('Test') {
steps {
sh 'sudo yum install python36'
sh 'virtualenv -p python3 test'
}
}
Run Code Online (Sandbox Code Playgroud)
为了执行多个 shell 命令,您需要将它们括在一对三个单引号中''':
stage('Test') {
steps {
sh '''
sudo yum install python36
virtualenv -p python3 test
'''
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6270 次 |
| 最近记录: |