From 14416702339010c27af4eae87e125ed01604267e Mon Sep 17 00:00:00 2001 From: Steve Kieu Date: Tue, 4 Aug 2020 10:05:50 +1000 Subject: [PATCH 1/3] make-download-requirements-more-stable - Change the order of executing the task download-requirements.yml after we populate the directory /tmp/epi-repository-setup-scripts. I have hit a situation (many times when re-run from the current system) that this role failed because the script core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh this part ``` repos_backup_file="/tmp/epi-repository-setup-scripts/enable-system-repos.sh" if [[ ! -f /etc/apt/sources.list ]]; then if [[ -f /var/tmp/enabled-system-repos.tar ]] && [[ -f ${repos_backup_file} ]]; then echol "OS repositories seems missing, restoring..." ${repos_backup_file} else echol "/etc/apt/sources.list seems missing, you either know what you're doing or you need to fix your repositories" fi fi ``` It comes to the the part `/etc/apt/sources.list seems missing, you either know what you're doing or you need to fix your repositories` As you can see this relies on the /tmp/epi-repository-setup-scripts/enable-system-repos.sh. - Set DEBIAN_FRONTEND=noninteractive for download-requirements.sh A similar PR has been addressed this issues but in different place and because that run before this stage the problem is hidden because these dependencies packages are already install (libssl). However if you re-run it on existing system it might happen again. Or in some combination situation it happened again. IMHO there is no side effect of adding this change to be sure we are not prompted by apt for whatever reason. --- .../ubuntu-18.04/download-requirements.sh | 1 + .../playbooks/roles/repository/tasks/setup.yml | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh index b1ebaf55f0..263054e5f7 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh @@ -1,6 +1,7 @@ #!/bin/bash set -euo pipefail +export DEBIAN_FRONTEND=noninteractive if [[ $# -lt 1 ]]; then usage diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/setup.yml b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/setup.yml index 62c1a37a60..b5f059e9e0 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/setup.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/setup.yml @@ -39,9 +39,6 @@ dest: /tmp/epi-download-requirements/download-requirements.sh mode: a+x - - name: Download Epiphany requirements - include_tasks: download-requirements.yml - when: - not offline_mode - not custom_repository_url @@ -74,6 +71,15 @@ - not custom_repository_url - inventory_hostname in target_repository_hostnames +# Put it down here as the script download-requirements.sh relies on some files +# in the folder /tmp/epi-repository-setup-scripts that until now it should be available +- name: Download Epiphany requirements + include_tasks: download-requirements.yml + when: + - not offline_mode + - not custom_repository_url + - inventory_hostname in target_repository_hostnames + - name: Set up repositories include_tasks: "{{ ansible_os_family }}/setup.yml" From a868a9c135eebac1683735e63d1fd4d6f06b1fc9 Mon Sep 17 00:00:00 2001 From: Steve Kieu Date: Mon, 17 Aug 2020 13:39:36 +1000 Subject: [PATCH 2/3] Re-try skopeo download for Ubuntu-18.04 We did the similar already on Centos and Redhat (twice). I set it to 5 times for Ubuntu. Reason is I randomly got error downloading images - see the issue https://github.com/epiphany-platform/skopeo-bin/issues/7 for more information. --- .../ubuntu-18.04/download-requirements.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh index 263054e5f7..d48be4b9ca 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh @@ -147,7 +147,17 @@ else printf "\n" # download images using skopeo while IFS= read -r image_name; do - download_image "${image_name}" "${dst_dir_images}" + let "trycount=0" + while [ $trycount -lt 5 ]; do + let "trycount=$trycount + 1" + download_image "${image_name}" "${dst_dir_images}" + if [ $? == 0 ]; then + break + else + echo "skopeo download failed. Retry in 5 secs for 5 times" + sleep 5 + fi + done done <<< "${images}" fi From 97eeecff4e5561f2002459902ee8eef057a3ddce Mon Sep 17 00:00:00 2001 From: Steve Kieu Date: Mon, 17 Aug 2020 23:01:05 +1000 Subject: [PATCH 3/3] Just retry second time to match with others OS download scripts --- .../ubuntu-18.04/download-requirements.sh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh index d48be4b9ca..f65b8efb96 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/ubuntu-18.04/download-requirements.sh @@ -147,17 +147,11 @@ else printf "\n" # download images using skopeo while IFS= read -r image_name; do - let "trycount=0" - while [ $trycount -lt 5 ]; do - let "trycount=$trycount + 1" + download_image "${image_name}" "${dst_dir_images}" + if [ $? != 0 ]; then + echo "Skopeo download error, retrying..." download_image "${image_name}" "${dst_dir_images}" - if [ $? == 0 ]; then - break - else - echo "skopeo download failed. Retry in 5 secs for 5 times" - sleep 5 - fi - done + fi done <<< "${images}" fi