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

Unable to configure office365connector plugin using DSL configure for flow-definition #206

Closed
Aaqib041 opened this issue Apr 22, 2020 · 3 comments

Comments

@Aaqib041
Copy link

Hi ,

I am creating jenkins jobs using DSL , so as part of it I want to configure office365connector plugin.
I tried to follow documentation which shows configure example , but I am creating pipeline jobs using DSL , so xml generated is flow-definition type and configure block is not working for same . I am sharing the code snippet and error below . Kindly check and help.

Code Snippet :

projects.collect { app ->

app.services.collect { job ->
       
    println "${job.name}"
    pipelineJob("${app.project}/${job.name}-dev") {
        configure { 'flow-definition' ->
                    flow-definition / 'properties' << 'jenkins.plugins.office365connector.WebhookJobProperty' {
                    webhooks {
                        'jenkins.plugins.office365connector.Webhook' {
                            name("${job.name}-notify")
                            url('https://outlook.office.com/webhook/ea7992fc28e-b5c4-58ad7')
                            startNotification(false)
                            notifySuccess(true)
                            notifyAborted(false)
                            notifyNotBuilt(false)
                            notifyUnstable(true)
                            notifyFailure(true)
                            notifyBackToNormal(true)
                            notifyRepeatedFailure(false)
                            timeout(30000)
                            macros(class: 'empty-list')
                            factDefinitions(class: 'empty-list')
                        }
                    }
                }
            }
        definition {
            logRotator {
                artifactDaysToKeep(30)
                artifactNumToKeep(10)
                daysToKeep(30)
                numToKeep(10)
            }
            triggers {
                pollSCM {
                    scmpoll_spec("")
                    ignorePostCommitHooks(false)
                }   
            }
            throttleConcurrentBuilds {
                throttleDisabled(true)
            }
       }
    }
}

}

Error :

ERROR: startup failed:
devBuild.groovy: 18: expecting '}', found '->' @ line 18, column 43.
configure { 'flow-definition' ->
^

1 error

XML File :

XML starts with

@damianszczepanik
Copy link
Member

I don't have experience with this but based on the error this is problem with syntax, not

@SivaVasipalli
Copy link
Contributor

@Aaqib041 i was able to get this with small change below

configure { project ->
project / 'properties' << 'jenkins.plugins.office365connector.WebhookJobProperty' {
webhooks {
'jenkins.plugins.office365connector.Webhook' {
name("${job.name}-notify")
url('https://outlook.office.com/webhook/ea7992fc28e-b5c4-58ad7')
startNotification(false)
notifySuccess(true)
notifyAborted(false)
notifyNotBuilt(false)
notifyUnstable(true)
notifyFailure(true)
notifyBackToNormal(true)
notifyRepeatedFailure(false)
timeout(30000)
macros(class: 'empty-list')
factDefinitions(class: 'empty-list')
}
}
}
}

@damianszczepanik
Copy link
Member

Worth to update README file? Can you prepare PR with that ?

SivaVasipalli pushed a commit to SivaVasipalli/office-365-connector-plugin that referenced this issue Oct 11, 2023
Unable to configure office365connector plugin using DSL configure for flow-definition jenkinsci#206
damianszczepanik pushed a commit that referenced this issue Oct 11, 2023
Unable to configure office365connector plugin using DSL configure for flow-definition #206

Co-authored-by: Siva Vasipalli (Contractor) <vasipalli.siva@merative.com>
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