forked from eth-cscs/cscs-reframe-tests
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfileDeployReFrame
70 lines (63 loc) · 2.65 KB
/
JenkinsfileDeployReFrame
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
#!/usr/bin/env groovy
def latestTag = 'null'
def machines = '[dom daint eiger pilatus tsa]'
def reviewersPR = 'teojgo,ekouts'
def ebTemplate = '3.11.1'
stage('Retrieve Latest Tag') {
node('dom') {
dir('reframe_public') {
latestTag = sh(returnStdout: true,
script: '''#!/bin/bash -l
git clone https://github.com/reframe-hpc/reframe.git
cd reframe
git fetch --tags
latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo $latestTag
''').trim()
deleteDir()
}
println "The latest tag is: ${latestTag}"
}
}
if (latestTag == 'null') {
println 'Could not retrieve the latest tag. Exiting...'
currentBuild.result = 'FAILURE'
return
}
def targetVersion = latestTag.substring(1)
println "The target version is ${targetVersion}"
stage('Production PR') {
node('dom') {
dir('production_repo') {
git changelog: false, poll: false, url: '[email protected]:eth-cscs/production.git'
if (fileExists("easybuild/easyconfigs/r/reframe/reframe-${targetVersion}.eb"))
{
println "There is already an easyconfig for tag: ${latestTag}. Aborting..."
currentBuild.result = 'ABORTED'
return
}
def branchExists = sh(returnStatus: true,
script: """#!/bin/bash -l
git branch --list | grep reframe/${targetVersion}
""")
if (branchExists == 0)
{
println "There is already a branch named: reframe/${targetVersion}. Aborting..."
currentBuild.result = 'ABORTED'
return
}
sh("""#!/bin/bash -l
module load daint-gpu
module load hub
cd easybuild/easyconfigs/r/reframe
git checkout -b reframe/${targetVersion}
sed -r "s/(version\\s*=\\s*)'${ebTemplate}'/\\1'${targetVersion}'/g" reframe-${ebTemplate}.eb > reframe-${targetVersion}.eb
git add reframe-${targetVersion}.eb
git commit -m "Add recipe for ReFrame version ${targetVersion}"
git push origin HEAD
hub pull-request -r ${reviewersPR} -m "${machines} Add recipe for ReFrame version ${targetVersion}"
""")
deleteDir()
}
}
}