1

I wrote a pipeline script and in console output i need createhosts log output also instead of showing build number.

Script:

pipeline {
    agent none
    stages {
        stage('create hosts') {
            steps {
                echo "Hello! , This build for create VMs "
                build job: 'createhosts',
                 parameters: [
                *********
        ********* some parameters
        ]
            }

        }
        stage ('CD job ') {
            steps {
                echo "This build for configure VMs "
                build job: 'CD'
            }
        }
        stage ('Delete VMs') {
            steps {
                echo "This job is required a host file as input for approval to Delete VMs"
                input "approve for deletion"
        build job: 'delete_vms'
        }
        }
    }
}

click here for output image

m00am
  • 5,910
  • 11
  • 53
  • 69
srinivas
  • 11
  • 1
  • 2
  • If you want the log output in this build then do the work in this job, don't spawn a whole other job. – Quantic Mar 06 '18 at 22:52
  • Thanks Quantic, but that is difficult to do all that job work to here, spawn is better option to me, and I need log output here, – srinivas Mar 07 '18 at 04:38
  • 1
    I found answer, before build a job , assign into a variable, def bRun = build job: 'vsphere_createhosts', parameters: [ ****************** ], and print it using : println bRun.rawBuild.log, but I need console output while running job, not after completion , – srinivas Mar 09 '18 at 05:05
  • while running job itself I need console output real time, – srinivas Mar 13 '18 at 05:38
  • Advantage of doing it in a different job is easier to rerun the specific job if its failed. Unfortunately Jenkins pipeline doesnt have an option at this time of writing to rerun a specific stage until this is solved - https://issues.jenkins-ci.org/browse/JENKINS-33846 – Ganga Feb 26 '19 at 04:09

0 Answers0