diff --git a/Gemfile b/Gemfile index 5158c13c83..f9f5f9b8f9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ -source 'https://rubygems.org' +source "https://rubygems.org" -gem 'rake' -gem 'bosh-stemcell', path: 'bosh-stemcell' +gem "rake" +gem "bosh-stemcell", path: "bosh-stemcell" +gem "standard" diff --git a/Gemfile.lock b/Gemfile.lock index 13e22691e4..d30f29a39d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,8 +9,20 @@ PATH GEM remote: https://rubygems.org/ specs: + ast (2.4.3) diff-lcs (1.6.2) + json (2.19.8) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + parallel (1.28.0) + parser (3.3.11.1) + ast (~> 2.4.1) + racc + prism (1.9.0) + racc (1.8.1) + rainbow (3.1.1) rake (13.4.2) + regexp_parser (2.12.0) rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -27,6 +39,40 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.7) + rubocop (1.84.2) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.49.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.1) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + ruby-progressbar (1.13.0) + standard (1.54.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.84.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.8) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.9.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.26.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) PLATFORMS ruby @@ -34,6 +80,7 @@ PLATFORMS DEPENDENCIES bosh-stemcell! rake + standard BUNDLED WITH 2.5.23 diff --git a/Rakefile b/Rakefile index 287b1ae269..61e3f80865 100644 --- a/Rakefile +++ b/Rakefile @@ -1,111 +1,108 @@ -require 'json' +require "json" +require "standard/rake" namespace :stemcell do - desc 'Build a base OS image for use in stemcells' + desc "Build a base OS image for use in stemcells" task :build_os_image, [:operating_system_name, :operating_system_version, :os_image_path] do |_, args| - begin - require 'bosh/stemcell/archive_handler' - require 'bosh/stemcell/build_environment' - require 'bosh/stemcell/definition' - require 'bosh/stemcell/os_image_builder' - require 'bosh/stemcell/stage_collection' - require 'bosh/stemcell/stage_runner' - - definition = Bosh::Stemcell::Definition.for('null', 'null', args.operating_system_name, args.operating_system_version) - environment = Bosh::Stemcell::BuildEnvironment.new( - ENV.to_hash, - definition, - '', - args.os_image_path, - ) - collection = Bosh::Stemcell::StageCollection.new(definition) - runner = Bosh::Stemcell::StageRunner.new( - build_path: environment.build_path, - command_env: environment.command_env, - settings_file: environment.settings_path, - work_path: environment.work_path, - ) - archive_handler = Bosh::Stemcell::ArchiveHandler.new - - builder = Bosh::Stemcell::OsImageBuilder.new( - environment: environment, - collection: collection, - runner: runner, - archive_handler: archive_handler, - ) - builder.build(args.os_image_path) - - sh(environment.os_image_rspec_command) - rescue RuntimeError => e - print_help - raise e - end + require "bosh/stemcell/archive_handler" + require "bosh/stemcell/build_environment" + require "bosh/stemcell/definition" + require "bosh/stemcell/os_image_builder" + require "bosh/stemcell/stage_collection" + require "bosh/stemcell/stage_runner" + + definition = Bosh::Stemcell::Definition.for("null", "null", args.operating_system_name, args.operating_system_version) + environment = Bosh::Stemcell::BuildEnvironment.new( + ENV.to_hash, + definition, + "", + args.os_image_path + ) + collection = Bosh::Stemcell::StageCollection.new(definition) + runner = Bosh::Stemcell::StageRunner.new( + build_path: environment.build_path, + command_env: environment.command_env, + settings_file: environment.settings_path, + work_path: environment.work_path + ) + archive_handler = Bosh::Stemcell::ArchiveHandler.new + + builder = Bosh::Stemcell::OsImageBuilder.new( + environment: environment, + collection: collection, + runner: runner, + archive_handler: archive_handler + ) + builder.build(args.os_image_path) + + sh(environment.os_image_rspec_command) + rescue RuntimeError => e + print_help + raise e end - desc 'Build a stemcell, requires `os_image_path` pointing at an image created via `stemcell:build_os_image`' + desc "Build a stemcell, requires `os_image_path` pointing at an image created via `stemcell:build_os_image`" task :build, [:infrastructure_name, :hypervisor_name, :operating_system_name, :operating_system_version, :os_image_path, :build_number] do |_, args| - begin - require 'bosh/stemcell/build_environment' - require 'bosh/stemcell/definition' - require 'bosh/stemcell/stage_collection' - require 'bosh/stemcell/stage_runner' - require 'bosh/stemcell/stemcell_packager' - require 'bosh/stemcell/stemcell_builder' - - args.with_defaults(build_number: '0000') - - definition = Bosh::Stemcell::Definition.for(args.infrastructure_name, args.hypervisor_name, args.operating_system_name, args.operating_system_version) - environment = Bosh::Stemcell::BuildEnvironment.new( - ENV.to_hash, - definition, - args.build_number, - args.os_image_path, - ) - - sh(environment.os_image_rspec_command) - - puts "Working from #{environment.work_path}..." - puts "########################################" - runner = Bosh::Stemcell::StageRunner.new( - build_path: environment.build_path, - command_env: environment.command_env, - settings_file: environment.settings_path, - work_path: environment.work_path, - ) - - stemcell_building_stages = Bosh::Stemcell::StageCollection.new(definition) - - builder = Bosh::Stemcell::StemcellBuilder.new( - environment: environment, - runner: runner, - definition: definition, - collection: stemcell_building_stages - ) - - packager = Bosh::Stemcell::StemcellPackager.new( - definition: definition, - version: environment.version, - work_path: environment.work_path, - tarball_path: environment.stemcell_tarball_path, - disk_size: environment.stemcell_disk_size, - runner: runner, - collection: stemcell_building_stages, - ) - - builder.build - - mkdir_p('tmp') - definition.disk_formats.each do |disk_format| - puts "Packaging #{disk_format}..." - stemcell_tarball = packager.package(disk_format) - cp(stemcell_tarball, 'tmp') - end - - sh(environment.stemcell_rspec_command) - rescue RuntimeError => e - print_help - raise e + require "bosh/stemcell/build_environment" + require "bosh/stemcell/definition" + require "bosh/stemcell/stage_collection" + require "bosh/stemcell/stage_runner" + require "bosh/stemcell/stemcell_packager" + require "bosh/stemcell/stemcell_builder" + + args.with_defaults(build_number: "0000") + + definition = Bosh::Stemcell::Definition.for(args.infrastructure_name, args.hypervisor_name, args.operating_system_name, args.operating_system_version) + environment = Bosh::Stemcell::BuildEnvironment.new( + ENV.to_hash, + definition, + args.build_number, + args.os_image_path + ) + + sh(environment.os_image_rspec_command) + + puts "Working from #{environment.work_path}..." + puts "########################################" + runner = Bosh::Stemcell::StageRunner.new( + build_path: environment.build_path, + command_env: environment.command_env, + settings_file: environment.settings_path, + work_path: environment.work_path + ) + + stemcell_building_stages = Bosh::Stemcell::StageCollection.new(definition) + + builder = Bosh::Stemcell::StemcellBuilder.new( + environment: environment, + runner: runner, + definition: definition, + collection: stemcell_building_stages + ) + + packager = Bosh::Stemcell::StemcellPackager.new( + definition: definition, + version: environment.version, + work_path: environment.work_path, + tarball_path: environment.stemcell_tarball_path, + disk_size: environment.stemcell_disk_size, + runner: runner, + collection: stemcell_building_stages + ) + + builder.build + + mkdir_p("tmp") + definition.disk_formats.each do |disk_format| + puts "Packaging #{disk_format}..." + stemcell_tarball = packager.package(disk_format) + cp(stemcell_tarball, "tmp") end + + sh(environment.stemcell_rspec_command) + rescue RuntimeError => e + print_help + raise e end def print_help diff --git a/ci/tasks/light-aws/merge-builds b/ci/tasks/light-aws/merge-builds index e309dfad1e..c3129b6706 100755 --- a/ci/tasks/light-aws/merge-builds +++ b/ci/tasks/light-aws/merge-builds @@ -5,23 +5,23 @@ # from different regions, by concatenating the 'ami' field in # the manifest -require 'yaml' +require "yaml" require "tmpdir" -output_dir=File.expand_path("light-stemcell") +output_dir = File.expand_path("light-stemcell") -merged_amis = {} +merged_amis = {} def run_command(cmd) - result = `#{cmd}` + `#{cmd}` if $?.exitstatus > 0 abort("Failed to execute #{cmd}") end end -Dir['*-stemcell'].each do | tarball_dir | - next if tarball_dir == 'light-stemcell' - Dir.mktmpdir do | temp_dir | +Dir["*-stemcell"].each do |tarball_dir| + next if tarball_dir == "light-stemcell" + Dir.mktmpdir do |temp_dir| matches = Dir.glob("#{tarball_dir}/*.tgz") if matches.length == 0 abort("Empty glob for '#{tarball_dir}/*.tgz'") @@ -32,11 +32,11 @@ Dir['*-stemcell'].each do | tarball_dir | run_command("tar -xvf #{tarball_path} -C #{temp_dir}") yaml = YAML.load_file("#{temp_dir}/stemcell.MF") - ami = yaml['cloud_properties']['ami'] + ami = yaml["cloud_properties"]["ami"] merged_amis = ami.merge(merged_amis) - yaml['cloud_properties']['ami'] = merged_amis + yaml["cloud_properties"]["ami"] = merged_amis - File.open("#{temp_dir}/stemcell.MF",'w') do |s| + File.open("#{temp_dir}/stemcell.MF", "w") do |s| s.puts yaml.to_yaml end diff --git a/image-metalinks/ubuntu-jammy/ubuntu-jammy.meta4 b/image-metalinks/ubuntu-jammy/ubuntu-jammy.meta4 index 15aa9f9399..e3c1ce3653 100644 --- a/image-metalinks/ubuntu-jammy/ubuntu-jammy.meta4 +++ b/image-metalinks/ubuntu-jammy/ubuntu-jammy.meta4 @@ -1,22 +1,22 @@ - 42839cba8c0e8a878a99ceb6510f05f9fc12508a0ac5c4717c8ebc069cc335a4a66b8a2fe9768c7f902d1c2a83fef5409dc499800c412ff7d9c2a862fc8c7d0d - 7d931685698ea2057b94bd5cd17efc30882f17cfe854e87fef0db097f1613eec - 4c7cff6b6d6f856029272df4aac248f089517925 - da82c0e47915227ef9249a9fd0969a59 - 435158569 + a4723f68c3983a07387047755d0582d0130047a62a8d7a318dd1610bbff1c543d671c7e174dfd22f68c5f4c05ea3100caa88e8c7af0e5a8961288ac31438f24a + 65f10525abda4d1de0bed4dcb9caf1088bde3d73bcd9659837e2e512d761464b + 2dabf413f0e4e7ec9a14fe74e1b021e6764103b9 + 298a0ab23a4eec94e6e038acd900053e + 435176889 https://storage.googleapis.com/bosh-os-images/ubuntu-jammy/ubuntu-jammy.tgz - 1071.0.0 + 1073.0.0 - 6fa9675c2b3c22b64badb93c2ee70e20bad40885b039d36ed5c76f8cb0eeca53d989bec6c175da3ab3562fb85e3136d1a92b171bb424abb7df254b8c35593cb6 - 3669345fd17eb55f5d24d91d03db629dfcc16f9b3b11a7ff25fa1b04d4c8a816 - b392882697abcac18613e8563c3c6dff302f1d38 - 5272c121657f6d6bca9c30c883e64506 - 3151 + 44018019582146fc17ac3f15c277be6986afd613e481b8483cf41e838fbdfce25520364d6a3fe83400b5b838cd51b720e0484599bccc95e315fc146df1b29931 + 166958059b90ff741397215786f92d69b735a6b7f613f98c4c6b10306ad07445 + 7ca97dd2ef670f4156c38678e7fdcf504a9b4461 + 03de9e337af1c22d0e6cb40a01cc117d + 32713 https://storage.googleapis.com/bosh-os-images/ubuntu-jammy/usn-log.json - 1071.0.0 + 1073.0.0 metalink-repository-resource/0.0.0 - 2026-06-04T14:28:57.581750129Z + 2026-06-05T12:47:10.912349145Z