| 
					
				 | 
			
			
				@@ -1,5 +1,5 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 def call(String webhook, String status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def info = gatherCommonInfo() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def info = _gatherInfo() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     new com.example.FeishuNotifier(this, webhook).send( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         env.JOB_NAME, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11,23 +11,4 @@ def call(String webhook, String status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         info.author, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         info.commitTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// ==========  下面是 CPS 安全的采集逻辑 ========== 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-@com.cloudbees.groovy.cps.NonCPS   // 仅供内部流转,避免返回值被序列化 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-private Map gatherCommonInfo() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def duration = currentBuild.durationString.replace(' and counting', '') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def commitMsg  = sh(returnStdout: true, script: 'git log -1 --pretty=%B').trim() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def author     = sh(returnStdout: true, script: 'git log -1 --pretty=%an').trim() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def commitTime = sh(returnStdout: true, script: 'git log -1 --pretty=%ci').trim() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def branch     = env.BRANCH_NAME ?: env.GIT_BRANCH ?: 'unknown' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def buildUrl   = env.BUILD_URL.replace('http://68.79.46.88:8080', 'https://jenkins.adwebcloud.com') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        duration : duration, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        commitMsg: commitMsg, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        author   : author, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        commitTime: commitTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        branch   : branch, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        buildUrl : buildUrl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |