Skip to content

Commit a3536c1

Browse files
committed
[Build] Unify mark build jobs and migrate them to pipeline
Unify the previously two jobs to mark a build as stable and unstable into one pipeline job, that has a choice parameter for the type of marker to apply.
1 parent ab5ae99 commit a3536c1

File tree

3 files changed

+86
-88
lines changed

3 files changed

+86
-88
lines changed

JenkinsJobs/Builds/FOLDER.groovy

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,26 @@ pipelineJob('Builds/Build-Docker-images'){
5454
}
5555
}
5656
}
57+
58+
pipelineJob('Builds/mark-build'){
59+
displayName("Mark build")
60+
description("Mark a build as stable or unstable.")
61+
parameters {
62+
stringParam('buildId', null, "ID of the build to be marked.")
63+
choiceParam('markAs', [
64+
'STABLE',
65+
'UNSTABLE',
66+
], 'The kind of marker to apply to (respectively remove from) the specified build.')
67+
stringParam('issueURL', null, 'URL of the causing Github issue or PR (<em>only relevant if the build is marked as unstable<em>).')
68+
}
69+
70+
definition {
71+
cpsScm {
72+
lightweight(true)
73+
scm {
74+
github('eclipse-platform/eclipse.platform.releng.aggregator', 'master')
75+
}
76+
scriptPath('JenkinsJobs/Builds/markBuild.jenkinsfile')
77+
}
78+
}
79+
}

JenkinsJobs/Builds/markBuild.groovy

Lines changed: 0 additions & 88 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
pipeline {
2+
options {
3+
skipDefaultCheckout()
4+
timestamps()
5+
timeout(time: 5, unit: 'MINUTES')
6+
buildDiscarder(logRotator(numToKeepStr:'5'))
7+
}
8+
agent {
9+
label 'basic'
10+
}
11+
stages {
12+
stage('Mark build'){
13+
environment {
14+
// Download Server locations (would very seldom change)
15+
EP_BUILD_DROP = "/home/data/httpd/download.eclipse.org/eclipse/downloads/drops4/${buildId}"
16+
RELEASE_VER = readBuildProperty('RELEASE_VER')
17+
}
18+
steps {
19+
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
20+
sh '''#!/bin/bash -xe
21+
# Strip spaces from the buildId and eclipseStream
22+
buildId=$(echo $buildId|tr -d ' ')
23+
issueURL=$(echo $issueURL|tr -d ' ')
24+
25+
if [ -z "$buildId" ]; then
26+
echo "BuildId is empty! Exiting."
27+
exit 1
28+
fi
29+
if [ "$markAs" == 'UNSTABLE' ] && [ -z "$issueURL" ]; then
30+
echo "Required issueURL parameter is empty! Exiting."
31+
exit 1
32+
fi
33+
34+
case ${markAs} in
35+
STABLE)
36+
#Remove unstable tag
37+
ssh [email protected] rm -f ${EP_BUILD_DROP}/buildUnstable
38+
;;
39+
UNSTABLE)
40+
# Convert URL of GH issue or PR into: 'organization/repository#number'
41+
label=$(echo "${issueURL##'https://github.com/'}" | sed 's/\\/issues\\//#/g' | sed 's/\\/pull\\//#/g')
42+
#Add unstable tag
43+
echo "<p>This build is marked unstable due to <a href='${issueURL}'>${label}</a>.</p>" > buildUnstable
44+
scp buildUnstable [email protected]:${EP_BUILD_DROP}/buildUnstable
45+
;;
46+
esac
47+
'''
48+
}
49+
build job: 'Releng/updateIndex', wait: false
50+
build job: 'Releng/modifyP2CompositeRepository', wait: true, propagate: true, parameters: [
51+
string(name: 'repositoryPath', value: "eclipse/updates/${RELEASE_VER}-I-builds"),
52+
string(name: "${params.markAs == 'STABLE' ? 'add' : 'remove'}", value: "${buildId}")
53+
]
54+
}
55+
}
56+
}
57+
}
58+
59+
def readBuildProperty(String name) {
60+
def buildPropertiesURL = "https://download.eclipse.org/eclipse/downloads/drops4/${buildId}/buildproperties.properties"
61+
def buildProperties = readProperties(text: sh(script: "curl --fail ${buildPropertiesURL}", returnStdout: true))
62+
return buildProperties[name].replace('"','') // Remove surrounding quotes
63+
}

0 commit comments

Comments
 (0)