opendistro-security-parent/rpmbuild.gradle
2019-03-28 14:57:57 +03:00

63 lines
2.1 KiB
Groovy

// Uses Gradle to build RPMs since that's what we use for the other plugins. When all you have is a hammer...
plugins {
id "nebula.ospackage" version "5.3.0"
}
// To prevent conflicts with maven build under build/
buildDir = 'gradle-build'
ext {
opendistroVersion = '0.7.0'
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}
group = "com.amazon.opendistroforelasticsearch"
// Increment the final digit when there's a new plugin versions for the same opendistro version
// Reset the final digit to 0 when upgrading to a new opendistro version
version = "${opendistroVersion}.1" + (isSnapshot ? "-SNAPSHOT" : "")
if (!project.hasProperty("archivePath")) {
throw new GradleException("Missing -ParchivePath command line switch pointing to built plugin ZIP")
}
if (!project.file(archivePath).exists()) {
throw new GradleException("Missing plugin zip file: $archivePath")
}
ospackage {
packageName = "opendistro-security"
release = isSnapshot ? "0.1" : '1'
version = "${project.version}" - "-SNAPSHOT"
into '/usr/share/elasticsearch/plugins'
from(zipTree(project.file(archivePath).absolutePath)) {
into "opendistro_security"
}
user 'root'
permissionGroup 'root'
fileMode 0644
dirMode 0755
requires('elasticsearch-oss', "6.6.1", EQUAL)
arch = 'NOARCH'
packager = 'Amazon'
vendor = 'Amazon'
os = 'LINUX'
prefix '/usr'
license 'ASL-2.0'
maintainer 'OpenDistro for Elasticsearch Team <opendistro@amazon.com>'
url 'https://opendistro.github.io/elasticsearch/downloads'
summary '''
Security plugin for OpenDistro for Elasticsearch.
Reference documentation can be found at https://opendistro.github.io/elasticsearch/docs.
'''.stripIndent().replace('\n', ' ').trim()
//TODO: Would be better if the install_demo_configuration.sh script is marked executable in the upstream plugin instead of running bash manually here
postInstall "exec /bin/bash /usr/share/elasticsearch/plugins/opendistro_security/tools/install_demo_configuration.sh -y -i -s"
}
buildRpm {
archiveName "${packageName}-${version}.rpm"
}