<% import com.github.goldin.plugins.jenkins.* import com.github.goldin.plugins.jenkins.beans.* import com.github.goldin.plugins.jenkins.Job.* import com.github.goldin.plugins.jenkins.Job.JobType String jobLink ( String jobId ) { assert jenkinsUrl && jobId "$jobId" } String tableRow ( String title, String value, boolean code = false, boolean quotes = false ) { final valueQuoted = ( quotes ? '"' + value + '"' : value ) value ? """| | $title | ${ code ? ( '' + valueQuoted + '' ) : valueQuoted } |""".stripMargin() : '' } String tasks ( Task[] tasks ) { assert tasks ( tasks.size() == 1 ) ? "- ${ tasks[ 0 ].descriptionTableTitle } : "${ tasks[ 0 ].commandShortened }"" : "" + tasks.collect{ "" }.join( '' ) + "
- ${ it.descriptionTableTitle } : "${ it.commandShortened }"
" } %> <% for ( row in job.descriptionTable.findAll{ ! it.bottom } ) { %> ${ tableRow( row.key, row.value ) } <% } %> ${ tableRow( 'Display name', job.displayName ) } ${ tableRow( 'Parent job', job.parent ? ( job.parentIsReal ? jobLink( job.parent ) : job.parent ) : '' ) } ${ tableRow( 'Child job' + ( job.childJobs.size() == 1 ? '' : 's' ), job.childJobs.collect{ jobLink( it.id ) }.join( ', ' )) } ${ tableRow( 'Job type', job.jobType.description ) } ${ tableRow( 'Node', '' + job.node + '' ) } ${ tableRow( 'Quiet period', job.quietPeriod, true ) } ${ tableRow( 'Retry count', job.scmCheckoutRetryCount, true ) } ${ tableRow( 'JDK name', job.jdkName, true, true ) } <% if ( job.jobType == JobType.maven ) { final repoPath = ( job.privateRepository ? ".jenkins/jobs/${ job.id }/workspace/.repository" : job.privateRepositoryPerExecutor ? '.jenkins/maven-repositories/X' : job.localRepoPath ? job.localRepoPath : '.m2/repository' ) if ( job.prebuildersTasks ) { %> <% } %> ${ tableRow( 'Maven name', job.mavenName, true, true ) } ${ tableRow( 'Maven goals', job.mavenGoals, true ) } ${ tableRow( 'Maven repository', repoPath, true, true ) } ${ tableRow( 'Maven options', job.mavenOpts, true ) } <% if ( job.postbuildersTasks ) { %> <% } if ( job.artifactory?.name ) { %> <% } } %> ${ tableRow( 'Mail recipients', job.mail?.recipients, true ) } <% if ( job.scmType == 'svn' ) { %> <% } if ( job.triggers()) { %> <% } else if ( job.jobType == JobType.free ) { %> <% } if ( job.repositories()) { %> <% if ( job.pom ) // Free-Style jobs may not use Maven. Even if they use it - its POM is configured inside Maven { String pomUrl = job.repositories().first().getRemotePathLink( job.pom ) %> ${ tableRow( 'POM', '- ' + pomUrl + '
' ) } <% } } if ( job.invoke?.jobs ) { %>
<% } if ( job.invokedBy ) { %> <% } for ( row in job.descriptionTable.findAll{ it.bottom } ) { %> ${ tableRow( row.key, row.value ) } <% } %>
Job ${ jobLink( job.id ) }
Pre-build steps ${ tasks( job.prebuildersTasks ) }
Post-build steps ${ tasks( job.postbuildersTasks ) }
Deployed to Artifactory ${ job.artifactory.name } => "${ job.artifactory.repository }"
Svn update policy Revert - [${ job.doRevert }], update - [${ job.useUpdate }], checkout - [${ ! job.useUpdate }]
Triggers <% job.triggers().each { Trigger trigger -> %> - ${ trigger.type }${ trigger.expression ? ': "' + trigger.expression + '"' : '' }${ trigger.description ? ' (' + trigger.description + ')' : '' }
<% } %>
Build steps ${ tasks( job.tasks ) }
${ job.scmType.capitalize() } repositor${ ( job.repositories().size == 1 ) ? 'y' : 'ies' } <% job.repositories().each { Repository repo -> %> - ${ repo.remote } <% if ( repo.git ) { %> : ${ repo.gitBranch }
<% } } %>
Invokes <% job.invoke.jobsSplit.each { String invokedJobId -> %> - ${ jobLink( invokedJobId ) } when this job ${ job.invoke.condition[ 1 ] }
<% } %>
Invoked by <% job.invokedBy.each { Job invokedBy -> %> - ${ jobLink( invokedBy.id ) } when it ${ invokedBy.invoke.condition[ 1 ] }
<% } %>