publish InstallSpinnaker.sh during release process

This commit is contained in:
Cameron Fieber 2016-10-11 10:38:16 -07:00
Родитель 136d4b94e9
Коммит 493d178eaf
1 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -118,3 +118,31 @@ 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')