Skip to content

Unhelpful backtrace in release jobs if an all.sh component has no supported platform #227

@gilles-peskine-arm

Description

@gilles-peskine-arm

check_every_all_sh_component_will_be_run only runs in Jenkins PR jobs, not in Jenkins release jobs (it's only called by run_pr_job in mbedtls.groovy). If you run a release job with RUN_ALL_SH enabled and where an all.sh component can't be run on any platform, you get a hard-to-understand backtrace.

This isn't a problem in day-to-day work, but it's a plausible problem if you're working on a new all.sh component that requires some additional tooling and you don't get the support_xxx function right the first time. That's how I noticed, and it took me a while to understand why my job was failing.

Example job:

Relevant part of the log:

java.lang.NullPointerException: Cannot invoke method startsWithAny() on null object
        at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:47)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at PluginClassLoader for script-security//org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:180)
        at PluginClassLoader for script-security//org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:182)
        at PluginClassLoader for workflow-cps//com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
        at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.LoggingInvoker.methodCall(LoggingInvoker.java:105)
        at gen_jobs.platform_has_docker(gen_jobs.groovy:70)
        at gen_jobs.gen_all_sh_jobs(gen_jobs.groovy:207)
        at gen_jobs.gen_release_jobs(gen_jobs.groovy:688)

The null dereference is because there's no platform for test_prepare_release. There's no way to tell the problematic component from the error trace. In this log, you can tell by digging down and seeing that test_prepare_release is listed in an “All all.sh components” line but not in any “Available all.sh components” line. Note that I added the “Available” line in my branch: in main, there's no way to tell which component is problematic from the logs (hopefully, it's the one you're working on).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsize-sEstimated task size: small (~2d)

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions