jenkinsci / templating-engine-plugin

create tool-agnostic, templated pipelines to be shared by multiple teams

Home Page:https://jenkinsci.github.io/templating-engine-plugin/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Upgrade to 2.5 error Could not determine pipeline template.

gdisanto opened this issue · comments

Jenkins Version

2.319.3

JTE Version

2.5

Bug Description

After upgrading to JTE 2.5 I am getting the following error when starting a pipeline:

java.lang.Exception: Could not determine pipeline template.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at org.boozallen.plugins.jte.init.PipelineTemplateResolver.resolve(PipelineTemplateResolver.groovy:79)
at org.boozallen.plugins.jte.init.PipelineTemplateResolver$resolve.call(Unknown Source)
at org.boozallen.plugins.jte.job.TemplateFlowDefinition.create(TemplateFlowDefinition.groovy:79)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310)
at hudson.model.ResourceController.execute(ResourceController.java:99)
at hudson.model.Executor.run(Executor.java:432)
Finished: FAILURE

My pipeline is configured ad folder level and the Jenkinsfile is inside repository with different pipelines definitions, each one of them in its own folder.

Relevant log output

No response

Steps to Reproduce

Update JTE to 2.5 and start a new pipeline.

could you please help with a MVCE by providing:

  • a public repository with the minimal content to reproduce the issue (folder structure, templates, repo pipeline config, etc)
  • any pipeline configurations inherited by the job running

With JTE 2.5 - multibranching configurations, i leave jenkinsfile field so I wanna get it from governance tier
image
With JTE 2.3 - multibranching configurations
image

Governance configuration
image
image

Result running JTE 2.5
image

Result running JTE 2.3
image

My pipeline_configuration.groovy on governance tier you can see result above, it's not show sequence merge.

jte {
    allow_scm_jenkinsfile = false
}
@merge libraries{
    sonarqube
}

With JTE 2.5 i see with two option define jenkinsfile and pipeline_configuration.groovy. actually, it's not working with multibranching. i have tried JTE 2.3 so it's working with governance tier ( load libraries, inherit pipeline_configuration_groovy ).

I think with JTE 2.5 with something wrong, includes :
1 - step determine jenkinsfile & pipeline_configuration.groovy in source repository. ( I cant put empty string for scenario get template from governance tier )
2 - I cant load libraries from governance tier
3 - I cant use merge block when configuration merge from pipeline_configuration.groovy in source project.

Hopefully help, pls author clarify to me how to use options Pipeline Template Path & Pipeline Configuration Path ?

I think I have the same issue described by @songhanpoo.
It is trying to load the JenkinsFile from the project repository instead of the pipeline repository configured at folder level.

I am not sure but it looks like the new version introduced two new parameters at task level:

jte-2 5-build-configuration-bug

I do not recall "Pipeline Template Path" and "Pipeline Configuration Path". Even If I try to delete the values they keep coming back after I save.

that makes sense.

If you want to ignore a Jenkinsfile in the source code repository, you can set:

jte{
  allow_scm_jenkinsfile = false
}

in the governance tier's pipeline configuration.


this is definitely less than intuitive though.

i'll add some documentation to the help text for those input fields.

it might be possible to post a message in the jenkins UI disabling that field if jte.allow_scm_jenkinsfile == false but no promises on that part :)

actually i'll just make both of those fields hidden by a checkbox that asks if you want to define them.

That's right I did it, so I got an issue with didn't find Jenkinsfile in repository.
do I need Jenkinfile as empty content ?

no you should not need a Jenkinsfile as empty content.

I have updated to 2.5.1 and I am not getting the exception anymore.