Closed bhavikbhavsar closed 4 years ago
Can you share your entire job-dsl script and let me know which version you are using please?
I am not sure about the syntax.
below is the pipeline syntax I am trying to convert to jobdsl.
#!/usr/bin/env groovy
properties([
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '1000', daysToKeepStr: '', numToKeepStr: '1000')),
pipelineTriggers(
[[
$class: 'CIBuildTrigger',
noSquash: true,
providerData: [
$class: 'ActiveMQSubscriberProviderData',
name: 'Red Hat UMB',
checks: [
[field: 'state_name', expectedValue: '^done$'],
[field: 'name', expectedValue: 'idm'],
],
overrides: [
topic: 'Consumer.rh-jenkins-ci-plugin.4dbbd20c-b315-4145-8fc3-2149be9af975.VirtualTopic.eng.mbs.>'
]
]
]]
),
parameters([
string(defaultValue: "", description: 'CI_MESSAGE', name: 'CI_MESSAGE'),
string(name: 'MESSAGE_HEADERS', defaultValue: '', description: 'MESSAGE_HEADERS'),
booleanParam(name: 'SKIP_UMB_MSG', defaultValue: false, description: 'True will cause no UMB messages.'),
booleanParam(name: 'NOTIFY_PACKAGER', defaultValue: false, description: 'Notify packager about this jenkins build.'),
booleanParam(name: 'DEBUG', defaultValue: true, description: 'Will printout debug information.'),
string(defaultValue: "ftrivino@redhat.com", description: 'Email recipients', name: 'RECIPIENTS'),
])
])
String getVersion(String stream) {
def matches = (stream =~ /el8.1/)
if (matches) {
return "RHEL8.1"
}
matches = (stream =~ /el8.2/)
if (matches) {
return "RHEL8.2"
}
matches = (stream =~ /el8.3/)
if (matches) {
return "RHEL8.3"
}
return "ERROR"
}
node() {
stage('TriggerPipeline') {
def pipeline
def rhel_version
script{
def ci_message_json = readJSON text: params.CI_MESSAGE
if ( ci_message_json.stream == 'DL1' ) {
pipeline = "ipa-server-ci-prod"
rhel_version = getVersion(ci_message_json.buildrequires.platform.stream)
}
if ( ci_message_json.stream == "client" ) {
pipeline = "ipa-client-ci-prod"
rhel_version = getVersion(ci_message_json.buildrequires.platform.stream)
}
}
print "TRIGGER: ${pipeline} ${rhel_version}"
build job: "${pipeline}/${rhel_version}",
parameters: [
[$class: 'StringParameterValue', name: 'CI_MESSAGE', value: "${params.CI_MESSAGE}" ],
[$class: 'StringParameterValue', name: 'MESSAGE_HEADERS', value: "${params.MESSAGE_HEADERS}" ],
[$class: 'BooleanParameterValue', name: 'SKIP_UMB_MSG', value: "${params.SKIP_UMB_MSG}" ],
[$class: 'BooleanParameterValue', name: 'NOTIFY_PACKAGER', value: "${params.NOTIFY_PACKAGER}" ],
[$class: 'BooleanParameterValue', name: 'DEBUG', value: "${params.DEBUG}" ],
[$class: 'StringParameterValue', name: 'RECIPIENTS', value: "${params.RECIPIENTS}" ],
],
wait: false
}
}
JOb DSL version is 1.76
I meant jms-messaging version.
but where is the snippet where you use ciBuildTrigger()
?
jms-messaging version is 1.1.2
I am using the process job dsl section in the freestyle job to create the working listener first.
ciBuildTrigger {
providers {
providerDataEnvelope {
providerData {
activeMQSubscriber {
name("Red Hat UMB")
overrides {
def uuid = "4ba56bbc-959b-11e8-b83f-54ee754ea14c"
topic("Consumer.rh-jenkins-ci-plugin.${uuid}.VirtualTopic.eng.ci.brew-build.test.complete")
}
// Message Checks
checks {
msgCheck {
field('$.artifact.type')
expectedValue("installability")
}
}
}
}
}
}
noSquash(true)
}
@scoheb any clue, if I am doing something wrongly?
Some points:
ciBuildTrigger
needs to be specified within some type of job type.Thanks @scoheb I have updated the plugin to latest version now.
And my dsl looks something like below:
job('example') {
ciBuildTrigger {
providers {
providerDataEnvelope {
providerData {
activeMQSubscriber {
name("Red Hat UMB")
overrides {
def uuid = "4ba56bbc-959b-11e8-b83f-54ee754ea14c"
topic("Consumer.rh-jenkins-ci-plugin.${uuid}.VirtualTopic.eng.ci.brew-build.test.complete")
}
// Message Checks
checks {
msgCheck {
field('$.artifact.type')
expectedValue("installability")
}
}
}
}
}
}
noSquash(true)
}
}
I still see the same error:
ERROR: (script, line 2) No signature of method: javaposse.jobdsl.dsl.jobs.FreeStyleJob.ciBuildTrigger() is applicable for argument types: (script$_run_closure1$_closure2) values: [script$_run_closure1$_closure2@3e12cf18]
Please see https://jenkinsci.github.io/job-dsl-plugin/#path/job-triggers you are missing the triggers() section
Great! it worked. Thanks @scoheb for the help
It fails with below error
I tried using the snippet shared in the readme.