Use get() instead of the deprecated getInstance() to access to the jenkins singleton.
This commit is contained in:
parent
eeec309fd7
commit
3b70bfc602
|
@ -21,7 +21,7 @@ pipeline {
|
||||||
stage('walking projects') {
|
stage('walking projects') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
Jenkins.getInstance().getAllItems(TopLevelItem.class).each { p ->
|
Jenkins.get().getAllItems(TopLevelItem.class).each { p ->
|
||||||
projects2artifacts[p.name] = []
|
projects2artifacts[p.name] = []
|
||||||
p.getAllJobs().each { j -> projects2artifacts[p.name] << j.name; artifacts2projects[j.name] = p.name }
|
p.getAllJobs().each { j -> projects2artifacts[p.name] << j.name; artifacts2projects[j.name] = p.name }
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
// get all the maven modules and their dependencies
|
// get all the maven modules and their dependencies
|
||||||
Jenkins.getInstance().getAllItems(hudson.maven.MavenModule.class).each { m ->
|
Jenkins.get().getAllItems(hudson.maven.MavenModule.class).each { m ->
|
||||||
modules2deps[m.name] = []
|
modules2deps[m.name] = []
|
||||||
m.getDependencies().each { d -> modules2deps[m.name] << "${d.groupId}:${d.artifactId}" }
|
m.getDependencies().each { d -> modules2deps[m.name] << "${d.groupId}:${d.artifactId}" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,7 @@ Given a Jenkins project P:
|
||||||
* [Pipeline: Maven](https://plugins.jenkins.io/pipeline-maven)
|
* [Pipeline: Maven](https://plugins.jenkins.io/pipeline-maven)
|
||||||
* [Pipeline: Basic Steps](https://plugins.jenkins.io/workflow-basic-steps)
|
* [Pipeline: Basic Steps](https://plugins.jenkins.io/workflow-basic-steps)
|
||||||
* [Pipeline: Dependency Walker](https://plugins.jenkins.io/pipeline-dependency-walker/)
|
* [Pipeline: Dependency Walker](https://plugins.jenkins.io/pipeline-dependency-walker/)
|
||||||
* [NodeLabelParameter](https://plugins.jenkins.io/nodelabelparameter) (to allow to dynamically select the node on which a job should be executed)
|
|
||||||
|
## Documentation
|
||||||
|
* [jenkins.model.Jenkins](https://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html)
|
||||||
|
* [jenkins.model.ItemGroup](https://javadoc.jenkins-ci.org/hudson/model/ItemGroup.html)
|
Loading…
Reference in New Issue