-
Notifications
You must be signed in to change notification settings - Fork 394
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
Error when declaring type of script #499
Comments
Quoting some code here:
...but that's from a class that extends
|
FWIW, I don't usually bother with this -- I just declare it as This is because to import |
@UlrichEckhardt here is where I read about it before #413 (comment) And to your second question: PipelineUtils utils = new PipelineUtils(this) then this is of type CpsScript. |
@nre-ableton welcome back to the topic 😄 I've been using JenkinsPipelineUnit for a while now to test and prototype my shared libraries. Still a wonderful framework! Anyway, I have to agree with @larakiba , if the mocked objects were actually of type But of course you are right, maintaining the Jenkins plugins as dependencies is a certain effort, but I still like to do it to develop exactly based on the plugin classes. If you are interested, this is what my plugins {
id 'groovy'
}
repositories {
mavenCentral()
maven {
url "https://repo.jenkins-ci.org/releases/"
}
maven {
url "https://repo.jenkins-ci.org/public/"
}
}
dependencies {
implementation "org.jenkins-ci.main:jenkins-war:2.303.2"
implementation 'com.cloudbees:groovy-cps:1.24'
implementation 'org.jenkins-ci.main:jenkins-core:2.317@jar'
implementation "org.jenkins-ci.plugins:branch-api:2.7.0@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-api:2.47@jar"
implementation "org.jenkins-ci.plugins:scm-api:2.6.5@jar"
implementation "org.jenkins-ci.plugins:cloudbees-folder:6.16@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-api:2.47@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.21@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-support:3.8@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-multibranch:2.26@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.21@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-cps:2.94@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.24@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.40@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-cps:2.94@jar"
implementation "org.jenkins-ci.plugins.workflow:workflow-job:2.42@jar"
implementation "org.jenkins-ci.plugins:sidebar-link:1.12.1@jar"
implementation 'org.codehaus.groovy:groovy-all:3.0.5'
implementation 'org.jenkins-ci.plugins:git:4.8.2@jar'
testImplementation "com.lesfurets:jenkins-pipeline-unit:1.10"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
sourceSets {
main {
groovy {
srcDirs = ['src']
}
}
test {
groovy {
srcDirs = ['test/groovy']
}
}
}
test {
useJUnitPlatform()
}
|
I've got a question related to initiating the type of the script variable.
I want to use the correct types so I can use auto completion and type checking. I've seen someone else asking this question (#413 (comment)) and wanted to ask if there is really no way to achieve that.
This works:
but as soon as I declare that script is of type CpsScript:
I get the following error:
The text was updated successfully, but these errors were encountered: