File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ def ovf_options
6161 def environment_variables
6262 {
6363 "UBUNTU_ISO" => environment [ "UBUNTU_ISO" ] ,
64- "UBUNTU_MIRROR " => environment [ "UBUNTU_MIRROR " ] ,
64+ "UBUNTU_DEBOOTSTRAP_MIRROR " => environment [ "UBUNTU_DEBOOTSTRAP_MIRROR " ] ,
6565 "UBUNTU_ADVANTAGE_TOKEN" => environment [ "UBUNTU_ADVANTAGE_TOKEN" ] ,
6666 "UBUNTU_FIPS_USE_IAAS_KERNEL" => environment [ "UBUNTU_FIPS_USE_IAAS_KERNEL" ]
6767 }
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ def self.it_sets_correct_environment_variables
6464 let ( :env ) do
6565 {
6666 "UBUNTU_ISO" => "fake_ubuntu_iso" ,
67- "UBUNTU_MIRROR " => "fake_ubuntu_mirror" ,
67+ "UBUNTU_DEBOOTSTRAP_MIRROR " => "fake_ubuntu_mirror" ,
6868 "RUBY_BIN" => "fake_ruby_bin"
6969 }
7070 end
@@ -76,7 +76,7 @@ def self.it_sets_correct_environment_variables
7676 expect ( result [ "stemcell_infrastructure" ] ) . to eq ( infrastructure . name )
7777 expect ( result [ "stemcell_hypervisor" ] ) . to eq ( infrastructure . hypervisor )
7878 expect ( result [ "UBUNTU_ISO" ] ) . to eq ( "fake_ubuntu_iso" )
79- expect ( result [ "UBUNTU_MIRROR " ] ) . to eq ( "fake_ubuntu_mirror" )
79+ expect ( result [ "UBUNTU_DEBOOTSTRAP_MIRROR " ] ) . to eq ( "fake_ubuntu_mirror" )
8080 expect ( result [ "ruby_bin" ] ) . to eq ( "fake_ruby_bin" )
8181 expect ( result [ "image_create_disk_size" ] ) . to eq ( default_disk_size )
8282 expect ( result [ "os_image_tgz" ] ) . to eq ( "fake/os_image.tgz" )
Original file line number Diff line number Diff line change @@ -248,6 +248,7 @@ jobs:
248248 params :
249249 OPERATING_SYSTEM_NAME : ubuntu
250250 OPERATING_SYSTEM_VERSION : (@= data.values.stemcell_details.os_short_name @)
251+ UBUNTU_DEBOOTSTRAP_MIRROR : http://gce.archive.ubuntu.com/ubuntu # Ubuntu's GCP-internal mirror, must change if we change Concourse IaaS!
251252 privileged : true
252253 vars :
253254 image_os_tag : (@= data.values.stemcell_details.os_short_name @)
Original file line number Diff line number Diff line change @@ -19,3 +19,4 @@ params:
1919 OPERATING_SYSTEM_VERSION : replace-me
2020 ESM_TOKEN :
2121 UBUNTU_ADVANTAGE_TOKEN :
22+ UBUNTU_DEBOOTSTRAP_MIRROR :
Original file line number Diff line number Diff line change 2222# Mark /opt/bosh as a safe git repo to avoid "fatal: unsafe repository ('/opt/bosh' is owned by someone else)"
2323git config --global --add safe.directory /opt/bosh
2424
25+ # Apt retry / timeout options applied to every apt-get invocation during the
26+ # build. Passed via -o so nothing leaks into the resulting OS image, and so
27+ # that flaky upstream mirrors (notably snapshot.ubuntu.com) don't take down
28+ # multi-hour builds on a single transient 503. Acquire::Retries::Delay=true
29+ # enables exponential backoff (apt >= 2.0).
30+ APT_RETRY_OPTS=' -o Acquire::Retries=10 -o Acquire::Retries::Delay=true -o Acquire::http::Timeout=120 -o Acquire::https::Timeout=120'
31+
2532function pkg_mgr {
26- run_in_chroot $chroot " apt-get update"
27- run_in_chroot $chroot " export DEBIAN_FRONTEND=noninteractive; apt-get --fix-broken --no-install-recommends --assume-yes $* "
33+ run_in_chroot $chroot " apt-get $APT_RETRY_OPTS update"
34+ run_in_chroot $chroot " export DEBIAN_FRONTEND=noninteractive; apt-get $APT_RETRY_OPTS --fix-broken --no-install-recommends --assume-yes $* "
2835 run_in_chroot $chroot " apt-get clean"
2936}
3037
3138# checks if an OS package with the given name exists in the current database of available packages.
3239# returns 0 if package exists (whether or not is is installed); 1 otherwise
3340function pkg_exists {
34- run_in_chroot $chroot " apt-get update"
41+ run_in_chroot $chroot " apt-get $APT_RETRY_OPTS update"
3542 result=` run_in_chroot $chroot " if apt-cache show $1 2>/dev/null >/dev/null; then echo exists; else echo does not exist; fi" `
3643 if [[ " $result " == * " exists" * ]]; then
3744 return 0
Original file line number Diff line number Diff line change 2222function ua_attach() {
2323 echo " Setting up Ubuntu Advantage ..."
2424
25- DEBIAN_FRONTEND=noninteractive run_in_chroot ${chroot} " apt-get install --assume-yes ubuntu-pro-client"
25+ DEBIAN_FRONTEND=noninteractive run_in_chroot ${chroot} " apt-get $APT_RETRY_OPTS install --assume-yes ubuntu-pro-client"
2626
2727 run_in_chroot ${chroot} " ua attach --no-auto-enable ${UBUNTU_ADVANTAGE_TOKEN} "
2828}
@@ -117,7 +117,7 @@ PSUEDO_GRUB_PROBE
117117
118118function mock_grub_probe() {
119119 # make sure /usr/sbin/grub-probe is installed in the chroot
120- DEBIAN_FRONTEND=noninteractive run_in_chroot ${chroot} " apt-get install --assume-yes grub-common"
120+ DEBIAN_FRONTEND=noninteractive run_in_chroot ${chroot} " apt-get $APT_RETRY_OPTS install --assume-yes grub-common"
121121 gprobe=" ${chroot} /usr/sbin/grub-probe"
122122 if [ -f " ${gprobe} " ]; then
123123 mv " ${gprobe} " " ${gprobe} .dist"
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ cleanup_debootstrap() {
7676}
7777trap cleanup_debootstrap EXIT
7878
79- debootstrap --arch=" $base_debootstrap_arch " " $base_debootstrap_suite " " $chroot " " "
79+ debootstrap --arch=" $base_debootstrap_arch " " $base_debootstrap_suite " " $chroot " " ${UBUNTU_DEBOOTSTRAP_MIRROR :- } "
8080
8181cleanup_debootstrap
8282trap - EXIT
Original file line number Diff line number Diff line change 1313 persist UBUNTU_ISO
1414fi
1515
16- if [ ! -z " ${UBUNTU_MIRROR :- } " ]
16+ if [ ! -z " ${UBUNTU_DEBOOTSTRAP_MIRROR :- } " ]
1717then
18- persist UBUNTU_MIRROR
18+ persist UBUNTU_DEBOOTSTRAP_MIRROR
1919fi
2020
2121base_debootstrap_arch=amd64
You can’t perform that action at this time.
0 commit comments