-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
145 lines (122 loc) · 4.27 KB
/
build.gradle
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.21.RELEASE")
}
}
plugins {
id 'java-library'
id 'org.springframework.boot' version '1.5.21.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'org.hidetake.ssh' version "1.1.3"
id 'application'
}
group 'uk.ac.ebi.subs'
version '1.6.0-SNAPSHOT'
mainClassName = "uk.ac.ebi.subs.validator.taxon.TaxonomyValidatorApplication"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
springBoot {
buildInfo()
executable = true
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
compile(group: "uk.ac.ebi.subs", name:"validator-common", version: "3.16.0-SNAPSHOT") {
exclude group: 'org.springframework.boot', module :'spring-boot-starter-data-mongodb'
}
compile("uk.ac.ebi.subs:subs-messaging:0.7.0-SNAPSHOT")
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-web")
compile 'org.springframework.boot:spring-boot-starter-amqp'
compile("com.fasterxml.jackson.core:jackson-databind")
compile 'de.codecentric:spring-boot-admin-starter-client:1.5.7'
compile("de.siegmar:logback-gelf:1.1.0")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.mockito:mockito-core:2.+")
}
ssh.settings {
user = 'sub_adm'
}
if (project.hasProperty('sshKeyFile')) {
ssh.settings.identity = new File(sshKeyFile)
}
if (project.hasProperty('sshPassphrase')) {
ssh.settings.passphrase = sshPassphrase
}
task printJarName {
doLast {
println "$jar.archivePath.name"
}
}
task printJarFullPath {
doLast {
println "$jar.archivePath.absolutePath"
}
}
task('externalCiTest', type: Test) {
useJUnit {
excludeCategories 'uk.ac.ebi.subs.validator.taxon.core.config.RabbitMQDependentTest'
}
testLogging {
exceptionFormat = 'full'
}
configure(externalCiTest) {
group = "verification"
description = 'Run tests appropriate for our external CI environment'
}
}
def devDeployHostName = hasProperty(project.name + "DevDeployTarget") ? getProperty(project.name + "DevDeployTarget") : 'localhost'
def testDeployHostName = hasProperty(project.name + "TestDeployTarget") ? getProperty(project.name + "TestDeployTarget") : 'localhost'
def prodDeployHostName = hasProperty(project.name + "ProdDeployTarget") ? getProperty(project.name + "ProdDeployTarget") : 'localhost'
ext.gradle_env = hasProperty('env') ? env : 'dev'
remotes {
submission_dev {
role('dev')
host = devDeployHostName
}
submission_test {
role('test')
host = testDeployHostName
}
submission_prod {
role('prod')
host = prodDeployHostName
}
}
task deployJar(type: SshTask, dependsOn: 'assemble') {
doLast {
def uploadJarFileName = project.name + "-" + project.version + "." + System.currentTimeMillis() + ".jar"
File jarDeployDir = new File("/data/$gradle_env/$project.name/jar",uploadJarFileName)
sshRun(jarDeployDir)
}
ssh.settings {
knownHosts = allowAnyHosts
}
}
private Object sshRun(File jarDeployFile) {
def uploadJarFileName = name + "-" + version + "." + System.currentTimeMillis() + ".jar"
File jarDeployDir = jarDeployFile.getParentFile()
ssh.run {
session(remotes.role(gradle_env)) {
execute "/homes/sub_adm/create_dirs.sh $gradle_env $project.name", ignoreError: false
println "Uploading jar $jar.archivePath.name to $jarDeployDir/$uploadJarFileName area on $remote"
put from: jar.archivePath.absolutePath, into: jarDeployFile.absolutePath
println "creating symbolic link to $jar.archiveName"
def result = execute "ln -s -f $jarDeployFile.absolutePath $jarDeployDir/$jar.baseName" + ".jar", ignoreError: true
println result
println "updating permissions of $jarDeployDir/$jar.archiveName"
execute "chmod u+x $jarDeployDir/*", ignoreError: false
}
}
}