mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
Use patched nebula os package gradle plugin (#100280)
There is a bug in the nebula os package gradle plugin that breaks copy spec specific setgid handling. We have created a patch for the plugin that we use for now to unblock us. This will be ported upstream to the nebula main branch and part of a release but that requires some more polishing and will be taken care of in a later PR
This commit is contained in:
parent
9f72ce0278
commit
d214d74000
2 changed files with 41 additions and 19 deletions
|
@ -42,10 +42,20 @@ import java.util.regex.Pattern
|
||||||
* dpkg -c path/to/elasticsearch.deb
|
* dpkg -c path/to/elasticsearch.deb
|
||||||
*/
|
*/
|
||||||
|
|
||||||
plugins {
|
buildscript {
|
||||||
id "com.netflix.nebula.ospackage-base" version "11.5.0"
|
repositories {
|
||||||
|
maven {
|
||||||
|
url 'https://jitpack.io'
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "com.github.breskeby:gradle-ospackage-plugin:2da19425133"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: "com.netflix.nebula.ospackage-base"
|
||||||
|
|
||||||
['deb', 'rpm'].each { type ->
|
['deb', 'rpm'].each { type ->
|
||||||
String packagingFiles = "build/packaging/${type}"
|
String packagingFiles = "build/packaging/${type}"
|
||||||
|
|
||||||
|
@ -56,14 +66,14 @@ plugins {
|
||||||
with copySpec {
|
with copySpec {
|
||||||
from 'src/common'
|
from 'src/common'
|
||||||
from "src/${type}"
|
from "src/${type}"
|
||||||
filter("tokens" : expansionsForDistribution(type, false), ReplaceTokens.class)
|
filter("tokens": expansionsForDistribution(type, false), ReplaceTokens.class)
|
||||||
}
|
}
|
||||||
|
|
||||||
into('etc/elasticsearch') {
|
into('etc/elasticsearch') {
|
||||||
with configFiles(type, false)
|
with configFiles(type, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
filter("tokens" : expansionsForDistribution(type, false), ReplaceTokens.class)
|
filter("tokens": expansionsForDistribution(type, false), ReplaceTokens.class)
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
// create empty dirs, we set the permissions when configuring the packages
|
// create empty dirs, we set the permissions when configuring the packages
|
||||||
|
@ -92,22 +102,22 @@ def commonPackageConfig(String type, String architecture) {
|
||||||
if (architecture == 'x64') {
|
if (architecture == 'x64') {
|
||||||
arch('amd64')
|
arch('amd64')
|
||||||
} else {
|
} else {
|
||||||
assert architecture == 'aarch64' : architecture
|
assert architecture == 'aarch64': architecture
|
||||||
arch('arm64')
|
arch('arm64')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert type == 'rpm' : type
|
assert type == 'rpm': type
|
||||||
if (architecture == 'x64') {
|
if (architecture == 'x64') {
|
||||||
arch('X86_64')
|
arch('X86_64')
|
||||||
} else {
|
} else {
|
||||||
assert architecture == 'aarch64' : architecture
|
assert architecture == 'aarch64': architecture
|
||||||
arch('aarch64')
|
arch('aarch64')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Follow elasticsearch's file naming convention
|
// Follow elasticsearch's file naming convention
|
||||||
String prefix = "${architecture == 'aarch64' ? 'aarch64-' : ''}${type}"
|
String prefix = "${architecture == 'aarch64' ? 'aarch64-' : ''}${type}"
|
||||||
destinationDirectory = file("${prefix}/build/distributions")
|
destinationDirectory = file("${prefix}/build/distributions")
|
||||||
archiveFileName.value(project.provider({ "${packageName}-${project.version}-${archString}.${type}" } ))
|
archiveFileName.value(project.provider({ "${packageName}-${project.version}-${archString}.${type}" }))
|
||||||
String packagingFiles = "build/packaging/${type}"
|
String packagingFiles = "build/packaging/${type}"
|
||||||
|
|
||||||
String scripts = "${packagingFiles}/scripts"
|
String scripts = "${packagingFiles}/scripts"
|
||||||
|
@ -184,9 +194,9 @@ def commonPackageConfig(String type, String architecture) {
|
||||||
configurationFile '/etc/elasticsearch/users_roles'
|
configurationFile '/etc/elasticsearch/users_roles'
|
||||||
from("${packagingFiles}") {
|
from("${packagingFiles}") {
|
||||||
dirMode 02750
|
dirMode 02750
|
||||||
setgid = true
|
|
||||||
into('/etc')
|
into('/etc')
|
||||||
permissionGroup 'elasticsearch'
|
permissionGroup 'elasticsearch'
|
||||||
|
setgid true
|
||||||
includeEmptyDirs true
|
includeEmptyDirs true
|
||||||
createDirectoryEntry true
|
createDirectoryEntry true
|
||||||
include("elasticsearch") // empty dir, just to add directory entry
|
include("elasticsearch") // empty dir, just to add directory entry
|
||||||
|
@ -243,7 +253,7 @@ def commonPackageConfig(String type, String architecture) {
|
||||||
user u
|
user u
|
||||||
permissionGroup g
|
permissionGroup g
|
||||||
dirMode = mode
|
dirMode = mode
|
||||||
setgid = mode == 02750
|
setgid (mode == 02750)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
copyEmptyDir('/var/log/elasticsearch', 'elasticsearch', 'elasticsearch', 02750)
|
copyEmptyDir('/var/log/elasticsearch', 'elasticsearch', 'elasticsearch', 02750)
|
||||||
|
@ -402,7 +412,7 @@ subprojects {
|
||||||
} else {
|
} else {
|
||||||
assert project.name.contains('rpm')
|
assert project.name.contains('rpm')
|
||||||
tasks.named("checkExtraction").configure {
|
tasks.named("checkExtraction").configure {
|
||||||
onlyIf("rpm exists", rpmExists)
|
onlyIf("rpm exists", rpmExists)
|
||||||
final File rpmDatabase = new File(extractionDir, 'rpm-database')
|
final File rpmDatabase = new File(extractionDir, 'rpm-database')
|
||||||
commandLine 'rpm',
|
commandLine 'rpm',
|
||||||
'--badreloc',
|
'--badreloc',
|
||||||
|
@ -434,9 +444,11 @@ subprojects {
|
||||||
copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/elasticsearch/copyright")
|
copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/elasticsearch/copyright")
|
||||||
expectedLicense = "Elastic-License"
|
expectedLicense = "Elastic-License"
|
||||||
licenseFilename = "ELASTIC-LICENSE-2.0.txt"
|
licenseFilename = "ELASTIC-LICENSE-2.0.txt"
|
||||||
final List<String> header = Arrays.asList("Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/",
|
final List<String> header = Arrays.asList(
|
||||||
|
"Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/",
|
||||||
"Copyright: Elasticsearch B.V. <info@elastic.co>",
|
"Copyright: Elasticsearch B.V. <info@elastic.co>",
|
||||||
"License: " + expectedLicense)
|
"License: " + expectedLicense
|
||||||
|
)
|
||||||
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
|
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
|
||||||
final List<String> expectedLines = header + licenseLines.collect { " " + it }
|
final List<String> expectedLines = header + licenseLines.collect { " " + it }
|
||||||
assertLinesInFile(copyrightPath, expectedLines)
|
assertLinesInFile(copyrightPath, expectedLines)
|
||||||
|
|
|
@ -36,6 +36,11 @@
|
||||||
<sha256 value="d083479ca927dce2f586f779373d895e8bf668c632505740279390384edf03fa" origin="Generated by Gradle"/>
|
<sha256 value="d083479ca927dce2f586f779373d895e8bf668c632505740279390384edf03fa" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.breskeby" name="gradle-ospackage-plugin" version="2da19425133">
|
||||||
|
<artifact name="gradle-ospackage-plugin-2da19425133.jar">
|
||||||
|
<sha256 value="452e01bc961259e2a0f5d6f193a03cc8d29f560a433f7c8066158c97d3327af9" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="adoptium_8" name="linux" version="8u302">
|
<component group="adoptium_8" name="linux" version="8u302">
|
||||||
<artifact name="linux-8u302-aarch64.tar.gz">
|
<artifact name="linux-8u302-aarch64.tar.gz">
|
||||||
<sha256 value="f287cdc2a688c2df247ea0d8bfe2863645b73848e4e5c35b02a8a3d2d6b69551" origin="Generated by Gradle"/>
|
<sha256 value="f287cdc2a688c2df247ea0d8bfe2863645b73848e4e5c35b02a8a3d2d6b69551" origin="Generated by Gradle"/>
|
||||||
|
@ -69,11 +74,11 @@
|
||||||
<sha256 value="10fe288fd7a2cdaf5175332b73529f9abf8fd54dcfff317d6967c0c35ffb133b" origin="Generated by Gradle"/>
|
<sha256 value="10fe288fd7a2cdaf5175332b73529f9abf8fd54dcfff317d6967c0c35ffb133b" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
<component group="co.elastic.apm" name="elastic-apm-agent" version="1.43.0">
|
<component group="co.elastic.apm" name="elastic-apm-agent" version="1.43.0">
|
||||||
<artifact name="elastic-apm-agent-1.43.0.jar">
|
<artifact name="elastic-apm-agent-1.43.0.jar">
|
||||||
<sha256 value="a9910a9589b2cceb9a41936e297bb41c6aeef5496f7ba26017ba489291aa4aa8" origin="Generated by Gradle"/>
|
<sha256 value="a9910a9589b2cceb9a41936e297bb41c6aeef5496f7ba26017ba489291aa4aa8" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
<component group="co.elastic.logging" name="ecs-logging-core" version="1.2.0">
|
<component group="co.elastic.logging" name="ecs-logging-core" version="1.2.0">
|
||||||
<artifact name="ecs-logging-core-1.2.0.jar">
|
<artifact name="ecs-logging-core-1.2.0.jar">
|
||||||
<sha256 value="0d6318af29848ea588b1c244834e3e762315c68de2bcfc9f1adf3f0633d22d37" origin="Generated by Gradle"/>
|
<sha256 value="0d6318af29848ea588b1c244834e3e762315c68de2bcfc9f1adf3f0633d22d37" origin="Generated by Gradle"/>
|
||||||
|
@ -351,6 +356,11 @@
|
||||||
<sha256 value="d6eb9f2f40049a7a808baf11ffba0737648e62ff52fde9271d808e5d57a27279" origin="Generated by Gradle"/>
|
<sha256 value="d6eb9f2f40049a7a808baf11ffba0737648e62ff52fde9271d808e5d57a27279" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.breskeby" name="gradle-ospackage-plugin" version="2da19425133">
|
||||||
|
<artifact name="gradle-ospackage-plugin-2da19425133.jar">
|
||||||
|
<sha256 value="452e01bc961259e2a0f5d6f193a03cc8d29f560a433f7c8066158c97d3327af9" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.javaparser" name="javaparser-core" version="3.18.0">
|
<component group="com.github.javaparser" name="javaparser-core" version="3.18.0">
|
||||||
<artifact name="javaparser-core-3.18.0.jar">
|
<artifact name="javaparser-core-3.18.0.jar">
|
||||||
<sha256 value="df7e2d5b8319efd51d015ab5071a271f8463158bc2f0979d05393fe028d856a0" origin="Generated by Gradle"/>
|
<sha256 value="df7e2d5b8319efd51d015ab5071a271f8463158bc2f0979d05393fe028d856a0" origin="Generated by Gradle"/>
|
||||||
|
@ -2614,7 +2624,7 @@
|
||||||
<sha256 value="82f63d40db2aad15f748bf988214d44477167ec1a0388dd258c4c8a8f74797d2" origin="Generated by Gradle"/>
|
<sha256 value="82f63d40db2aad15f748bf988214d44477167ec1a0388dd258c4c8a8f74797d2" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
<component group="org.apache.lucene" name="lucene-analysis-stempel" version="9.8.0">
|
<component group="org.apache.lucene" name="lucene-analysis-stempel" version="9.8.0">
|
||||||
<artifact name="lucene-analysis-stempel-9.8.0.jar">
|
<artifact name="lucene-analysis-stempel-9.8.0.jar">
|
||||||
<sha256 value="4ee9f4fccd710c8d51827b54747e4134f600fd00ad96ae9c3c6d97122807e18c" origin="Generated by Gradle"/>
|
<sha256 value="4ee9f4fccd710c8d51827b54747e4134f600fd00ad96ae9c3c6d97122807e18c" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue