-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJenkinsfile.integration
93 lines (78 loc) · 3.85 KB
/
Jenkinsfile.integration
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
#!groovy
// This Jenkinsfile.integration is used by the Jenkins job "folio-integration"
// and using the FOLIO system built by the cloudformation configuration in this repository "folio-perf-test"
// to then run the integration tests in the repository "folio-integration-tests"
// against the recent set of modules from "folio-snapshot" reference environment.
properties([
parameters([
string(name: 'EnvName', defaultValue: 'folio-integration', description: 'Unique environment name'),
string(name: 'JenkinsAwsCredential', defaultValue: 'jenkins-aws', description: 'Jenkins credential to access AWS account'),
string(name: 'JenkinsEc2Credential', defaultValue: '11657186-f4d4-4099-ab72-2a32e023cced', description: 'Jenkins credential to SSH into AWS EC2'),
string(name: 'AwsKeyPair', defaultValue: 'aws-sling-dev', description: 'Aws KeyPair name for EC2 instances'),
string(name: 'AwsSubnet', defaultValue: 'subnet-4406021d', description: 'AWS Subnet to create EC2 instances'),
string(name: 'AwsSecurityGroups', defaultValue: 'sg-7ea9ef35', description: 'AWS VPC Security Groups to use'),
string(name: 'AwsUsePublicIp', defaultValue: 'Yes', description: 'AWS EC2 has public IP or not'),
string(name: 'MdRepo', defaultValue: 'http://folio-registry.aws.indexdata.com', description: 'Module descriptor repository'),
string(name: 'StableFolio', defaultValue: 'https://folio-snapshot.dev.folio.org', description: 'Use stable version of modules'),
string(name: 'FixedOkapi', defaultValue: '4.5.0', description: 'Use specified version of Okapi'),
text(name: 'FixedMods', defaultValue: '', description: 'Paste install.json content here to use predefined module versions rather than pulling from stable FOLIO site'),
string(name: 'SampleDataRepo', defaultValue: 'https://s3.amazonaws.com/folio-public-sample-data', description: 'Sample data repository'),
string(name: 'SampleDataName', defaultValue: 'perf', description: 'Sample dataset name'),
string(name: 'TestRailUrl', defaultValue: 'https://foliotest.testrail.io', description: 'TestRail reporitng server URL'),
string(name: 'TestRailProjectId', defaultValue: '19', description: 'TestRail Project ID for Intgegration tests'),
])
])
def sharedLib
def context
node('jenkins-agent-java11') {
timeout(180) {
stage("Checkout") {
cleanWs()
checkout scm
sharedLib = load "shared.groovy"
context = sharedLib.getContext()
}
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: "${context.awsKeyId}",
accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
usernamePassword(credentialsId: 'ebsco-rmapi-up', passwordVariable: 'RMAPI_PASSWORD',
usernameVariable: 'RMAPI_CUSTID')]) {
sshagent(credentials:["${context.sshKeyId}"]) {
try {
stage("Create Environment") {
sharedLib.notifySlack()
sharedLib.createEnv(context)
}
stage("Wait for Environment") {
sharedLib.waitForEnv(context)
}
stage("Bootstrap DB") {
sharedLib.bootstrapDb(context)
}
stage("Bootstrap Okapi") {
sharedLib.bootstrapOkapi(context)
}
stage("Bootstrap modules") {
sharedLib.bootstrapModules(context)
}
stage("Populate data") {
sharedLib.populateData(context)
}
stage("Run integration tests") {
node('jenkins-slave-all') {
sharedLib.runIntegrationTests(context)
}
}
} catch (e) {
currentBuild.result = 'FAILURE'
throw e
} finally {
stage("Tear down environment") {
sharedLib.notifySlack(currentBuild.result)
sleep 60
sharedLib.teardownEnv(context)
}
}
}
}
}
}