mirror of
https://github.com/elastic/logstash.git
synced 2025-06-28 09:46:03 -04:00
Cover all #system invokation with exit code checking, eventually failing the execution of Rake task (#14782)
Covers all invocations of system Ruby method inside artifcts.rake script to check the exit status and eventually raise an exception.
This commit is contained in:
parent
7a39d97055
commit
720996fa7c
1 changed files with 22 additions and 14 deletions
|
@ -126,6 +126,14 @@ namespace "artifact" do
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# execute Kernel#system call,checking the exist status of the executed command and eventually reporting as exception
|
||||||
|
def safe_system(*args)
|
||||||
|
if !system(*args)
|
||||||
|
status = $?
|
||||||
|
raise "Got exit status #{status.exitstatus} attempting to execute #{args.inspect}!"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc "Generate rpm, deb, tar and zip artifacts"
|
desc "Generate rpm, deb, tar and zip artifacts"
|
||||||
task "all" => ["prepare", "build"]
|
task "all" => ["prepare", "build"]
|
||||||
task "docker_only" => ["prepare", "build_docker_full", "build_docker_oss", "build_docker_ubi8"]
|
task "docker_only" => ["prepare", "build_docker_full", "build_docker_oss", "build_docker_ubi8"]
|
||||||
|
@ -139,7 +147,7 @@ namespace "artifact" do
|
||||||
create_archive_pack(license_details, "arm64", "linux", "darwin")
|
create_archive_pack(license_details, "arm64", "linux", "darwin")
|
||||||
|
|
||||||
#without JDK
|
#without JDK
|
||||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||||
@bundles_jdk = false
|
@bundles_jdk = false
|
||||||
build_tar(*license_details, platform: '-no-jdk')
|
build_tar(*license_details, platform: '-no-jdk')
|
||||||
build_zip(*license_details, platform: '-no-jdk')
|
build_zip(*license_details, platform: '-no-jdk')
|
||||||
|
@ -153,7 +161,7 @@ namespace "artifact" do
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_single_archive_pack(os_name, arch, license_details)
|
def create_single_archive_pack(os_name, arch, license_details)
|
||||||
system("./gradlew copyJdk -Pjdk_bundle_os=#{os_name} -Pjdk_arch=#{arch}")
|
safe_system("./gradlew copyJdk -Pjdk_bundle_os=#{os_name} -Pjdk_arch=#{arch}")
|
||||||
if arch == 'arm64'
|
if arch == 'arm64'
|
||||||
arch = 'aarch64'
|
arch = 'aarch64'
|
||||||
end
|
end
|
||||||
|
@ -165,15 +173,15 @@ namespace "artifact" do
|
||||||
when "darwin"
|
when "darwin"
|
||||||
build_tar(*license_details, platform: "-darwin-#{arch}")
|
build_tar(*license_details, platform: "-darwin-#{arch}")
|
||||||
end
|
end
|
||||||
system("./gradlew deleteLocalJdk -Pjdk_bundle_os=#{os_name}")
|
safe_system("./gradlew deleteLocalJdk -Pjdk_bundle_os=#{os_name}")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create an archive pack using settings appropriate for the running machine
|
# Create an archive pack using settings appropriate for the running machine
|
||||||
def create_local_archive_pack(bundle_jdk)
|
def create_local_archive_pack(bundle_jdk)
|
||||||
@bundles_jdk = bundle_jdk
|
@bundles_jdk = bundle_jdk
|
||||||
system("./gradlew copyJdk") if bundle_jdk
|
safe_system("./gradlew copyJdk") if bundle_jdk
|
||||||
build_tar('ELASTIC-LICENSE')
|
build_tar('ELASTIC-LICENSE')
|
||||||
system("./gradlew deleteLocalJdk") if bundle_jdk
|
safe_system("./gradlew deleteLocalJdk") if bundle_jdk
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,7 +205,7 @@ namespace "artifact" do
|
||||||
|
|
||||||
#without JDK
|
#without JDK
|
||||||
@bundles_jdk = false
|
@bundles_jdk = false
|
||||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||||
build_tar(*license_details, platform: '-no-jdk')
|
build_tar(*license_details, platform: '-no-jdk')
|
||||||
build_zip(*license_details, platform: '-no-jdk')
|
build_zip(*license_details, platform: '-no-jdk')
|
||||||
end
|
end
|
||||||
|
@ -214,7 +222,7 @@ namespace "artifact" do
|
||||||
|
|
||||||
#without JDKs
|
#without JDKs
|
||||||
@bundles_jdk = false
|
@bundles_jdk = false
|
||||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||||
package("centos")
|
package("centos")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -230,7 +238,7 @@ namespace "artifact" do
|
||||||
|
|
||||||
#without JDKs
|
#without JDKs
|
||||||
@bundles_jdk = false
|
@bundles_jdk = false
|
||||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||||
package("centos", :oss)
|
package("centos", :oss)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -247,7 +255,7 @@ namespace "artifact" do
|
||||||
|
|
||||||
#without JDKs
|
#without JDKs
|
||||||
@bundles_jdk = false
|
@bundles_jdk = false
|
||||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||||
package("ubuntu")
|
package("ubuntu")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -263,7 +271,7 @@ namespace "artifact" do
|
||||||
|
|
||||||
#without JDKs
|
#without JDKs
|
||||||
@bundles_jdk = false
|
@bundles_jdk = false
|
||||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||||
package("ubuntu", :oss)
|
package("ubuntu", :oss)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -528,9 +536,9 @@ namespace "artifact" do
|
||||||
end
|
end
|
||||||
|
|
||||||
def package_with_jdk(platform, jdk_arch, variant=:standard)
|
def package_with_jdk(platform, jdk_arch, variant=:standard)
|
||||||
system("./gradlew copyJdk -Pjdk_bundle_os=linux -Pjdk_arch=#{jdk_arch}")
|
safe_system("./gradlew copyJdk -Pjdk_bundle_os=linux -Pjdk_arch=#{jdk_arch}")
|
||||||
package(platform, variant, true, jdk_arch)
|
package(platform, variant, true, jdk_arch)
|
||||||
system('./gradlew deleteLocalJdk -Pjdk_bundle_os=linux')
|
safe_system('./gradlew deleteLocalJdk -Pjdk_bundle_os=linux')
|
||||||
end
|
end
|
||||||
|
|
||||||
def package(platform, variant=:standard, bundle_jdk=false, jdk_arch='x86_64')
|
def package(platform, variant=:standard, bundle_jdk=false, jdk_arch='x86_64')
|
||||||
|
@ -746,7 +754,7 @@ namespace "artifact" do
|
||||||
"BUILD_DATE" => BUILD_DATE
|
"BUILD_DATE" => BUILD_DATE
|
||||||
}
|
}
|
||||||
Dir.chdir("docker") do |dir|
|
Dir.chdir("docker") do |dir|
|
||||||
system(env, "make build-from-local-#{flavor}-artifacts")
|
safe_system(env, "make build-from-local-#{flavor}-artifacts")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -758,7 +766,7 @@ namespace "artifact" do
|
||||||
"BUILD_DATE" => BUILD_DATE
|
"BUILD_DATE" => BUILD_DATE
|
||||||
}
|
}
|
||||||
Dir.chdir("docker") do |dir|
|
Dir.chdir("docker") do |dir|
|
||||||
system(env, "make public-dockerfiles_#{flavor}")
|
safe_system(env, "make public-dockerfiles_#{flavor}")
|
||||||
puts "Dockerfiles created in #{env['ARTIFACTS_DIR']}"
|
puts "Dockerfiles created in #{env['ARTIFACTS_DIR']}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue