Reputation: 197
I am trying to integrate pipelineJob dsl into jenkins DSL(by jenkins DSL plugin).
As seen the API reference in jenkins DSL, there is argument for my purpose. pipelineJob -> scm -> git
But after generation, there is no scm view at all in the UI and I found that if I made the pure pipelineJob, there was also no UI for scm.
I tracked the pipeline plugin source and realized that pipelineJob inherited job, so I thought there should be SCM-related option like normal job.
Is there any way to achieve get the normal scm UI in pipeline job? or Do I have to achieve my purpose by groovy script only?
Jenkins job DSL below
def projects = [
'Nova',
'Keystone',
'Cinder',
'Glance',
'Horizon',
'Neutron',
'Networking-kakao',
'Neutron-fwaas',
'Neutron-lbaas',
'Octavia',
'Ceilometer',
'Heat',
'Sahara',
'Trove'
]
def codeName = 'mitaka'
def ref = 'kakao/' + codeName
projects.each {
def project = it
def jobName = 'Unit/OpenStack/' + project
project = project.toLowerCase()
pipelineJob(jobName) {
logRotator(daysToKeep = 7, numToKeep = 5)
scm {
concurrentBuild()
git {
remote {
url("https://github.com/openstack/${project}.git")
}
branch("${ref}")
extensions {
wipeOutWorkspace()
}
}
}
definition {
cps {
sandbox()
script("""
node {
stage ('Clone Sources') {
git {
remote {
url("https://github.com/openstack/${project}.git")
credentials("ccc")
}
branch("${ref}")
extensions {
wipeOutWorkspace()
}
}
git {
url 'https://github.com/openstack-tox-base.git'
branch 'rewrite'
}
sh 'cp tox-openstack-base/Dockerfile.test Dockerfile'
}
docker.withServer('tcp://...:2375') {
def img
def base = docker.image('idock.daumkakao.io/openstack/tox/test-base:newton2')
stage ('Build Test Image') {
base.pull()
img = docker.build("tox/newton/test-horizon")
}
stage ('Run Test') {
sh "docker run --rm tox/newton/test-horizon"
}
}
}
""".stripIndent())
}
}
}
}
Upvotes: 0
Views: 1360
Reputation: 8194
The Pipeline job does not support the scm
block. Unfortunately, the Job DSL API allows to use the scm
block in pipelineJob
. That is an open issue in Job DSL, see JENKINS-31832.
To load your Pipeline script from SCM, use the cpsScm
block:
pipelineJob('example') {
definition {
cpsScm {
scm {
git('https://github.com/jenkinsci/job-dsl-plugin.git')
}
}
}
}
Upvotes: 0