Determine latest base image available

Closes-Bug: #1900884
Closes-Bug: #1900975
Change-Id: I362a15397fee891d967ce7150819b02312200d2e
This commit is contained in:
Dmitriy Rabotyagov 2020-10-22 12:26:44 +03:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent a6476c3f5b
commit 46e10d21f1
5 changed files with 26 additions and 3 deletions

View File

@ -201,7 +201,7 @@ lxc_image_cache_server_mirrors:
- https://images.linuxcontainers.org
# URL for the image to build our containers
lxc_hosts_container_image_url: "{{ _lxc_hosts_container_image_url }}"
lxc_hosts_container_image_url: "{{ _lxc_hosts_container_image_url | default('') }}"
# If enabled the image will be fetched from the legacy [images.linuxcontainers.org].
lxc_hosts_container_image_download_legacy: false

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Since Ubuntu has dropped older base images, which resulted in all previous
tags being broken, we've switched to downloading always latest base image
available. This should guarantee that we retrieve relevant images only.

View File

@ -41,6 +41,19 @@
when:
- lxc_hosts_container_image_download_legacy | bool
- name: Determine lxc_hosts_container_image_url when it is not explicitly set
set_fact:
lxc_hosts_container_image_url: "{{ _lxc_hosts_container_image_url_base ~ '/' ~ lookup('url', _lxc_hosts_container_image_url_base ~ '/' ~ _lxc_hosts_container_image_checksum_file) | regex_findall(_lxc_hosts_container_image_checksum_regexp) | max }}"
register: image_url
retries: 3
delay: 1
until: image_url is success
when:
- not lxc_hosts_container_image_url | bool
- _lxc_hosts_container_image_url_base is defined
- _lxc_hosts_container_image_checksum_file is defined
- _lxc_hosts_container_image_checksum_regexp is defined
- name: Set LXC cache basename
set_fact:
cache_basename: "{{ lxc_hosts_container_image_url | basename }}"

View File

@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_lxc_hosts_container_image_url: "http://cdimage.ubuntu.com/ubuntu-base/releases/18.04/release/ubuntu-base-18.04.3-base-{{ lxc_cache_map.arch }}.tar.gz"
_lxc_hosts_container_image_url_base: "http://cdimage.ubuntu.com/ubuntu-base/releases/18.04/release"
_lxc_hosts_container_image_checksum_file: SHA256SUMS
_lxc_hosts_container_image_checksum_regexp: "ubuntu-base-18.04.[0-9]-base-{{ lxc_cache_map.arch }}.tar.gz"
_lxc_cache_map:
distro: ubuntu

View File

@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_lxc_hosts_container_image_url: "http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04-base-{{ lxc_cache_map.arch }}.tar.gz"
_lxc_hosts_container_image_url_base: "http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release"
_lxc_hosts_container_image_checksum_file: SHA256SUMS
_lxc_hosts_container_image_checksum_regexp: "ubuntu-base-20.04.[0-9]-base-{{ lxc_cache_map.arch }}.tar.gz"
_lxc_cache_map:
distro: ubuntu