一、第一个pipeline
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
stage('Deploy1') {
steps {
echo 'Deploying1....'
}
}
}
}
运行结果:
二、通过Pipeline运行多个exe程序
pipeline {
agent any
stages {
stage('Run EXE Programs1') {
steps {
bat '''
echo Running multiple EXE programs...
"C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\PipelineTestExe1\\ConsoleApp1.exe"
'''
}
}
stage('Run EXE Programs2') {
steps {
bat '''
echo Running multiple EXE programs...
"C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\PipelineTestExe2\\ConsoleApp1.exe"
'''
}
}
stage('Run EXE Programs3') {
steps {
bat '''
echo Running multiple EXE programs...
"C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\PipelineTestExe3\\ConsoleApp1.exe"
'''
}
}
}
}
运行结果:
三、通过Pipeline按序运行多个job
pipeline {
agent any
stages {
stage('Trigger Job JenkinsTest1') {
steps {
build job: 'JenkinsTest1'
}
}
stage('Trigger Job JenkinsTest2') {
steps {
build job: 'JenkinsTest2'
}
}
stage('Trigger Job JenkinsTest3') {
steps {
build job: 'JenkinsTest3'
}
}
}
}
运行结果:
四、通过Pipeline并行运行多个job
pipeline {
agent any
stages {
stage('Trigger Jobs') {
parallel {
stage('Job JenkinsTest1') {
steps {
build job: 'JenkinsTest1'
}
}
stage('Job Job JenkinsTest2') {
steps {
build job: 'JenkinsTest2'
}
}
stage('Job Job JenkinsTest3') {
steps {
build job: 'JenkinsTest3'
}
}
}
}
}
}
运行结果:
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 【Jenkins】Pipeline使用初体验
发表评论 取消回复