-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Staging for version increment automation (#1932)
* Version increment automation Signed-off-by: pgodithi <[email protected]> (cherry picked from commit 235d256)
- Loading branch information
1 parent
1ca7b21
commit eb2a197
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -419,3 +419,83 @@ allprojects { | |
} | ||
} | ||
} | ||
|
||
// This is afterEvaluate because the bundlePlugin ZIP task is updated afterEvaluate and changes the ZIP name to match the plugin name | ||
afterEvaluate { | ||
ospackage { | ||
packageName = "${name}" | ||
release = isSnapshot ? "0.1" : '1' | ||
version = "${project.version}" - "-SNAPSHOT" | ||
|
||
into '/usr/share/opensearch/plugins' | ||
from(zipTree(bundlePlugin.archivePath)) { | ||
into opensearchplugin.name | ||
} | ||
|
||
user 'root' | ||
permissionGroup 'root' | ||
fileMode 0644 | ||
dirMode 0755 | ||
|
||
requires('opensearch', versions.opensearch, EQUAL) | ||
packager = 'Amazon' | ||
vendor = 'Amazon' | ||
os = 'LINUX' | ||
prefix '/usr' | ||
|
||
license 'ASL-2.0' | ||
maintainer 'OpenSearch <[email protected]>' | ||
url 'https://opensearch.org/downloads.html' | ||
summary ''' | ||
Security plugin for OpenSearch. | ||
Reference documentation can be found at https://opensearch.org/docs/latest/. | ||
'''.stripIndent().replace('\n', ' ').trim() | ||
} | ||
|
||
buildRpm { | ||
arch = 'NOARCH' | ||
dependsOn 'assemble' | ||
finalizedBy 'renameRpm' | ||
task renameRpm(type: Copy) { | ||
from("$buildDir/distributions") | ||
into("$buildDir/distributions") | ||
include archiveName | ||
rename archiveName, "${packageName}-${version}.rpm" | ||
doLast { delete file("$buildDir/distributions/$archiveName") } | ||
} | ||
} | ||
|
||
buildDeb { | ||
arch = 'all' | ||
dependsOn 'assemble' | ||
finalizedBy 'renameDeb' | ||
task renameDeb(type: Copy) { | ||
from("$buildDir/distributions") | ||
into("$buildDir/distributions") | ||
include archiveName | ||
rename archiveName, "${packageName}-${version}.deb" | ||
doLast { delete file("$buildDir/distributions/$archiveName") } | ||
} | ||
} | ||
|
||
task buildPackages(type: GradleBuild) { | ||
tasks = ['build', 'buildRpm', 'buildDeb'] | ||
} | ||
} | ||
|
||
// updateVersion: Task to auto increment to the next development iteration | ||
task updateVersion { | ||
onlyIf { System.getProperty('newVersion') } | ||
doLast { | ||
ext.newVersion = System.getProperty('newVersion') | ||
println "Setting version to ${newVersion}." | ||
// String tokenization to support -SNAPSHOT | ||
ant.replaceregexp(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) { | ||
fileset(dir: projectDir) { | ||
// Include the required files that needs to be updated with new Version | ||
include(name: "bwc-test/build.gradle") | ||
} | ||
} | ||
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) | ||
} | ||
} |