mirror of
https://github.com/elastic/logstash.git
synced 2025-04-19 04:15:23 -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
|
||||
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"
|
||||
task "all" => ["prepare", "build"]
|
||||
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")
|
||||
|
||||
#without JDK
|
||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
||||
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||
@bundles_jdk = false
|
||||
build_tar(*license_details, platform: '-no-jdk')
|
||||
build_zip(*license_details, platform: '-no-jdk')
|
||||
|
@ -153,7 +161,7 @@ namespace "artifact" do
|
|||
end
|
||||
|
||||
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'
|
||||
arch = 'aarch64'
|
||||
end
|
||||
|
@ -165,15 +173,15 @@ namespace "artifact" do
|
|||
when "darwin"
|
||||
build_tar(*license_details, platform: "-darwin-#{arch}")
|
||||
end
|
||||
system("./gradlew deleteLocalJdk -Pjdk_bundle_os=#{os_name}")
|
||||
safe_system("./gradlew deleteLocalJdk -Pjdk_bundle_os=#{os_name}")
|
||||
end
|
||||
|
||||
# Create an archive pack using settings appropriate for the running machine
|
||||
def create_local_archive_pack(bundle_jdk)
|
||||
@bundles_jdk = bundle_jdk
|
||||
system("./gradlew copyJdk") if bundle_jdk
|
||||
safe_system("./gradlew copyJdk") if bundle_jdk
|
||||
build_tar('ELASTIC-LICENSE')
|
||||
system("./gradlew deleteLocalJdk") if bundle_jdk
|
||||
safe_system("./gradlew deleteLocalJdk") if bundle_jdk
|
||||
end
|
||||
|
||||
|
||||
|
@ -197,7 +205,7 @@ namespace "artifact" do
|
|||
|
||||
#without JDK
|
||||
@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_zip(*license_details, platform: '-no-jdk')
|
||||
end
|
||||
|
@ -214,7 +222,7 @@ namespace "artifact" do
|
|||
|
||||
#without JDKs
|
||||
@bundles_jdk = false
|
||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
||||
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||
package("centos")
|
||||
end
|
||||
|
||||
|
@ -230,7 +238,7 @@ namespace "artifact" do
|
|||
|
||||
#without JDKs
|
||||
@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)
|
||||
end
|
||||
|
||||
|
@ -247,7 +255,7 @@ namespace "artifact" do
|
|||
|
||||
#without JDKs
|
||||
@bundles_jdk = false
|
||||
system("./gradlew bootstrap") #force the build of Logstash jars
|
||||
safe_system("./gradlew bootstrap") #force the build of Logstash jars
|
||||
package("ubuntu")
|
||||
end
|
||||
|
||||
|
@ -263,7 +271,7 @@ namespace "artifact" do
|
|||
|
||||
#without JDKs
|
||||
@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)
|
||||
end
|
||||
|
||||
|
@ -528,9 +536,9 @@ namespace "artifact" do
|
|||
end
|
||||
|
||||
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)
|
||||
system('./gradlew deleteLocalJdk -Pjdk_bundle_os=linux')
|
||||
safe_system('./gradlew deleteLocalJdk -Pjdk_bundle_os=linux')
|
||||
end
|
||||
|
||||
def package(platform, variant=:standard, bundle_jdk=false, jdk_arch='x86_64')
|
||||
|
@ -746,7 +754,7 @@ namespace "artifact" do
|
|||
"BUILD_DATE" => BUILD_DATE
|
||||
}
|
||||
Dir.chdir("docker") do |dir|
|
||||
system(env, "make build-from-local-#{flavor}-artifacts")
|
||||
safe_system(env, "make build-from-local-#{flavor}-artifacts")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -758,7 +766,7 @@ namespace "artifact" do
|
|||
"BUILD_DATE" => BUILD_DATE
|
||||
}
|
||||
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']}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue