Open mikebonnet opened 4 years ago
Seems the snippet generator may be broken, it displays:
no public field ‘providerList’ (or getter method) found in class com.redhat.jenkins.plugins.ci.CIBuildTrigger
The declarative snippet generator is broken for the plugin with triggers. But this works:
triggers {
ciBuildTrigger(noSquash: false,
providerList: [
activeMQSubscriber(name: "Red Hat UMB Stage",
overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.494a9965465867b680567fc807007b23.VirtualTopic.eng.ci.example.durable.test.494a9965465867b680567fc807007b23']
)
]
)
}
Does not work for me:
pipeline {
agent {node {label 'master'}}
triggers {
ciBuildTrigger(noSquash: false,
providerList: [
activeMQSubscriber(name: "Red Hat UMB",
overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.494ae965465867b680567fc807007b23.VirtualTopic.eng.ci.example.durable.test.494a9965465867b680567fc807007b23'],
selector: "CI_NAME = 'test-trigger'",
)
]
)
}
stages {
stage('test'){
steps {
script {
sh 'env'
}
}
}
}
}
In log:
Dec 06, 2019 12:33:10 PM INFO com.redhat.jenkins.plugins.ci.ProjectChangeListener onUpdated
No CIBuildTrigger found, forcing thread stop.
Dec 06, 2019 12:33:10 PM INFO com.redhat.jenkins.plugins.ci.CIBuildTrigger stopTriggerThreads
Removed thread lock for 'pipeline-test-message'.
Here is an example of what is known to work:
ciBuildTrigger {
providers {
providerDataEnvelope {
providerData {
activeMQSubscriber {
name("Red Hat UMB")
overrides {
def uuid = "4ba46bbc-949b-11e8-b83f-54ee754ea14c"
topic("Consumer.rh-jenkins-ci-plugin.${uuid}.VirtualTopic.eng.ci.redhat-container-image.pipeline.running")
}
// Message Checks
checks {
msgCheck {
field('$.artifact.type')
expectedValue("cvp")
}
}
}
}
}
}
noSquash(true)
}
}
Unfortunately the Pipeline or Job DSL Snippet Generator does not produce this currently.
My example works after job is executed manually, that's known limitation https://issues.jenkins-ci.org/browse/JENKINS-47539
CIBuildTrigger
only supports use viapipelineTriggers()
in Scripted pipeline, not thetriggers{}
section of Declarative pipeline. This requires us to maintain pipelines in both formats, depending on how they're triggered. It would be great ifCIBuildTrigger
supported Declarative pipelines.