forked from spinnaker/spinnaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
148 lines (117 loc) · 3.37 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
146
147
148
buildscript {
repositories {
jcenter()
maven { url "http://dl.bintray.com/spinnaker/gradle" }
}
dependencies {
classpath 'com.netflix.spinnaker.gradle:spinnaker-gradle-project:3.1.0'
}
}
group = "com.netflix.spinnaker.spinnaker"
apply plugin: 'spinnaker.project'
apply plugin: 'nebula.ospackage'
apply plugin: 'java'
String toVers(String v) {
int idx = v.indexOf('-')
if (idx != -1) {
return v.substring(0, idx)
}
return v
}
ospackage {
// common installation paths
def spinnakerHome = "/opt/" + project.name
// global package requirements
packageName = project.name
version = toVers(project.version.toString())
release '3'
// installer scripts
preInstall = file('pkg_scripts/preInstall.sh')
postInstall = file('pkg_scripts/postInstall.sh')
postUninstall = file('pkg_scripts/postUninstall.sh')
// files to put in the meta package
from('pylib') {
into spinnakerHome + '/pylib'
}
from('cassandra') {
into spinnakerHome + '/cassandra'
}
from('install') {
into spinnakerHome + '/install'
}
from('runtime') {
into spinnakerHome + '/bin'
fileMode = 0755
}
from(file('etc/init/spinnaker.conf')) {
into('/etc/init')
user = 'root'
permissionGroup = 'root'
fileType = CONFIG | NOREPLACE
}
from('config') {
into spinnakerHome + '/config'
fileMode = 0644
}
from('etc/apache2/sites-available/spinnaker.conf') {
into '/etc/apache2/sites-available'
user = 'root'
permissionGroup = 'root'
fileMode = 0644
}
from('etc/default/spinnaker') {
into '/etc/default'
user = 'root'
permissionGroup = 'root'
fileMode = 0644
}
configurationFile('/etc/default/spinnaker\n')
configurationFile('/etc/apache2/sites-available/spinnaker.conf\n')
File configDir
FileCollection collection = files { configDir.listFiles() }
configDir = file('config')
collection.each { configurationFile(spinnakerHome + '/' + relativePath(it) + '\n') }
}
// Ubuntu
buildDeb {
// requires('openjdk-8-jdk')
// requires('oracle-java8-installer')
requires('redis-server', '3.0.5', GREATER | EQUAL)
requires('spinnaker-clouddriver')
requires('spinnaker-deck')
requires('spinnaker-echo')
requires('spinnaker-fiat')
requires('spinnaker-front50')
requires('spinnaker-gate')
requires('spinnaker-igor')
requires('spinnaker-orca')
requires('spinnaker-rosco')
requires('apache2')
}
// TO DO
buildRpm {
arch = NOARCH
os = LINUX
}
task publishInstallSpinnaker {
onlyIf { project.hasProperty('bintrayUser') && project.hasProperty('bintrayKey') }
doLast {
def url = "https://api.bintray.com/content/spinnaker/scripts/SpinnakerBootstrap/1.0/InstallSpinnaker.sh?publish=1&override=1".toURL()
def conn = url.openConnection()
conn.setRequestMethod('PUT')
conn.setDoOutput(true)
conn.addRequestProperty('Authorization', 'Basic ' + ("${project.property('bintrayUser')}:${project.property('bintrayKey')}".bytes.encodeBase64().toString()))
conn.getOutputStream().withCloseable {
it.write(project.file('InstallSpinnaker.sh').text.bytes)
it.flush()
}
int code = conn.getResponseCode()
if (code != 201) {
logger.warn "Unexpected response code from InstallSpinnaker.sh publish: $code"
} else {
logger.info "Uploaded InstallSpinnaker.sh"
}
conn.disconnect()
}
}
tasks.release.dependsOn('publishInstallSpinnaker')