|
| 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