Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build trigger does not support Declarative syntax #149

Open
mikebonnet opened this issue Oct 17, 2019 · 5 comments
Open

Build trigger does not support Declarative syntax #149

mikebonnet opened this issue Oct 17, 2019 · 5 comments

Comments

@mikebonnet
Copy link

CIBuildTrigger only supports use via pipelineTriggers() in Scripted pipeline, not the triggers{} section of Declarative pipeline. This requires us to maintain pipelines in both formats, depending on how they're triggered. It would be great if CIBuildTrigger supported Declarative pipelines.

@scoheb
Copy link
Contributor

scoheb commented Nov 7, 2019

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

@scoheb
Copy link
Contributor

scoheb commented Nov 8, 2019

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']
                        )
                ]
        )
    }

@Michkov
Copy link
Contributor

Michkov commented Dec 6, 2019

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'.

@scoheb
Copy link
Contributor

scoheb commented Dec 6, 2019

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.

@Michkov
Copy link
Contributor

Michkov commented Dec 9, 2019

My example works after job is executed manually, that's known limitation https://issues.jenkins-ci.org/browse/JENKINS-47539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants