jenkinsci / ontrack-plugin

ontrack plug-in for Jenkins
https://plugins.jenkins.io/ontrack/
MIT License
9 stars 6 forks source link

ontrack trigger is not available in pipeline #44

Closed chrisLeeTW closed 6 years ago

chrisLeeTW commented 6 years ago

hello,

Thanks for this amazing project & jenkins plugin integrations.

Recently we try to setup auto trigger build with jenkins & ontrack.

But we found out that ontrack trigger is not available in pipeline configuration GUI.

2018-04-08 9 04 11

jenkins version = 2.114 ontrack plugin version = 2.32.4

dcoraboeuf commented 6 years ago

Hi,

Thanks for using Ontrack ! Are the other elements (builders, publishers) available?

Thanks, Damien.

dcoraboeuf commented 6 years ago

Hi,

I've run a pristine 2.114 version of Jenkins and the Ontrack plugin on top of it, and I do have the trigger available in the GUI:

image

Do you have any kind of exception or message in the general configuration of Jenkins which might indicate an issue ?

Thanks, Damien

chrisLeeTW commented 6 years ago

Hello, @dcoraboeuf

Do you have any kind of exception or message in the general configuration of Jenkins which might indicate an issue ?

actually no exception or message in the general configuration

And may I asked that which job type did you test ? free-style or pipeline ? pipeline is one that have no trigger available. free-style is working perfectly.

Thanks, Chris

dcoraboeuf commented 6 years ago

Indeed, I only tested the free style job. I'll have a look later for the pipeline one.

Best regards, Damien

dcoraboeuf commented 6 years ago

The trigger does not appear in the pipeline job. I'm having a look at the code.

dcoraboeuf commented 6 years ago

I've tried to enable the trigger for any kind of job, but this does not seem to be enough for a pipeline. I'll need to go deeper into the documentation. Probably not today. In the meantime, my code is available on the feature/44-pipeline-trigger branch if you want to have a look.

dcoraboeuf commented 6 years ago

Hi,

This is now fixed on the branch. I'll proceed to a release later this week. In the meantime, you can always build the branch locally and deploy it yourself.

Damien.

chrisLeeTW commented 6 years ago

Hello @dcoraboeuf ,

Thanks for your great work. I already confirm that ontrack trigger is working perfectly in pipeline jobs with branch feature/44-pipeline-trigger 👍

dcoraboeuf commented 6 years ago

Thanks for testing @chrisLeeTW, it saves time. I'll do an official release asap.

dcoraboeuf commented 6 years ago

Released in 2.32.5

DavidCADanneels commented 5 years ago

@dcoraboeuf: We are using version 2.32.5 of the Ontrack plugin (on Jenkins 2.164.3 / DSL 1.74) in combination with Ontrack 2.35.2

When using the construct:

pipeline {
    agent none
    triggers {
        ontrackTrigger spec: 'H 22 * * *', project: 'MY_PROJECT', branch: 'MY_BRANCH', promotion: 'COPPER', parameterName: 'VERSION'
    }

we get the error:

WorkflowScript: 14: Invalid trigger type "ontrackTrigger". Valid trigger types: [upstream, cron, snapshotDependencies, githubPush, pollSCM] @ line 14, column 9.
           ontrackTrigger spec: 'H 22 * * *', project: 'MY_PROJECT', branch: 'MY_BRANCH', promotion: 'COPPER', parameterName: 'VERSION'
           ^

1 error

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
    at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
    at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
    at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
    at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
    at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:126)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:320)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

Is there still something missing in this version of the Ontrack Plugin, or do we need a more recent version of Ontrack itself?

Note: The Jenkins Plugin Manager should version 3.4.1 as latest version of the Ontrack Plugin (suggestion to upgrade), but I'm not sure if this is compatible with the current version of Ontrack itself. Are there certain version dependencies between the Ontrack Plugin and Ontrack itself?

DavidCADanneels commented 5 years ago

After upgrading to Ontrack Trigger 3.4.1, the ontrackTrigger works, but I'm still not sure about the compatibility with Ontrack itself (at version 2.32.2)

DavidCADanneels commented 5 years ago

@dcoraboeuf FYI: the upgrade from version 2.32.2 to 3.4.1 required the addition of one parameter (ontrackVersionCacheExpirationSeconds) to the OntrackConfiguration.configure() method.

dcoraboeuf commented 5 years ago

Hi @DavidCADanneels , sorry for the delay in answering. Could please open a new ticket instead of commenting on an old one? You can always refer to this ticket from your new one. Thanks.

DavidCADanneels commented 5 years ago

My issue is resolved by upgrading to version 3.4.1. I just wanted to share the migration steps, in case other customers have questions about this. I thought you mentioned that the ontrackTrigger was fixed in version 2.35.2, but this seems not the case. My issue was only resolved after the upgrade to 3.4.1