-
Notifications
You must be signed in to change notification settings - Fork 12
/
Jenkinsfile
117 lines (112 loc) · 3.3 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
def bmarkFile = 'benchmarks.jl'
pipeline {
agent any
environment {
REPO_EXISTS = fileExists "$repo"
}
options {
skipDefaultCheckout true
}
triggers {
GenericTrigger(
genericVariables: [
[
key: 'action',
value: '$.action',
expressionType: 'JSONPath', //Optional, defaults to JSONPath
regexpFilter: '[^(created)]', //Optional, defaults to empty string
defaultValue: '' //Optional, defaults to empty string
],
[
key: 'comment',
value: '$.comment.body',
expressionType: 'JSONPath', //Optional, defaults to JSONPath
regexpFilter: '', //Optional, defaults to empty string
defaultValue: '' //Optional, defaults to empty string
],
[
key: 'org',
value: '$.organization.login',
expressionType: 'JSONPath', //Optional, defaults to JSONPath
regexpFilter: '', //Optional, defaults to empty string
defaultValue: 'ProofOfConceptForJuliSmoothOptimizers' //Optional, defaults to empty string
],
[
key: 'pullrequest',
value: '$.issue.number',
expressionType: 'JSONPath', //Optional, defaults to JSONPath
regexpFilter: '[^0-9]', //Optional, defaults to empty string
defaultValue: '' //Optional, defaults to empty string
],
[
key: 'repo',
value: '$.repository.name',
expressionType: 'JSONPath', //Optional, defaults to JSONPath
regexpFilter: '', //Optional, defaults to empty string
defaultValue: '' //Optional, defaults to empty string
]
],
causeString: 'Triggered on $comment',
token: "AMD",
printContributedVariables: true,
printPostContent: true,
silentResponse: false,
regexpFilterText: '$comment',
regexpFilterExpression: '@JSOBot runbenchmarks'
)
}
stages {
stage('clone repo') {
when {
expression { REPO_EXISTS == 'false' }
}
steps {
sh 'git clone https://${GITHUB_AUTH}@github.com/$org/$repo.git'
}
}
stage('checkout on new branch') {
steps {
dir(WORKSPACE + "/$repo") {
sh '''
git clean -fd
git checkout main
git pull origin main
git fetch origin
git branch -D $BRANCH_NAME || true
git checkout -b $BRANCH_NAME origin/$BRANCH_NAME
'''
}
}
}
stage('run benchmarks') {
steps {
script {
def data = env.comment.tokenize(' ')
if (data.size() > 2) {
bmarkFile = data.get(2);
}
}
dir(WORKSPACE + "/$repo") {
sh "mkdir -p $HOME/benchmarks/${org}/${repo}"
sh "qsub -N ${repo}_${pullrequest} -V -cwd -o $HOME/benchmarks/${org}/${repo}/${pullrequest}_bmark_output.log -e $HOME/benchmarks/${org}/${repo}/${pullrequest}_bmark_error.log push_benchmarks.sh $bmarkFile"
}
}
}
}
post {
success {
echo "SUCCESS!"
}
cleanup {
dir(WORKSPACE + "/$repo") {
sh 'printenv'
sh '''
git clean -fd
git reset --hard
git checkout main
git branch -D $BRANCH_NAME || true
'''
}
}
}
}