Skip to content

Commit 313eb98

Browse files
authored
Merge pull request #1119 from IBM/sov-core
#1117 Retry download of case files
2 parents 38f8af8 + b594f60 commit 313eb98

2 files changed

Lines changed: 53 additions & 14 deletions

File tree

automation-roles/50-install-cloud-pak/cp4d/cp4d-case-save/tasks/main.yml

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,73 @@
22
- include_role:
33
name: cp4d-variables
44

5+
- set_fact:
6+
_from_oci: True
7+
8+
- set_fact:
9+
_from_oci: False
10+
when: _cp_alt_repo_used | default(False)
11+
512
# Get preview of case-download to ensure the patch files are downloaded when --dry-run was selected
613
- block:
714
- set_fact:
815
_case_download_command: "{{ lookup('template', 'case-download.j2') }}"
916
vars:
1017
_p_preview: True
11-
1218
- name: Run preview of download case files to obtain patch files
1319
shell: |
1420
{{ _case_download_command }}
1521
failed_when: False
1622
environment:
1723
OLM_UTILS_IMAGE: "{{ _olm_utils_image_full }}"
24+
25+
rescue:
26+
27+
- set_fact:
28+
_from_oci: False
29+
30+
- set_fact:
31+
_case_download_command: "{{ lookup('template', 'case-download.j2') }}"
32+
- name: Run preview of download case files to obtain patch files after failure from OCI download
33+
shell: |
34+
{{ _case_download_command }}
35+
failed_when: False
36+
environment:
37+
OLM_UTILS_IMAGE: "{{ _olm_utils_image_full }}"
1838
when: cpd_dry_run | bool
1939

20-
- name: Generate case-download command to download case files
21-
set_fact:
22-
_case_download_command: "{{ lookup('template', 'case-download.j2') }}"
40+
- block:
41+
- name: Generate case-download command to download case files
42+
set_fact:
43+
_case_download_command: "{{ lookup('template', 'case-download.j2') }}"
2344

24-
- include_role:
25-
name: run-command
26-
vars:
27-
_p_command_description: Download case files
28-
_p_command: "{{ _case_download_command }}"
29-
_p_command_log_file: "{{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-case-download.log"
30-
_p_command_environment:
31-
OLM_UTILS_IMAGE: "{{ _olm_utils_image_full }}"
32-
_p_cpd_cli_manage: True
45+
- include_role:
46+
name: run-command
47+
vars:
48+
_p_command_description: Download case files
49+
_p_command: "{{ _case_download_command }}"
50+
_p_command_log_file: "{{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-case-download.log"
51+
_p_command_environment:
52+
OLM_UTILS_IMAGE: "{{ _olm_utils_image_full }}"
53+
_p_cpd_cli_manage: True
54+
55+
rescue:
56+
- set_fact:
57+
_from_oci: False
58+
59+
- name: Generate case-download command to download case files from GitHub after failure from OCI download
60+
set_fact:
61+
_case_download_command: "{{ lookup('template', 'case-download.j2') }}"
62+
63+
- include_role:
64+
name: run-command
65+
vars:
66+
_p_command_description: Download case files from GitHub
67+
_p_command: "{{ _case_download_command }}"
68+
_p_command_log_file: "{{ status_dir }}/log/{{ _p_current_cp4d_cluster.project }}-case-download.log"
69+
_p_command_environment:
70+
OLM_UTILS_IMAGE: "{{ _olm_utils_image_full }}"
71+
_p_cpd_cli_manage: True
3372

3473
- name: Remove {{ status_dir }}/work/offline to remove any previous CASE files
3574
ansible.builtin.file:

automation-roles/50-install-cloud-pak/cp4d/cp4d-case-save/templates/case-download.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
case-download \
22
--release={{ _p_cp4d_version }} \
3-
{% if not (_cp_alt_repo_used | default(False)) -%}
3+
{% if _from_oci | bool -%}
44
--from_oci=true \
55
{% endif -%}
66
{% if _p_cp4d_version >= '5.3.0' -%}

0 commit comments

Comments
 (0)