Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70759

What stage would serve the purpose

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Critical Critical
    • multijob-plugin
    • None

      node('maven3.6') {
                properties([
            parameters([
                string(
                    defaultValue: "",
                    description: '''Branch name to build different modules''',
                    name: 'Branchname'
                ),
           choice(
                  choices:"""development""",
                  description: '''Branch Type eg.development,feature''',
                  name: 'BranchType'
                   ),
               booleanParam(
                      defaultValue: false,
                      description: 'Build administration->admin',
                      name: 'Admin'),
            booleanParam(
                      defaultValue: false,
                      description: 'Build administration->admin-internal',
                      name: 'AdminInternal'),
            booleanParam(
                      defaultValue: false,
                      description: 'Build administration->admin-job',
                      name: 'AdminJob'),
            booleanParam(
                      defaultValue: false,
                      description: 'Build administration->admin-supplier',
                      name: 'AdminSupplier'),
            
            ]),
            buildDiscarder(
                logRotator(
                    artifactDaysToKeepStr: '',
                    artifactNumToKeepStr: '',
                    daysToKeepStr: '2',
                    numToKeepStr: '5')
            )
        ])

        stage("Trigger multiple admin jobs") {
          List Joblist = new ArrayList()

          if (params.Admin)

      {       Joblist.add("admin")     }

        

          if (params.AdminInternal)

      {       Joblist.add("admin-internal")     }

          if (params.AdminJob)

      {       Joblist.add("admin-job")     }

          if (params.AdminSupplier)

      {       Joblist.add("admin-supplier")     }

          
          echo "Job List to build : ${Joblist}"
          echo "Branch Name : ${Branchname}"

       

          if (Joblist.size() > 0) {
            if("${Branchname}"=="development"|"${Branchname}"=="master")  {
              BRANCH_TO_TAG="${Branchname}"
            } else {
              BRANCH_TO_TAG="${BranchType}/${Branchname}"
            }

       

            for (Job in Joblist) {
              echo "Building Job : ${Job}"
              catchError {
                  if ("${Job}"== "admin"|"${Job}"== "admin-job"|"${Job}"== "admin-internal"|"${Job}"== "admin-supplier") {
                      build job: "administration/$Job/${BRANCH_TO_TAG}", wait:false
                  } else {
                      build job: "$Job/${BRANCH_TO_TAG}", wait:false
                  }
              }
            }
          }
        }
      }  

      It is successfull. The above script is written to just trigger all 4 pipeline jobs in only 1 single pipeline. But what stage can be added next so that, this single pipeline waits for the other pipeline jobs selected to complete the run and show the output whether all the selected pipelines are successful or failed with what error and which job. Please provide that stage

            Unassigned Unassigned
            dj_123 Dheeraj
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: