File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,14 @@ pipeline {
31
31
32
32
// Build stages
33
33
stages {
34
- stage(' Jenkins Linux: Get sources ' ) {
35
- agent { label ' linux && cpu ' }
34
+ stage(' Jenkins Linux: Initialize ' ) {
35
+ agent { label ' job_initializer ' }
36
36
steps {
37
37
script {
38
38
checkoutSrcs()
39
39
commit_id = " ${ GIT_COMMIT} "
40
40
}
41
+ sh ' python3 tests/jenkins_get_approval.py'
41
42
stash name : ' srcs'
42
43
milestone ordinal : 1
43
44
}
Original file line number Diff line number Diff line change @@ -12,13 +12,14 @@ pipeline {
12
12
agent none
13
13
// Build stages
14
14
stages {
15
- stage(' Jenkins Win64: Get sources ' ) {
16
- agent { label ' win64 && build ' }
15
+ stage(' Jenkins Win64: Initialize ' ) {
16
+ agent { label ' job_initializer ' }
17
17
steps {
18
18
script {
19
19
checkoutSrcs()
20
20
commit_id = " ${ GIT_COMMIT} "
21
21
}
22
+ sh ' python3 tests/jenkins_get_approval.py'
22
23
stash name : ' srcs'
23
24
milestone ordinal : 1
24
25
}
Original file line number Diff line number Diff line change
1
+ import boto3
2
+ import json
3
+
4
+ lambda_client = boto3 .client ('lambda' , region_name = 'us-west-2' )
5
+
6
+ # Source code for the Lambda function is available at https://github.com/hcho3/xgboost-devops
7
+ r = lambda_client .invoke (
8
+ FunctionName = 'XGBoostCICostWatcher' ,
9
+ InvocationType = 'RequestResponse' ,
10
+ Payload = '{}' .encode ('utf-8' )
11
+ )
12
+
13
+ payload = r ['Payload' ].read ().decode ('utf-8' )
14
+ if 'FunctionError' in r :
15
+ msg = 'Error when invoking the Lambda function. Stack trace:\n '
16
+ error = json .loads (payload )
17
+ msg += f" { error ['errorType' ]} : { error ['errorMessage' ]} \n "
18
+ for trace in error ['stackTrace' ]:
19
+ for line in trace .split ('\n ' ):
20
+ msg += f' { line } \n '
21
+ raise RuntimeError (msg )
22
+ response = json .loads (payload )
23
+ if response ['approved' ]:
24
+ print (f"Testing approved. Reason: { response ['reason' ]} " )
25
+ else :
26
+ raise RuntimeError (f"Testing rejected. Reason: { response ['reason' ]} " )
You can’t perform that action at this time.
0 commit comments