Skip to content

Commit

Permalink
* Fixing casting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Joerg Flade committed Apr 30, 2020
1 parent 1e59c71 commit c01d784
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/examples/jenkins-jobdsl-jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"jobDescription": "This is a test job",
"pipelineScriptPath": "Jenkinsfile.groovy",
"cronTrigger": "2 H * * *",
"view": "myview",
"remoteTriggerUuid": "618f1dae-9475-41c3-9d17-381ff3c8684e",
"git": {
"repositoryId": "myPipelineJobId",
Expand Down
12 changes: 6 additions & 6 deletions src/parser/Json2ModelParser.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ final class Json2ModelParser {
}
// check the models and add the view if it is not empty
if (baseJobDslPipelineModelList != null && ! baseJobDslPipelineModelList.isEmpty()) {
baseJobDslPipelineModelList.each { jobModel ->
if (jobModel.getView()?.trim() && jobModel.getJobName()?.trim()) {
if (viewMap.containsKey(jobModel.getView())) {
viewMap.get(jobModel.getView()).add(jobModel.getJobName())
for (def jobModel : baseJobDslPipelineModelList) {
if (jobModel.view?.trim() && jobModel.jobName?.trim()) {
if (viewMap.containsKey(jobModel.view)) {
viewMap.get(jobModel.view).add(jobModel.jobName)
} else {
List<String> jobNameList = new ArrayList<>()
jobNameList.add(jobModel.getJobName())
viewMap.put(jobModel.getView(), jobNameList)
jobNameList.add(jobModel.jobName)
viewMap.put(jobModel.view, jobNameList)
}
}
}
Expand Down

0 comments on commit c01d784

Please sign in to comment.