-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
101 lines (87 loc) · 3.02 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
98
99
100
@Library ('folio_jenkins_shared_libs') _
pipeline {
environment {
origin = 'platform-complete'
branch = 'snapshot'
folioRegistry = 'http://folio-registry.aws.indexdata.com'
}
options {
timeout(30)
buildDiscarder(logRotator(numToKeepStr: '30'))
}
agent {
node {
label 'platform-build'
}
}
stages {
stage('Setup') {
steps {
sendNotifications 'STARTED'
script {
currentBuild.displayName = "#${env.BUILD_NUMBER}-${env.JOB_BASE_NAME}"
def lastCommit = sh(returnStatus: true,
script: "git log -1 | grep '.*\\[CI SKIP\\].*'")
if (lastCommit == 0) {
echo "CI SKIP detected. Aborting build"
env.skipBuild = 'true'
}
}
}
}
stage('Do Build') {
when {
anyOf {
expression { env.skipBuild != 'true' }
environment name: 'JOB_NAME', value: 'Automation/build-platform-complete-snapshot'
}
}
stages {
stage('Build Stripes Platform') {
steps {
// the tenant and okapi url are irrelevant here.
buildStripesPlatform('https://localhost:9130','diku')
}
}
stage('Check Interface Dependencies') {
steps {
script {
echo "Creating okapi preseed module list."
sh 'jq -s \'.[0]=([.[]]|flatten)|.[0]\' stripes-install.json install-extras.json > install-pre.json'
def installPreJson = readFile('./install-pre.json')
platformDepCheck('diku',installPreJson)
echo 'Generating backend dependency list to okapi-install.json'
sh 'jq \'map(select(.id | test(\"mod-\"; \"i\")))\' install.json > okapi-install.json'
sh 'cat okapi-install.json'
echo "Append edge modules to final stripes-install.json."
sh 'mv stripes-install.json stripes-install-pre.json'
sh 'jq \'map(select(.id | test(\"edge-\"; \"i\")))\' install.json > install-edge.json'
sh 'jq -s \'.[0]=([.[]]|flatten)|.[0]\' stripes-install-pre.json install-edge.json > stripes-install.json'
sh 'cat stripes-install.json'
}
}
}
stage('Publish Snapshot NPM') {
when {
buildingTag()
}
steps {
// clean up any generated stuff from CI
sh 'rm -rf bundle output artifacts ci node_modules ModuleDescriptors'
sh 'rm -rf yarn.lock install.json stripes-install.json okapi-install.json'
withCredentials([string(credentialsId: env.npmConfig,variable: 'NPM_TOKEN')]) {
withNPM(npmrcConfig: env.npmConfig) {
sh 'npm publish'
}
}
}
}
} //end 'do buid' stage
} // end inner stages
} // end outter stages
post {
always {
sendNotifications currentBuild.result
}
}
}