Hello everyone,

I've been setting up a new Jenkins 2.8 with JobDSL 1.47.
I looked up and adhered to all change notes, and when it comes to a 
"conditional Steps" build step, I'm encountering the following error:

fileExists(projectName+'/target/windows/test/tests.exe', BaseDir.WORKSPACE)

-->     No such property: BaseDir for class: 
javaposse.jobdsl.dsl.helpers.step.RunConditionContext<https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/RunConditionContext.groovy>

I remember encountering this with JobDSL version 1.34 already - my workaround 
was to import javaposse.jobdsl.dsl.helpers.step.RunConditionContext.BaseDir in 
the JobDSL file directly. If I do this now, I get the following error, which 
seems to make this a deadlocked situation:



        Script1.groovy: 1: unable to resolve class 
javaposse.jobdsl.dsl.helpers.step.RunConditionContext.BaseDir

I am using a Groovy script to do set up a tailored environment for the JobDSL 
file (binding). It usually works perfectly. I've been trying a dozen things 
today to circumvent the above condition, including

-       Direct import of j.j.d.h.s.*, j.j.d.h.s.RunConditionContext, 
j.j.d.h.s.RunConditionContext.BaseDir

-       Indirect import of the Enum type (see below)

-       The above steps with the former, deprecated classpath (it was 
redirected, the error remained)

-       Searching for the class on the system in order to add it as classpath 
(didn't find any on the system oO)

-       Using filesMatch() instead of fileExists() (same error)

-       Using FQN

-       ...

The most helpful, but also the most confusing output came when I imported 
javaposse.jobdsl.dsl.helpers.step.RunConditionContext.BaseDir into the 
top-level Groovy script, and then passed BaseDir.WORKSPACE in as an environment 
variable:

No signature of method: 
javaposse.jobdsl.dsl.helpers.step.ConditionalStepsContext.fileExists() is 
applicable for argument types: (java.lang.String, 
javaposse.jobdsl.dsl.helpers.step.RunConditionContext$BaseDir) values: 
[myProject/target/windows/test/tests.exe, WORKSPACE]

But this is exactly what fileExists() is defined to work with! I'm starting to 
think it must be something more basic, and I just didn't see it. Or a bug.

Can anyone help?

Thanks,
Jennifer




Code snippet:

Closure jobClosure = {
    steps {
        conditionalSteps {
            condition {
                fileExists(projectName+'/target/windows/test/tests.exe', 
BaseDir.WORKSPACE)
            }
            runner('Fail')
            steps {
                batchFile(...)
            }
        }
    }
}

return jobClosure


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAA587D532C45541B62417404F1D22030E88272E%40you-exch1.younicos.local.
For more options, visit https://groups.google.com/d/optout.

Reply via email to