@@ -127,25 +127,6 @@ ${status} after ${currentBuild.durationString - ' and counting'}"""
127127// message: "${message}"
128128}
129129
130- def submitCIMetrics (buildType ) {
131- long durationMs = currentBuild. duration
132- long durationSec = durationMs / 1000
133- long nowSec = (currentBuild. startTimeInMillis + durationMs) / 1000
134- def branchNameNoPeriods = env. BRANCH_NAME . replaceAll(' \\ .' , ' _' )
135- def durationMetric = " okr.ci.nodejs.${ env.DRIVER_METRIC_TYPE} .${ buildType} .${ branchNameNoPeriods} ${ durationSec} ${ nowSec} "
136-
137- timeout(time : 1 , unit : ' MINUTES' ) {
138- withCredentials([string(credentialsId : ' lab-grafana-address' , variable : ' LAB_GRAFANA_ADDRESS' ),
139- string(credentialsId : ' lab-grafana-port' , variable : ' LAB_GRAFANA_PORT' )]) {
140- withEnv([" DURATION_METRIC=${ durationMetric} " ]) {
141- sh label : ' Send runtime metrics to labgrafana' , script : ''' #!/bin/bash -lex
142- echo "${DURATION_METRIC}" | nc -q 5 ${LAB_GRAFANA_ADDRESS} ${LAB_GRAFANA_PORT}
143- '''
144- }
145- }
146- }
147- }
148-
149130def describePerCommitStage () {
150131 script {
151132 currentBuild. displayName = " Per-Commit"
@@ -199,7 +180,9 @@ def describeAdhocTestingStage() {
199180}
200181
201182// branch pattern for cron
202- def branchPatternCron = ~" (master)"
183+ def branchPatternCron () {
184+ ~" (master)"
185+ }
203186
204187pipeline {
205188 agent none
@@ -303,7 +286,7 @@ pipeline {
303286 }
304287
305288 triggers {
306- parameterizedCron(branchPatternCron. matcher(env. BRANCH_NAME ). matches() ? """
289+ parameterizedCron(branchPatternCron() . matcher(env. BRANCH_NAME ). matches() ? """
307290 # Every weeknight (Monday - Friday) around 7 PM
308291 H 19 * * 1-5 %CI_SCHEDULE=WEEKNIGHTS
309292 """ : " " )
@@ -434,11 +417,6 @@ pipeline {
434417 }
435418 }
436419 post {
437- always {
438- node(' master' ) {
439- submitCIMetrics(' commit' )
440- }
441- }
442420 aborted {
443421 notifySlack(' aborted' )
444422 }
0 commit comments