From 75ad868cbdae67bb571cd9278b3bb998ac8fb4dd Mon Sep 17 00:00:00 2001
From: Hans Feldt <2808287+hafe@users.noreply.github.com>
Date: Tue, 7 Jul 2020 21:32:01 +0200
Subject: [PATCH] crio: harden downloads with retry (#6374)

CI job 624031102 failed with:

fatal: [ubuntu1804]: FAILED! => {"changed": false, "msg": "Failed to download key at https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_18.04/Release.key: Request failed: <urlopen error [Errno -3] Temporary failure in name resolution>"}

Assuming its a temporary problem it should get more robust with a
couple of retries like in other roles.

Co-authored-by: Hans Feldt <hafe@users.noreply.github.com>
---
 roles/container-engine/cri-o/tasks/crio_repo.yml | 4 ++++
 roles/container-engine/cri-o/tasks/main.yaml     | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/roles/container-engine/cri-o/tasks/crio_repo.yml b/roles/container-engine/cri-o/tasks/crio_repo.yml
index 60cfae99f..05bb62bf8 100644
--- a/roles/container-engine/cri-o/tasks/crio_repo.yml
+++ b/roles/container-engine/cri-o/tasks/crio_repo.yml
@@ -10,6 +10,10 @@
     url: "https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/{{ crio_kubic_debian_repo_name }}/Release.key"
     state: present
   when: crio_kubic_debian_repo_name is defined
+  register: apt_key_download
+  until: apt_key_download is succeeded
+  retries: 4
+  delay: "{{ retry_stagger | d(3) }}"
 
 - name: Add CRI-O kubic repo
   apt_repository:
diff --git a/roles/container-engine/cri-o/tasks/main.yaml b/roles/container-engine/cri-o/tasks/main.yaml
index 095206270..af0ecb92e 100644
--- a/roles/container-engine/cri-o/tasks/main.yaml
+++ b/roles/container-engine/cri-o/tasks/main.yaml
@@ -47,6 +47,10 @@
   when: not is_ostree
   with_items: "{{ crio_packages }}"
   notify: restart crio
+  register: package_install
+  until: package_install is succeeded
+  retries: 4
+  delay: "{{ retry_stagger | d(3) }}"
 
 - name: Gather the rpm package facts
   package_facts:
-- 
GitLab