-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
97 lines (92 loc) · 3.78 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
// This Jenkinsfile is used by Jenkins to run the 'FireworksLayout' step of Reactome's release.
// It requires that the 'DiagramConverter' step has been run successfully before it can be run.
import org.reactome.release.jenkins.utilities.Utilities
// Shared library maintained at 'release-jenkins-utils' repository.
def utils = new Utilities()
pipeline{
agent any
// Set output folder that will contain files created by step.
environment {
OUTPUT_FOLDER = "fireworks"
}
stages{
// This stage checks that upstream project 'DiagramConverter' was run successfully.
stage('Check DiagramConverter build succeeded'){
steps{
script{
utils.checkUpstreamBuildsSucceeded("File-Generation/job/DiagramConverter/")
}
}
}
// This stage builds the jar file using maven.
stage('Setup: Build jar file'){
steps{
script{
sh "mvn clean package"
}
}
}
// Execute the jar file, producing the diagram JSON files.
stage('Main: Run Fireworks-Layout'){
steps{
script{
def releaseVersion = utils.getReleaseVersion()
sh "mkdir -p ${env.OUTPUT_FOLDER}"
withCredentials([usernamePassword(credentialsId: 'neo4jUsernamePassword', passwordVariable: 'pass', usernameVariable: 'user')]){
sh "java -Dlogback.configurationFile=src/main/resources/logback.xml -jar target/fireworks-exec.jar --user $user --password $pass --folder ./config --output ./${env.OUTPUT_FOLDER}"
// Create archive that will be stored on S3.
sh "tar -zcf fireworks-v${releaseVersion}.tgz ${env.OUTPUT_FOLDER}/"
}
}
}
}
// Lists all JSON fireworks file sizes between current and previous releases for comparison.
stage('Post: Compare file sizes with previous release') {
steps{
script{
def releaseVersion = utils.getReleaseVersion()
def previousReleaseVersion = utils.getPreviousReleaseVersion()
def previousFireworksArchive = "fireworks-v${previousReleaseVersion}.tgz"
sh "mkdir -p ${previousReleaseVersion}"
// Downloads previous release fireworks archive from S3.
sh "aws s3 --no-progress cp s3://reactome/private/releases/${previousReleaseVersion}/fireworks/data/${previousFireworksArchive} ${previousReleaseVersion}/"
dir("${previousReleaseVersion}"){
sh "tar -xf ${previousFireworksArchive}"
}
// Output files between releases.
def currentDiagramsFileCount = findFiles(glob: "${env.OUTPUT_FOLDER}/*").size()
def previousDiagramsFileCount = findFiles(glob: "${previousReleaseVersion}/${env.OUTPUT_FOLDER}/*").size()
echo("Fireworks file sizes for v${releaseVersion}: ${currentDiagramsFileCount}")
sh "ls -lrt ${env.OUTPUT_FOLDER}"
echo("Fireworks file sizes for v${previousReleaseVersion}: ${previousDiagramsFileCount}")
sh "ls -lrt ${previousReleaseVersion}/${env.OUTPUT_FOLDER}/"
sh "rm -r ${previousReleaseVersion}*"
}
}
}
// Move fireworks folder to download folder.
stage('Post: Move fireworks folder to download folder') {
steps{
script{
def releaseVersion = utils.getReleaseVersion()
def downloadPath = "${env.ABS_DOWNLOAD_PATH}/${releaseVersion}"
sh "sudo rm -rf ${downloadPath}/fireworks"
sh "mv ${env.OUTPUT_FOLDER} ${downloadPath}/ "
}
}
}
// Archive everything on S3, and move the 'diagram' folder to the download/vXX folder.
stage('Post: Archive Outputs'){
steps{
script{
def releaseVersion = utils.getReleaseVersion()
def dataFiles = ["fireworks-v${releaseVersion}.tgz"]
def logFiles = []
// Note at time of writing fireworks-layout does not output log files (but makes very, very verbose stdout)
def foldersToDelete = []
utils.cleanUpAndArchiveBuildFiles("fireworks", dataFiles, logFiles, foldersToDelete)
}
}
}
}
}