gatherInfo.groovy 759 B

1234567891011121314151617181920
  1. def call(String branchOverride = null) {
  2. def duration = currentBuild.durationString.replace(' and counting', '')
  3. def commitMsg = sh(returnStdout: true, script: 'git log -1 --pretty=%B').trim()
  4. def author = sh(returnStdout: true, script: 'git log -1 --pretty=%an').trim()
  5. def commitTime = sh(returnStdout: true, script: 'git log -1 --pretty=%ci').trim()
  6. def branch = branchOverride ?: env.GIT_BRANCH ?: env.BRANCH_NAME ?: 'unknown'
  7. def buildUrl = env.BUILD_URL.replace('http://68.79.46.88:8080', 'https://jenkins.adwebcloud.com')
  8. return [
  9. duration : duration,
  10. commitMsg: commitMsg,
  11. author : author,
  12. commitTime: commitTime,
  13. branch : branch,
  14. buildUrl : buildUrl
  15. ]
  16. }