Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore default apt sources once stemcell is built #384

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bosh-stemcell/lib/bosh/stemcell/stage_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def softlayer_stages
def finish_stemcell_stages
[
:bosh_package_list,
:restore_apt_sources,
]
end

Expand Down
14 changes: 12 additions & 2 deletions bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module Bosh::Stemcell
:image_install_grub,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
}
let(:aws_package_stemcell_stages) {
Expand Down Expand Up @@ -127,6 +128,7 @@ module Bosh::Stemcell
:image_install_grub,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
}

Expand Down Expand Up @@ -160,6 +162,7 @@ module Bosh::Stemcell
:image_install_grub,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
}

Expand Down Expand Up @@ -196,6 +199,7 @@ module Bosh::Stemcell
:image_install_grub,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
)
expect(stage_collection.package_stemcell_stages('qcow2')).to eq(
Expand Down Expand Up @@ -227,6 +231,7 @@ module Bosh::Stemcell
:image_install_grub,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
)
expect(stage_collection.package_stemcell_stages('qcow2')).to eq(
Expand Down Expand Up @@ -257,6 +262,7 @@ module Bosh::Stemcell
:image_install_grub_efi,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
)
expect(stage_collection.package_stemcell_stages('ovf')).to eq(vmware_package_stemcell_steps)
Expand Down Expand Up @@ -285,6 +291,7 @@ module Bosh::Stemcell
:image_install_grub_efi,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
)
expect(stage_collection.package_stemcell_stages('ovf')).to eq(vmware_package_stemcell_steps)
Expand All @@ -310,6 +317,7 @@ module Bosh::Stemcell
:image_install_grub,
:sbom_create,
:bosh_package_list,
:restore_apt_sources,
]
}

Expand Down Expand Up @@ -348,7 +356,8 @@ module Bosh::Stemcell
:bosh_clean_ssh,
:image_create_softlayer_two_partitions,
:image_install_grub_softlayer_two_partitions,
:bosh_package_list
:bosh_package_list,
:restore_apt_sources,
]
)
expect(stage_collection.package_stemcell_stages('ovf')).to eq(vmware_package_stemcell_steps)
Expand All @@ -368,7 +377,8 @@ module Bosh::Stemcell
:image_create,
:image_install_grub,
:sbom_create,
:bosh_package_list
:bosh_package_list,
:restore_apt_sources,
]
}
let(:package_stemcell_stages) {
Expand Down
15 changes: 15 additions & 0 deletions stemcell_builder/stages/restore_apt_sources/apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e

base_dir=$(readlink -nf $(dirname $0)/../..)
source $base_dir/lib/prelude_apply.bash

mount --bind /sys "$chroot/sys"
add_on_exit "umount $chroot/sys"

cat > "$chroot/etc/apt/sources.list" <<EOS
deb http://archive.ubuntu.com/ubuntu $DISTRIB_CODENAME main universe multiverse
deb http://archive.ubuntu.com/ubuntu $DISTRIB_CODENAME-updates main universe multiverse
deb http://security.ubuntu.com/ubuntu $DISTRIB_CODENAME-security main universe multiverse
EOS