Skip to content

Commit

Permalink
WIP Add debug logging and enforce x86_64 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
jrafanie committed Jan 9, 2024
1 parent 0a95075 commit d8e8854
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
21 changes: 21 additions & 0 deletions bin/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,60 @@
git_ref = opts[:git_ref]

# Setup source repos and build environment
puts "XXX #{Time.now.utc} SetupSourceRepos "
ManageIQ::RPMBuild::SetupSourceRepos.new(git_ref).populate
puts "XXX #{Time.now.utc} SetupSourceRepos DONE"

# Generate 'ansible-venv' contents
puts "XXX #{Time.now.utc} GenerateAnsibleVenv "
ManageIQ::RPMBuild::GenerateAnsibleVenv.new.populate
puts "XXX #{Time.now.utc} GenerateAnsibleVenv DONE"

# Generate 'gemset' contents
puts "XXX #{Time.now.utc} GenerateGemSet "
gemset = ManageIQ::RPMBuild::GenerateGemSet.new
gemset.backup_environment_variables
gemset.set_environment_variables
gemset.recreate_gem_home
gemset.populate_gem_home(build_type)
puts "XXX #{Time.now.utc} GenerateGemSet DONE"

# Generate 'core' contents
puts "XXX #{Time.now.utc} GenerateCore "
ManageIQ::RPMBuild::GenerateCore.new.populate
puts "XXX #{Time.now.utc} GenerateCore DONE"

# Scrub the gemset only after it is used to generate 'core' contents
puts "XXX #{Time.now.utc} gemset scrub "
gemset.scrub
puts "XXX #{Time.now.utc} gemset scrub DONE"

# Create tarballs
puts "XXX #{Time.now.utc} GenerateTarFiles create_tarballs "
ManageIQ::RPMBuild::GenerateTarFiles.new.create_tarballs
puts "XXX #{Time.now.utc} GenerateTarFiles create_tarballs DONE"

# Generate manifest with license info for gems and npm packages
puts "XXX #{Time.now.utc} generate_dependency_manifest "
gemset.generate_dependency_manifest
puts "XXX #{Time.now.utc} generate_dependency_manifest DONE"

puts "XXX #{Time.now.utc} restore_environment_variables "
gemset.restore_environment_variables
puts "XXX #{Time.now.utc} restore_environment_variables DONE"

# Create manifest tarball
puts "XXX #{Time.now.utc} GenerateTarFiles create_manifest_tarball "
ManageIQ::RPMBuild::GenerateTarFiles.new.create_manifest_tarball
puts "XXX #{Time.now.utc} GenerateTarFiles create_manifest_tarball DONE"

puts "\n\nTARBALL BUILT SUCCESSFULLY"

# Build RPMs
release_name = build_type == "release" ? git_ref : ""
puts "XXX #{Time.now.utc} BuildCopr generate_rpm "
ManageIQ::RPMBuild::BuildCopr.new(release_name).generate_rpm
puts "XXX #{Time.now.utc} BuildCopr generate_rpm DONE"

if opts[:update_rpm_repo]
ManageIQ::RPMBuild::BuildUploader.new(:release => build_type == "release").upload
Expand Down
2 changes: 1 addition & 1 deletion bin/build_container_image
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ IMAGE_NAME=${IMAGE_NAME:-"$DEFAULT_IMAGE_NAME"}

set -e

docker build . -t $IMAGE_NAME
docker build --platform=linux/x86_64 . -t $IMAGE_NAME

[[ -z "$REGISTRY_USERNAME" ]] && exit 0

Expand Down
8 changes: 7 additions & 1 deletion container-assets/user-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ fi

cd /build_scripts
bundle
$cmd
echo $cmd
$cmd &

while sleep 30
do
echo "XXX $(date -u) Time check"
done
4 changes: 2 additions & 2 deletions lib/manageiq/rpm_build/build_copr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def generate_rpm
generate_spec_from_template

if File.exist?(File.expand_path("~/.config/copr"))
shell_cmd("rpmbuild -bs --define '_sourcedir #{RPM_SPEC_DIR}' --define '_srcrpmdir #{RPM_SPEC_DIR}' #{rpm_spec}")
shell_cmd("rpmbuild -bs -vv --define '_sourcedir #{RPM_SPEC_DIR}' --define '_srcrpmdir #{RPM_SPEC_DIR}' #{rpm_spec}")
shell_cmd("copr-cli build -r epel-8-x86_64 #{rpm_repo_name} #{OPTIONS.product_name}-*.src.rpm")
else
arch = RUBY_PLATFORM.split("-").first
shell_cmd("rpmbuild -ba --define '_sourcedir #{RPM_SPEC_DIR}' --define '_srcrpmdir #{BUILD_DIR.join("rpms", arch)}' --define '_rpmdir #{BUILD_DIR.join("rpms")}' #{rpm_spec}")
shell_cmd("rpmbuild -ba -vv --define '_sourcedir #{RPM_SPEC_DIR}' --define '_srcrpmdir #{BUILD_DIR.join("rpms", arch)}' --define '_rpmdir #{BUILD_DIR.join("rpms")}' #{rpm_spec}")
end
end
end
Expand Down
11 changes: 11 additions & 0 deletions lib/manageiq/rpm_build/generate_tar_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ class GenerateTarFiles
include Helper

def create_tarballs
puts "XXX #{Time.now.utc} create_core_tarball"
create_core_tarball
puts "XXX #{Time.now.utc} create_core_tarball DONE"

puts "XXX #{Time.now.utc} create_gemset_tarball"
create_gemset_tarball
puts "XXX #{Time.now.utc} create_gemset_tarball DONE"

puts "XXX #{Time.now.utc} create_appliance_tarball"
create_appliance_tarball
puts "XXX #{Time.now.utc} create_appliance_tarball DONE"

puts "XXX #{Time.now.utc} create_ansible_venv_tarball"
create_ansible_venv_tarball
puts "XXX #{Time.now.utc} create_ansible_venv_tarball DONE"
end

def create_gemset_tarball
Expand Down

0 comments on commit d8e8854

Please sign in to comment.