-
Notifications
You must be signed in to change notification settings - Fork 1
/
VersionCheckJetty.jenkinsfile
59 lines (51 loc) · 1.65 KB
/
VersionCheckJetty.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
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
disableConcurrentBuilds()
skipDefaultCheckout true
}
environment {
EXPECTED_LAST_MODIFIED = '20230830214835'
}
triggers {
cron('@midnight')
}
stages {
stage('Jetty Version Check') {
steps {
sh '''
LAST_MODIFIED=$(curl -s https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-p2/maven-metadata.xml | tee metadata | grep lastUpdate | sed 's#\\s*<lastUpdated>\\(.*\\)</lastUpdated>#\\1#g')
if [[ $LAST_MODIFIED != $EXPECTED_LAST_MODIFIED ]]; then
echo "Expected last modified $EXPECTED_LAST_MODIFIED != Actual last modified $LAST_MODIFIED"
echo 'New versions available:'
grep '<version>' metadata | sed 's#\\s*<version>\\(.*\\)</version>#\\1#g'
exit 1
else
echo "No new versions expected"
fi
'''
}
}
}
post {
always {
archiveArtifacts '**'
}
failure {
mail to: 'ed.merks@gmail.com',
subject: "[Oomph CI] New Jetty Versions available ${currentBuild.fullDisplayName}",
mimeType: 'text/html',
body: "Project: ${env.JOB_NAME}<br/>Build Number: ${env.BUILD_NUMBER}<br/>Build URL: ${env.BUILD_URL}<br/>Console: ${env.BUILD_URL}/console"
}
fixed {
mail to: 'ed.merks@gmail.com',
subject: "[Oomph CI] Back to normal ${currentBuild.fullDisplayName}",
mimeType: 'text/html',
body: "Project: ${env.JOB_NAME}<br/>Build Number: ${env.BUILD_NUMBER}<br/>Build URL: ${env.BUILD_URL}<br/>Console: ${env.BUILD_URL}/console"
}
cleanup {
deleteDir()
}
}
}