From 288b148babb70c08719353cb3ae1493939a965e0 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 13:43:37 +1000 Subject: [PATCH 01/39] ITSD-94667 Debug --- .../tasks/jira-servicedesk_as_obr.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 3905a44..37b0f79 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -21,6 +21,14 @@ debug: msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" +- name: Set atl_obr_download_url + set_fact: + atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + +- name: url lookup splits lines by default + debug: msg="{{item}}" + loop: "{{ lookup('url', '{{atl_obr_download_url}}', wantlist=True) }}" + - name: how about getting the obr filename debug: msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" @@ -28,6 +36,7 @@ - name: is shared_home set ? debug: msg="atl_product_home_shared_download_dir={{ atl_product_home_shared_download_dir }}" + # For the first run a temp obr should be downloaded but moved to # shared home to ensure all subsequent nodes have access # to the same specific version binary. @@ -38,7 +47,6 @@ set_fact: download_obr: true move_obr: false - atl_obr_download_href: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" atl_obr_download: "{{ atl_installer_temp }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" atl_obr_shared_download: "{{ atl_product_home_shared_download_dir }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" @@ -73,7 +81,7 @@ # Fetch obr and copy to temp - name: Fetch obr get_url: - url: "{{ atl_obr_download_href }}" + url: "{{ atl_obr_download_url }}" dest: "{{ atl_obr_download }}" mode: 0755 force: false From e3a6edf7e38c4c8bbfc01e33a56051985862869b Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 15:25:27 +1000 Subject: [PATCH 02/39] ITSD-94667 Debug --- roles/product_install/tasks/jira-servicedesk_as_obr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 37b0f79..25ded0a 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -20,8 +20,6 @@ - name: Show the returned obr binary href debug: msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" - -- name: Set atl_obr_download_url set_fact: atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" From 7e197aa3fa8298b7cf29c8cd3e7f95726adaac2c Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 15:29:46 +1000 Subject: [PATCH 03/39] ITSD-94667 Debug Tue 14 Jun 2022 15:29:46 AEST --- .../tasks/jira-servicedesk_as_obr.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 25ded0a..8a5d2fa 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -20,17 +20,19 @@ - name: Show the returned obr binary href debug: msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + +- name: Set atl_obr_download_url set_fact: atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" -- name: url lookup splits lines by default - debug: msg="{{item}}" - loop: "{{ lookup('url', '{{atl_obr_download_url}}', wantlist=True) }}" - -- name: how about getting the obr filename +- name: Show the obr filename debug: msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" +- name: Set the obr filename + set_fact: + atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + - name: is shared_home set ? debug: msg="atl_product_home_shared_download_dir={{ atl_product_home_shared_download_dir }}" @@ -45,7 +47,6 @@ set_fact: download_obr: true move_obr: false - atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" atl_obr_download: "{{ atl_installer_temp }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" atl_obr_shared_download: "{{ atl_product_home_shared_download_dir }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" atl_obr_moving_lock: "{{ atl_product_home_shared_download_dir }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr_moving" From 5795626917e053e4f762c15943d240cf50c30c6a Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 15:33:30 +1000 Subject: [PATCH 04/39] ITSD-94667 Changed variables to be generic allowing for change to include download url --- roles/product_install/tasks/jira-servicedesk_as_obr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 8a5d2fa..a914cfb 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -47,10 +47,10 @@ set_fact: download_obr: true move_obr: false - atl_obr_download: "{{ atl_installer_temp }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" - atl_obr_shared_download: "{{ atl_product_home_shared_download_dir }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" - atl_obr_moving_lock: "{{ atl_product_home_shared_download_dir }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr_moving" - atl_obr_completed_lock: "{{ atl_product_home_shared_download_dir }}/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr_completed" + atl_obr_download: "{{ atl_installer_temp }}/{{ atl_obr_filename }}" + atl_obr_shared_download: "{{ atl_product_home_shared_download_dir }}/{{ atl_obr_filename }}.obr" + atl_obr_moving_lock: "{{ atl_product_home_shared_download_dir }}/{{ atl_obr_filename }}_moving" + atl_obr_completed_lock: "{{ atl_product_home_shared_download_dir }}/{{ atl_obr_filename }}_completed" # Check for pre-downloaded obr on shared_home and completed lock dir. - name: Check for completed lock directory From 0810460603b6b2f1fd53a9ff1b9c98e2f32b2145 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 15:53:10 +1000 Subject: [PATCH 05/39] ITSD-94667 Debug Tue 14 Jun 2022 15:53:10 AEST --- roles/product_install/defaults/main.yml | 1 + .../tasks/jira-servicedesk_as_obr.yml | 59 ++++++++++--------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/roles/product_install/defaults/main.yml b/roles/product_install/defaults/main.yml index e3a929c..c981b4f 100644 --- a/roles/product_install/defaults/main.yml +++ b/roles/product_install/defaults/main.yml @@ -37,6 +37,7 @@ atl_servicedesk_url_map: atl_servicedesk_metadata_url: "{{ atl_servicedesk_url_map[atl_product_version] | default(atl_servicedesk_url_map['default']) }}" atl_install_jsd_as_obr: false +atl_obr_download_url: '' atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk.{{ atl_product_version }}.obr" force_version_update: false diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index a914cfb..9605b64 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -1,37 +1,42 @@ --- -- name: Get the installer product version info - uri: - url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" - return_content: yes - register: atl_product_version_info +- name: Source jira-servicedesk obr from marketplace -- name: Show the returned build number - debug: - msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" + - name: Get the installer product version info + uri: + url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" + return_content: yes + register: atl_product_version_info -- name: Get the JSD build version info - uri: - url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ - jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" - return_content: yes - register: atl_jsd_build_info + - name: Show the returned build number + debug: + msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" -- name: Show the returned obr binary href - debug: - msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + - name: Get the JSD build version info + uri: + url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ + jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" + return_content: yes + register: atl_jsd_build_info -- name: Set atl_obr_download_url - set_fact: - atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + - name: Show the returned obr binary href + debug: + msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" -- name: Show the obr filename - debug: - msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + - name: Set atl_obr_download_url + set_fact: + atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" -- name: Set the obr filename - set_fact: - atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + - name: Show the obr filename + debug: + msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + + - name: Set the obr filename + set_fact: + atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + + when: + - atl_obr_download_url is undefined - name: is shared_home set ? debug: @@ -48,7 +53,7 @@ download_obr: true move_obr: false atl_obr_download: "{{ atl_installer_temp }}/{{ atl_obr_filename }}" - atl_obr_shared_download: "{{ atl_product_home_shared_download_dir }}/{{ atl_obr_filename }}.obr" + atl_obr_shared_download: "{{ atl_product_home_shared_download_dir }}/{{ atl_obr_filename }}" atl_obr_moving_lock: "{{ atl_product_home_shared_download_dir }}/{{ atl_obr_filename }}_moving" atl_obr_completed_lock: "{{ atl_product_home_shared_download_dir }}/{{ atl_obr_filename }}_completed" From b64553d4704b6f163fd2111460c8810c4cf6f0d9 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 15:55:46 +1000 Subject: [PATCH 06/39] ITSD-94667 Debug Tue 14 Jun 2022 15:55:46 AEST --- roles/product_install/tasks/jira-servicedesk_as_obr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 9605b64..de7d9dd 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -1,6 +1,7 @@ --- - name: Source jira-servicedesk obr from marketplace + block: - name: Get the installer product version info uri: From 333802066822ec2499295889bfaf86320fa0ce00 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 15:58:04 +1000 Subject: [PATCH 07/39] ITSD-94667 Debug Tue 14 Jun 2022 15:58:04 AEST --- roles/product_install/defaults/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/product_install/defaults/main.yml b/roles/product_install/defaults/main.yml index c981b4f..e3a929c 100644 --- a/roles/product_install/defaults/main.yml +++ b/roles/product_install/defaults/main.yml @@ -37,7 +37,6 @@ atl_servicedesk_url_map: atl_servicedesk_metadata_url: "{{ atl_servicedesk_url_map[atl_product_version] | default(atl_servicedesk_url_map['default']) }}" atl_install_jsd_as_obr: false -atl_obr_download_url: '' atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk.{{ atl_product_version }}.obr" force_version_update: false From 37b8a3b20dd70ec33e1005ac94404fcadc627379 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 16:01:22 +1000 Subject: [PATCH 08/39] ITSD-94667 Debug Tue 14 Jun 2022 16:01:22 AEST --- .../tasks/jira-servicedesk_as_obr.yml | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index de7d9dd..cf95455 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -3,38 +3,38 @@ - name: Source jira-servicedesk obr from marketplace block: - - name: Get the installer product version info - uri: - url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" - return_content: yes - register: atl_product_version_info + - name: Get the installer product version info + uri: + url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" + return_content: yes + register: atl_product_version_info - - name: Show the returned build number - debug: - msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" + - name: Show the returned build number + debug: + msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" - - name: Get the JSD build version info - uri: - url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ - jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" - return_content: yes - register: atl_jsd_build_info + - name: Get the JSD build version info + uri: + url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ + jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" + return_content: yes + register: atl_jsd_build_info - - name: Show the returned obr binary href - debug: - msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + - name: Show the returned obr binary href + debug: + msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" - - name: Set atl_obr_download_url - set_fact: - atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + - name: Set atl_obr_download_url + set_fact: + atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" - - name: Show the obr filename - debug: - msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + - name: Show the obr filename + debug: + msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" - - name: Set the obr filename - set_fact: - atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + - name: Set the obr filename + set_fact: + atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" when: - atl_obr_download_url is undefined From 4d59453466a90cf767d5ba5c894b1107e8450fea Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 16:05:57 +1000 Subject: [PATCH 09/39] ITSD-94667 Debug Tue 14 Jun 2022 16:05:57 AEST --- .../tasks/jira-servicedesk_as_obr.yml | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index cf95455..a2e11a8 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -1,43 +1,43 @@ --- -- name: Source jira-servicedesk obr from marketplace - block: +# - name: Source jira-servicedesk obr from marketplace +# block: - - name: Get the installer product version info - uri: - url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" - return_content: yes - register: atl_product_version_info +- name: Get the installer product version info + uri: + url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" + return_content: yes + register: atl_product_version_info - - name: Show the returned build number - debug: - msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" +- name: Show the returned build number + debug: + msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" - - name: Get the JSD build version info - uri: - url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ - jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" - return_content: yes - register: atl_jsd_build_info +- name: Get the JSD build version info + uri: + url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ + jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" + return_content: yes + register: atl_jsd_build_info - - name: Show the returned obr binary href - debug: - msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" +- name: Show the returned obr binary href + debug: + msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" - - name: Set atl_obr_download_url - set_fact: - atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" +- name: Set atl_obr_download_url + set_fact: + atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" - - name: Show the obr filename - debug: - msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" +- name: Show the obr filename + debug: + msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" - - name: Set the obr filename - set_fact: - atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" +- name: Set the obr filename + set_fact: + atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" - when: - - atl_obr_download_url is undefined + # when: + # - atl_obr_download_url is undefined - name: is shared_home set ? debug: From 1eabc7bbc4e68d82be8328ac8d81a45570d20160 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 16:17:36 +1000 Subject: [PATCH 10/39] ITSD-94667 Debug Tue 14 Jun 2022 16:17:36 AEST --- roles/product_install/defaults/main.yml | 1 + roles/product_install/tasks/jira-servicedesk_as_obr.yml | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/roles/product_install/defaults/main.yml b/roles/product_install/defaults/main.yml index e3a929c..a12666e 100644 --- a/roles/product_install/defaults/main.yml +++ b/roles/product_install/defaults/main.yml @@ -37,6 +37,7 @@ atl_servicedesk_url_map: atl_servicedesk_metadata_url: "{{ atl_servicedesk_url_map[atl_product_version] | default(atl_servicedesk_url_map['default']) }}" atl_install_jsd_as_obr: false +atl_marketplace_obr: true atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk.{{ atl_product_version }}.obr" force_version_update: false diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index a2e11a8..3e10f3f 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -3,6 +3,12 @@ # - name: Source jira-servicedesk obr from marketplace # block: +- name: Check for alternate obr download url + set_fact: + atl_marketplace_obr: false + when: + - atl_obr_download_url is defined + - name: Get the installer product version info uri: url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" From 0f5d1fb39bd6012d6d7655e00438b092b4be87bb Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 16:30:47 +1000 Subject: [PATCH 11/39] ITSD-94667 Debug Tue 14 Jun 2022 16:30:47 AEST --- roles/product_install/defaults/main.yml | 3 +- .../tasks/jira-servicedesk_as_obr.yml | 65 ++++++++++--------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/roles/product_install/defaults/main.yml b/roles/product_install/defaults/main.yml index a12666e..b9f7dbd 100644 --- a/roles/product_install/defaults/main.yml +++ b/roles/product_install/defaults/main.yml @@ -37,7 +37,8 @@ atl_servicedesk_url_map: atl_servicedesk_metadata_url: "{{ atl_servicedesk_url_map[atl_product_version] | default(atl_servicedesk_url_map['default']) }}" atl_install_jsd_as_obr: false -atl_marketplace_obr: true +atl_source_obr_from_marketplace: true +atl_source_obr_from_url: false atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk.{{ atl_product_version }}.obr" force_version_update: false diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 3e10f3f..40600f1 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -1,49 +1,50 @@ --- -# - name: Source jira-servicedesk obr from marketplace -# block: - - name: Check for alternate obr download url set_fact: - atl_marketplace_obr: false + atl_source_obr_from_marketplace: false + atl_source_obr_from_url: true when: - atl_obr_download_url is defined -- name: Get the installer product version info - uri: - url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" - return_content: yes - register: atl_product_version_info +- name: Source jira-servicedesk obr from marketplace + block: -- name: Show the returned build number - debug: - msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" + - name: Get the installer product version info + uri: + url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" + return_content: yes + register: atl_product_version_info -- name: Get the JSD build version info - uri: - url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ - jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" - return_content: yes - register: atl_jsd_build_info + - name: Show the returned build number + debug: + msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" -- name: Show the returned obr binary href - debug: - msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + - name: Get the JSD build version info + uri: + url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ + jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" + return_content: yes + register: atl_jsd_build_info -- name: Set atl_obr_download_url - set_fact: - atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + - name: Show the returned obr binary href + debug: + msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" -- name: Show the obr filename - debug: - msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + - name: Set atl_obr_download_url + set_fact: + atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" -- name: Set the obr filename - set_fact: - atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + - name: Show the obr filename + debug: + msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" - # when: - # - atl_obr_download_url is undefined + - name: Set the obr filename + set_fact: + atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + + when: + - atl_source_obr_from_marketplace - name: is shared_home set ? debug: From 2fad9592c3fa23c0d46d9a0a0d549948718eaf11 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 16:35:55 +1000 Subject: [PATCH 12/39] ITSD-94667 Debug Tue 14 Jun 2022 16:35:55 AEST --- .../tasks/jira-servicedesk_as_obr.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 40600f1..c764c30 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -46,6 +46,20 @@ when: - atl_source_obr_from_marketplace +- name: Source jira-servicedesk obr from alternate url + block: + + - name: Show the obr filename + debug: + msg="obr_name={{ atl_obr_download_url | basename }}" + + - name: Set the obr filename + set_fact: + atl_obr_filename: "{{ atl_obr_download_url | basename }}" + + when: + - atl_source_obr_from_url + - name: is shared_home set ? debug: msg="atl_product_home_shared_download_dir={{ atl_product_home_shared_download_dir }}" From e7774766eb45116b9b2387b02b5d09b7af661280 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 16:39:51 +1000 Subject: [PATCH 13/39] ITSD-94667 Debug Tue 14 Jun 2022 16:39:51 AEST --- .../tasks/jira-servicedesk_as_obr.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index c764c30..83bdbe9 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -10,36 +10,36 @@ - name: Source jira-servicedesk obr from marketplace block: - - name: Get the installer product version info + - name: Marketplace OBR - Get the installer product version info uri: url: "{{ atl_mpac_products }}/key/jira/versions/name/{{ atl_product_version }}" return_content: yes register: atl_product_version_info - - name: Show the returned build number + - name: Marketplace OBR - Show the returned build number debug: msg="buildNumber={{ atl_product_version_info.json.buildNumber }}" - - name: Get the JSD build version info + - name: Marketplace OBR - Get the JSD build version info uri: url: "{{ atl_mpac_products }}/key/jira-servicedesk/versions/latest?application=\ jira&applicationBuild={{ atl_product_version_info.json.buildNumber }}" return_content: yes register: atl_jsd_build_info - - name: Show the returned obr binary href + - name: Marketplace OBR - Show the returned obr binary href debug: msg="obr_ref={{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" - - name: Set atl_obr_download_url + - name: Marketplace OBR - Set atl_obr_download_url set_fact: atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" - - name: Show the obr filename + - name: Marketplace OBR - Show the obr filename debug: msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" - - name: Set the obr filename + - name: Marketplace OBR - Set the obr filename set_fact: atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" @@ -49,11 +49,11 @@ - name: Source jira-servicedesk obr from alternate url block: - - name: Show the obr filename + - name: Alternate URL OBR - Show the obr filename debug: msg="obr_name={{ atl_obr_download_url | basename }}" - - name: Set the obr filename + - name: Alternate URL OBR - Set the obr filename set_fact: atl_obr_filename: "{{ atl_obr_download_url | basename }}" From c305a14160874955c675b1f077bfdd8f3008fb77 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Tue, 14 Jun 2022 17:27:03 +1000 Subject: [PATCH 14/39] ITSD-94667 Add atl_jsd_build manual set for testing --- .../tasks/jira-servicedesk_as_obr.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 83bdbe9..41cb16b 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -35,13 +35,17 @@ set_fact: atl_obr_download_url: "{{ atl_jsd_build_info.json._embedded.artifact._links.binary.href }}" + - name: Marketplace OBR - Set atl_jsd_build + set_fact: + atl_jsd_build: "{{ atl_jsd_build_info.json.name }}" + - name: Marketplace OBR - Show the obr filename debug: - msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build }}.obr" - name: Marketplace OBR - Set the obr filename set_fact: - atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.obr" + atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build }}.obr" when: - atl_source_obr_from_marketplace @@ -57,6 +61,9 @@ set_fact: atl_obr_filename: "{{ atl_obr_download_url | basename }}" + - name: Alternate URL OBR - Show atl_jsd_build (manual) + debug: + msg="atl_jsd_build={{ atl_jsd_build }}" when: - atl_source_obr_from_url @@ -193,7 +200,7 @@ remote_src: true src: "{{ atl_obr_download }}" dest: "{{ atl_product_home_shared }}/plugins/installed-plugins" - creates: "{{ atl_product_home_shared }}/plugins/installed-plugins/jira-servicedesk-application-{{ atl_jsd_build_info.json.name }}.jar" + creates: "{{ atl_product_home_shared }}/plugins/installed-plugins/jira-servicedesk-application-{{ atl_jsd_build }}.jar" list_files: no exclude: - M* @@ -206,5 +213,5 @@ - name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed shell: cmd: "mv {{ atl_product_home_shared }}/plugins/installed-plugins/dependencies/*.jar {{ atl_product_home_shared }}/plugins/installed-plugins" - creates: "{{ atl_product_home_shared }}/plugins/installed-plugins/servicedesk-core-ui-plugin-{{ atl_jsd_build_info.json.name }}-*.jar" + creates: "{{ atl_product_home_shared }}/plugins/installed-plugins/servicedesk-core-ui-plugin-{{ atl_jsd_build }}-*.jar" when: obr_unpack.changed From 6eca144387031830d7d08094da46600202c5d99c Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Thu, 16 Jun 2022 11:36:06 +1000 Subject: [PATCH 15/39] ITSD-94667 Change boolean style using only one test for logic --- roles/product_install/defaults/main.yml | 1 - roles/product_install/tasks/jira-servicedesk_as_obr.yml | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/product_install/defaults/main.yml b/roles/product_install/defaults/main.yml index b9f7dbd..d768e62 100644 --- a/roles/product_install/defaults/main.yml +++ b/roles/product_install/defaults/main.yml @@ -38,7 +38,6 @@ atl_servicedesk_metadata_url: "{{ atl_servicedesk_url_map[atl_product_version] | atl_install_jsd_as_obr: false atl_source_obr_from_marketplace: true -atl_source_obr_from_url: false atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk.{{ atl_product_version }}.obr" force_version_update: false diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 41cb16b..c634da2 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -3,7 +3,6 @@ - name: Check for alternate obr download url set_fact: atl_source_obr_from_marketplace: false - atl_source_obr_from_url: true when: - atl_obr_download_url is defined @@ -48,7 +47,7 @@ atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build }}.obr" when: - - atl_source_obr_from_marketplace + - atl_source_obr_from_marketplace | bool - name: Source jira-servicedesk obr from alternate url block: @@ -65,7 +64,7 @@ debug: msg="atl_jsd_build={{ atl_jsd_build }}" when: - - atl_source_obr_from_url + - not atl_source_obr_from_marketplace | bool - name: is shared_home set ? debug: From eb51caec949a3cf34491a836cc8877d56bb78a92 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 12:25:43 +1000 Subject: [PATCH 16/39] ITSD-94667 Extra debug to show atl_product_version. Assume it can replace atl_jsd_build --- roles/product_install/tasks/jira-servicedesk_as_obr.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index c634da2..9417e01 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -63,6 +63,11 @@ - name: Alternate URL OBR - Show atl_jsd_build (manual) debug: msg="atl_jsd_build={{ atl_jsd_build }}" + + - name: Alernate URL OBR - Show atl_product_version + debug: + msg="atl_product_version={{ atl_product_version }}" + when: - not atl_source_obr_from_marketplace | bool From abf3aefd635d29b447d6df62127d82ccf2e9e213 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 13:16:31 +1000 Subject: [PATCH 17/39] ITSD-94667 Add molecule test for the case where an alternate url is provided for both the tarball and obr --- .../jira_all_version_url/Dockerfile.j2 | 14 ++++++ .../jira_all_version_url/converge.yml | 38 +++++++++++++++ .../jira_all_version_url/molecule.yml | 23 +++++++++ .../tests/test_default.py | 48 +++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 roles/product_install/molecule/jira_all_version_url/Dockerfile.j2 create mode 100644 roles/product_install/molecule/jira_all_version_url/converge.yml create mode 100644 roles/product_install/molecule/jira_all_version_url/molecule.yml create mode 100644 roles/product_install/molecule/jira_all_version_url/tests/test_default.py diff --git a/roles/product_install/molecule/jira_all_version_url/Dockerfile.j2 b/roles/product_install/molecule/jira_all_version_url/Dockerfile.j2 new file mode 100644 index 0000000..e6aa95d --- /dev/null +++ b/roles/product_install/molecule/jira_all_version_url/Dockerfile.j2 @@ -0,0 +1,14 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi diff --git a/roles/product_install/molecule/jira_all_version_url/converge.yml b/roles/product_install/molecule/jira_all_version_url/converge.yml new file mode 100644 index 0000000..ba8ebcc --- /dev/null +++ b/roles/product_install/molecule/jira_all_version_url/converge.yml @@ -0,0 +1,38 @@ +--- +- name: Converge + hosts: all + vars: + atl_product_family: "jira" + atl_product_edition: "jira-software" + atl_product_user: "jira" + # Version 8.14.0 is chosen deliberately as it is a version where jira and jira-software returns different buildNumber from MPAC + # See DCD-1216 for context + atl_product_version: "8.14.0" + atl_install_jsd_as_obr: true + + # This tests for an edge case where the product URL and OBR are source from a provided URL. + # Although marketplace (mpac) is used in this example, this could potentially be in a non mpac url. + # In this case it would not be possible to query atl_jsd_build_info to source the atl_jsd_build. One is therefore provided. + atl_source_obr_from_marketplace: false + atl_jsd_build: "8.14.0" + atl_product_download_url: "https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.14.0.tar.gz" + atl_obr_download_url: "https://marketplace.atlassian.com/download/apps/1213632/version/1040180000" + atl_systemd_service_name: "jira.service" + atl_jdbc_encoding: 'UNICODE' + atl_jdbc_collation: 'C' + atl_jdbc_ctype: 'C' + atl_jdbc_template: 'template0' + pre_tasks: + - name: Create cache dir + file: + path: '/media/atl/jira/shared/' + state: directory + - name: Seed version + copy: + dest: '/media/atl/jira/shared/jira-core.version' + content: "8.14.0" + force: false # For idempotency check + roles: + - role: linux_common + - role: product_common + - role: product_install diff --git a/roles/product_install/molecule/jira_all_version_url/molecule.yml b/roles/product_install/molecule/jira_all_version_url/molecule.yml new file mode 100644 index 0000000..3ea826a --- /dev/null +++ b/roles/product_install/molecule/jira_all_version_url/molecule.yml @@ -0,0 +1,23 @@ +--- +dependency: + name: galaxy +driver: + name: docker +platforms: + - name: amazon_linux2 + image: amazonlinux:2 + groups: + - aws_node_local + - name: ubuntu_lts + image: ubuntu:bionic + groups: + - aws_node_local +provisioner: + name: ansible + options: + skip-tags: runtime_pkg + inventory: + links: + group_vars: ../../../../group_vars/ +verifier: + name: testinfra diff --git a/roles/product_install/molecule/jira_all_version_url/tests/test_default.py b/roles/product_install/molecule/jira_all_version_url/tests/test_default.py new file mode 100644 index 0000000..cca4380 --- /dev/null +++ b/roles/product_install/molecule/jira_all_version_url/tests/test_default.py @@ -0,0 +1,48 @@ +import os +from six.moves import urllib + +import testinfra.utils.ansible_runner +import json + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_version_is_correct(host): + verfile = host.file('/media/atl/jira/shared/jira-software.version') + assert verfile.exists + + assert verfile.content.decode("UTF-8").strip() == "8.14.0" + +def test_is_downloaded(host): + installer = host.file('/media/atl/downloads/jira-software.8.14.0-x64.bin') + assert installer.exists + assert installer.user == 'root' + +def test_completed_lockfile(host): + lockfile = host.file('/media/atl/downloads/jira-software.8.14.0-x64.bin_completed') + assert lockfile.exists + assert lockfile.user == 'root' + +def test_is_unpacked(host): + installer = host.file('/opt/atlassian/jira-software/8.14.0/atlassian-jira/') + assert installer.exists + assert installer.is_directory + assert installer.user == 'jira' + assert installer.mode == 0o0755 + +def test_obr_is_downloaded(host): + installer = host.file('/media/atl/downloads/jira-servicedesk-application-4.14.0.obr') + assert installer.exists + assert installer.user == 'root' + +def test_obr_completed_lockfile(host): + lockfile = host.file('/media/atl/downloads/jira-servicedesk-application-4.14.0.obr_completed') + assert lockfile.exists + assert lockfile.user == 'root' + +def test_obr_is_unpacked(host): + jsdjar = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-4.14.0.jar') + assert jsdjar.exists + assert jsdjar.user == 'jira' + assert jsdjar.mode == 0o0750 \ No newline at end of file From 2eef66f6d5ebf0eddd9c861010cd7c95992c48e4 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 13:20:43 +1000 Subject: [PATCH 18/39] ITSD-94667 Add molecule test for the case where an alternate url is provided for both the tarball and obr --- bitbucket-pipelines.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 5467a1a..dc36a59 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -231,6 +231,15 @@ pipelines: - ./bin/install-ansible --dev - cd roles/product_install - pipenv run molecule test -s jira_all + - step: + name: product_install/jira_all_version_url + services: + - docker + script: + - export ANSIBLE_CONFIG=./ansible.cfg + - ./bin/install-ansible --dev + - cd roles/product_install + - pipenv run molecule test -s jira_all_version_url - step: name: product_install/jira_cached_with_downgrade services: From 01cd77619fbe1fd73bb99db20c592d0b969a8d71 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 13:31:52 +1000 Subject: [PATCH 19/39] ITSD-94667 generated bitbucket-pipelines.yml using make --- bitbucket-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index dc36a59..137e69c 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -18,7 +18,7 @@ pipelines: - step: name: Pre Parallelization stage script: - - echo "Running tests in 36 batches" + - echo "Running tests in 37 batches" - step: name: Check if the template is up-to-date @@ -366,6 +366,7 @@ pipelines: - ./bin/install-ansible --dev - cd roles/product_startup - pipenv run molecule test -s synchrony + - step: name: Run Snyk security scan services: @@ -373,6 +374,6 @@ pipelines: script: - ./bin/install-ansible --dev - apt-get update && apt-get install -y npm - - npm install -g snyk@1.455.0 + - npm install -g snyk - snyk auth $SNYK_TOKEN - pipenv run snyk monitor --severity-threshold=high --project-name=dc-deployments-automation From 1c13113e02b92c09ac6e5bd306e0206f9813fd29 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 14:04:24 +1000 Subject: [PATCH 20/39] ITSD-94667 When providing alternative url a tarball is used instead of bin --- .../molecule/jira_all_version_url/converge.yml | 1 + .../molecule/jira_all_version_url/tests/test_default.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/product_install/molecule/jira_all_version_url/converge.yml b/roles/product_install/molecule/jira_all_version_url/converge.yml index ba8ebcc..f2e11fc 100644 --- a/roles/product_install/molecule/jira_all_version_url/converge.yml +++ b/roles/product_install/molecule/jira_all_version_url/converge.yml @@ -17,6 +17,7 @@ atl_jsd_build: "8.14.0" atl_product_download_url: "https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.14.0.tar.gz" atl_obr_download_url: "https://marketplace.atlassian.com/download/apps/1213632/version/1040180000" + atl_systemd_service_name: "jira.service" atl_jdbc_encoding: 'UNICODE' atl_jdbc_collation: 'C' diff --git a/roles/product_install/molecule/jira_all_version_url/tests/test_default.py b/roles/product_install/molecule/jira_all_version_url/tests/test_default.py index cca4380..634d8f7 100644 --- a/roles/product_install/molecule/jira_all_version_url/tests/test_default.py +++ b/roles/product_install/molecule/jira_all_version_url/tests/test_default.py @@ -15,12 +15,12 @@ def test_version_is_correct(host): assert verfile.content.decode("UTF-8").strip() == "8.14.0" def test_is_downloaded(host): - installer = host.file('/media/atl/downloads/jira-software.8.14.0-x64.bin') + installer = host.file('/media/atl/downloads/jira-software.8.14.0.tar.gz') assert installer.exists assert installer.user == 'root' def test_completed_lockfile(host): - lockfile = host.file('/media/atl/downloads/jira-software.8.14.0-x64.bin_completed') + lockfile = host.file('/media/atl/downloads/jira-software.8.14.0-x64.tar.gz_completed') assert lockfile.exists assert lockfile.user == 'root' From db7d55169a0bd3fdd4369976ba81f9b4900eca54 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 15:52:12 +1000 Subject: [PATCH 21/39] ITSD-94667 Need to add atl_use_system_jdk:true and atl_download_format:tarball as part of alternative URL --- .../molecule/jira_all_version_url/converge.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/product_install/molecule/jira_all_version_url/converge.yml b/roles/product_install/molecule/jira_all_version_url/converge.yml index f2e11fc..13ad6cd 100644 --- a/roles/product_install/molecule/jira_all_version_url/converge.yml +++ b/roles/product_install/molecule/jira_all_version_url/converge.yml @@ -8,15 +8,18 @@ # Version 8.14.0 is chosen deliberately as it is a version where jira and jira-software returns different buildNumber from MPAC # See DCD-1216 for context atl_product_version: "8.14.0" - atl_install_jsd_as_obr: true # This tests for an edge case where the product URL and OBR are source from a provided URL. # Although marketplace (mpac) is used in this example, this could potentially be in a non mpac url. # In this case it would not be possible to query atl_jsd_build_info to source the atl_jsd_build. One is therefore provided. + atl_install_jsd_as_obr: true atl_source_obr_from_marketplace: false atl_jsd_build: "8.14.0" atl_product_download_url: "https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.14.0.tar.gz" atl_obr_download_url: "https://marketplace.atlassian.com/download/apps/1213632/version/1040180000" + # When using a tarball the following are also required: + atl_use_system_jdk: true + atl_download_format: "tarball" atl_systemd_service_name: "jira.service" atl_jdbc_encoding: 'UNICODE' From ce9aa591d3ae4df37f336c48016b67379f4f3044 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 16:34:13 +1000 Subject: [PATCH 22/39] ITSD-94667 Fixed an error whereby the obr filename for alternate was coming from a directory (if sourced from a test marketplace URL) --- .../tasks/jira-servicedesk_as_obr.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 9417e01..aa6a0f5 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -49,24 +49,19 @@ when: - atl_source_obr_from_marketplace | bool +# When sourcing jira-servicedesk from marketplace the atl_jsd_build is source by querying api. +# In this case atl_jsd_build must be passed manually by flag + - name: Source jira-servicedesk obr from alternate url block: - name: Alternate URL OBR - Show the obr filename debug: - msg="obr_name={{ atl_obr_download_url | basename }}" + msg="obr_name=jira-servicedesk-application-{{ atl_jsd_build }}.obr" - - name: Alternate URL OBR - Set the obr filename + - name: Alternate OBR - Set the obr filename set_fact: - atl_obr_filename: "{{ atl_obr_download_url | basename }}" - - - name: Alternate URL OBR - Show atl_jsd_build (manual) - debug: - msg="atl_jsd_build={{ atl_jsd_build }}" - - - name: Alernate URL OBR - Show atl_product_version - debug: - msg="atl_product_version={{ atl_product_version }}" + atl_obr_filename: "jira-servicedesk-application-{{ atl_jsd_build }}.obr" when: - not atl_source_obr_from_marketplace | bool From a44008fb322ade6709385d102801fe2a3cca6d4a Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 16:49:51 +1000 Subject: [PATCH 23/39] ITSD-94667 Fix the check of files for obr --- .../molecule/jira_all_version_url/converge.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/product_install/molecule/jira_all_version_url/converge.yml b/roles/product_install/molecule/jira_all_version_url/converge.yml index 13ad6cd..3b35dbb 100644 --- a/roles/product_install/molecule/jira_all_version_url/converge.yml +++ b/roles/product_install/molecule/jira_all_version_url/converge.yml @@ -8,18 +8,18 @@ # Version 8.14.0 is chosen deliberately as it is a version where jira and jira-software returns different buildNumber from MPAC # See DCD-1216 for context atl_product_version: "8.14.0" + atl_product_download_url: "https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.14.0.tar.gz" # This tests for an edge case where the product URL and OBR are source from a provided URL. # Although marketplace (mpac) is used in this example, this could potentially be in a non mpac url. # In this case it would not be possible to query atl_jsd_build_info to source the atl_jsd_build. One is therefore provided. atl_install_jsd_as_obr: true atl_source_obr_from_marketplace: false - atl_jsd_build: "8.14.0" - atl_product_download_url: "https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.14.0.tar.gz" + atl_jsd_build: "4.14.0" atl_obr_download_url: "https://marketplace.atlassian.com/download/apps/1213632/version/1040180000" # When using a tarball the following are also required: - atl_use_system_jdk: true atl_download_format: "tarball" + atl_use_system_jdk: true atl_systemd_service_name: "jira.service" atl_jdbc_encoding: 'UNICODE' From 5aa726e472a7966a50632b276b4b6f6174933e39 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Wed, 22 Jun 2022 16:52:51 +1000 Subject: [PATCH 24/39] ITSD-94667 Renamed the molecule test to reflect more accurately what it tests for --- bitbucket-pipelines.yml | 4 ++-- .../Dockerfile.j2 | 0 .../converge.yml | 0 .../molecule.yml | 0 .../tests/test_default.py | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename roles/product_install/molecule/{jira_all_version_url => jira_tarball_download_url}/Dockerfile.j2 (100%) rename roles/product_install/molecule/{jira_all_version_url => jira_tarball_download_url}/converge.yml (100%) rename roles/product_install/molecule/{jira_all_version_url => jira_tarball_download_url}/molecule.yml (100%) rename roles/product_install/molecule/{jira_all_version_url => jira_tarball_download_url}/tests/test_default.py (100%) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 137e69c..06bc07e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -232,14 +232,14 @@ pipelines: - cd roles/product_install - pipenv run molecule test -s jira_all - step: - name: product_install/jira_all_version_url + name: product_install/jira_tarball_download_url services: - docker script: - export ANSIBLE_CONFIG=./ansible.cfg - ./bin/install-ansible --dev - cd roles/product_install - - pipenv run molecule test -s jira_all_version_url + - pipenv run molecule test -s jira_tarball_download_url - step: name: product_install/jira_cached_with_downgrade services: diff --git a/roles/product_install/molecule/jira_all_version_url/Dockerfile.j2 b/roles/product_install/molecule/jira_tarball_download_url/Dockerfile.j2 similarity index 100% rename from roles/product_install/molecule/jira_all_version_url/Dockerfile.j2 rename to roles/product_install/molecule/jira_tarball_download_url/Dockerfile.j2 diff --git a/roles/product_install/molecule/jira_all_version_url/converge.yml b/roles/product_install/molecule/jira_tarball_download_url/converge.yml similarity index 100% rename from roles/product_install/molecule/jira_all_version_url/converge.yml rename to roles/product_install/molecule/jira_tarball_download_url/converge.yml diff --git a/roles/product_install/molecule/jira_all_version_url/molecule.yml b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml similarity index 100% rename from roles/product_install/molecule/jira_all_version_url/molecule.yml rename to roles/product_install/molecule/jira_tarball_download_url/molecule.yml diff --git a/roles/product_install/molecule/jira_all_version_url/tests/test_default.py b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py similarity index 100% rename from roles/product_install/molecule/jira_all_version_url/tests/test_default.py rename to roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py From bb22c21f5afb4d8733fedb6fcb20b0dc74705c0c Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Thu, 23 Jun 2022 15:37:29 +1000 Subject: [PATCH 25/39] ITSD-94667 Was seeding wrong file --- .../molecule/jira_tarball_download_url/converge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/product_install/molecule/jira_tarball_download_url/converge.yml b/roles/product_install/molecule/jira_tarball_download_url/converge.yml index 3b35dbb..5f8e8a1 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/converge.yml +++ b/roles/product_install/molecule/jira_tarball_download_url/converge.yml @@ -33,7 +33,7 @@ state: directory - name: Seed version copy: - dest: '/media/atl/jira/shared/jira-core.version' + dest: '/media/atl/jira/shared/jira-software.version' content: "8.14.0" force: false # For idempotency check roles: From 6723209e4bf7d53af76ac05acdd3f0e55aec5771 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Thu, 23 Jun 2022 16:10:33 +1000 Subject: [PATCH 26/39] ITSD-94667 Revert synk due to pinning in a different commit. This is broken from make --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 06bc07e..a2618db 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -374,6 +374,6 @@ pipelines: script: - ./bin/install-ansible --dev - apt-get update && apt-get install -y npm - - npm install -g snyk + - npm install -g snyk@1.455.0 - snyk auth $SNYK_TOKEN - pipenv run snyk monitor --severity-threshold=high --project-name=dc-deployments-automation From 8b6a18fdbde95d64d5d28d2c1e8ce257d17559d9 Mon Sep 17 00:00:00 2001 From: Glenn Stewart Date: Thu, 23 Jun 2022 16:18:15 +1000 Subject: [PATCH 27/39] ITSD-94667 Argh..... in 4.14.0 that application.jar is actually 4.18.0 --- .../molecule/jira_tarball_download_url/tests/test_default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py index 634d8f7..599a6f8 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py +++ b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py @@ -42,7 +42,7 @@ def test_obr_completed_lockfile(host): assert lockfile.user == 'root' def test_obr_is_unpacked(host): - jsdjar = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-4.14.0.jar') + jsdjar = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-4.18.0.jar') assert jsdjar.exists assert jsdjar.user == 'jira' assert jsdjar.mode == 0o0750 \ No newline at end of file From da1062e11a91aee8d23f27dca17f7f55d90996cb Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Fri, 8 Jul 2022 12:35:46 +1000 Subject: [PATCH 28/39] working on molecule tests for the alternate obr stuff --- .gitignore | 1 + .../jira_tarball_download_url/converge.yml | 18 +----------------- .../jira_tarball_download_url/molecule.yml | 2 ++ .../tests/test_default.py | 4 ++-- .../tasks/jira-servicedesk_as_obr.yml | 4 ++++ 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 321ff61..453a538 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ __pycache__ *.pyc /.venv \#*\# +.envrc .idea .vscode diff --git a/roles/product_install/molecule/jira_tarball_download_url/converge.yml b/roles/product_install/molecule/jira_tarball_download_url/converge.yml index 5f8e8a1..6b455ae 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/converge.yml +++ b/roles/product_install/molecule/jira_tarball_download_url/converge.yml @@ -14,28 +14,12 @@ # Although marketplace (mpac) is used in this example, this could potentially be in a non mpac url. # In this case it would not be possible to query atl_jsd_build_info to source the atl_jsd_build. One is therefore provided. atl_install_jsd_as_obr: true - atl_source_obr_from_marketplace: false - atl_jsd_build: "4.14.0" + atl_jsd_build: "4.18.0" atl_obr_download_url: "https://marketplace.atlassian.com/download/apps/1213632/version/1040180000" # When using a tarball the following are also required: atl_download_format: "tarball" atl_use_system_jdk: true - atl_systemd_service_name: "jira.service" - atl_jdbc_encoding: 'UNICODE' - atl_jdbc_collation: 'C' - atl_jdbc_ctype: 'C' - atl_jdbc_template: 'template0' - pre_tasks: - - name: Create cache dir - file: - path: '/media/atl/jira/shared/' - state: directory - - name: Seed version - copy: - dest: '/media/atl/jira/shared/jira-software.version' - content: "8.14.0" - force: false # For idempotency check roles: - role: linux_common - role: product_common diff --git a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml index 3ea826a..644207c 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml +++ b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml @@ -21,3 +21,5 @@ provisioner: group_vars: ../../../../group_vars/ verifier: name: testinfra + additional_files_or_dirs: + - ../../resources/tests/test_*.py diff --git a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py index 599a6f8..ed228e3 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py +++ b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py @@ -32,12 +32,12 @@ def test_is_unpacked(host): assert installer.mode == 0o0755 def test_obr_is_downloaded(host): - installer = host.file('/media/atl/downloads/jira-servicedesk-application-4.14.0.obr') + installer = host.file('/media/atl/downloads/jira-servicedesk-application-4.18.0.obr') assert installer.exists assert installer.user == 'root' def test_obr_completed_lockfile(host): - lockfile = host.file('/media/atl/downloads/jira-servicedesk-application-4.14.0.obr_completed') + lockfile = host.file('/media/atl/downloads/jira-servicedesk-application-4.18.0.obr_completed') assert lockfile.exists assert lockfile.user == 'root' diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index aa6a0f5..09bfe77 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -109,6 +109,10 @@ # Fetch obr if required - name: download_obr is true so fetch and do all the things block: + - debug: + var: atl_obr_download_url + - debug: + var: atl_obr_download # Fetch obr and copy to temp - name: Fetch obr From 8ef409aac925c891f5a3029da581afdee74c8db1 Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Fri, 8 Jul 2022 12:51:50 +1000 Subject: [PATCH 29/39] correcting paths, not including the jira core tests --- .../molecule/jira_tarball_download_url/molecule.yml | 2 -- .../molecule/jira_tarball_download_url/tests/test_default.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml index 644207c..3ea826a 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml +++ b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml @@ -21,5 +21,3 @@ provisioner: group_vars: ../../../../group_vars/ verifier: name: testinfra - additional_files_or_dirs: - - ../../resources/tests/test_*.py diff --git a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py index ed228e3..6c398b6 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py +++ b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py @@ -20,7 +20,7 @@ def test_is_downloaded(host): assert installer.user == 'root' def test_completed_lockfile(host): - lockfile = host.file('/media/atl/downloads/jira-software.8.14.0-x64.tar.gz_completed') + lockfile = host.file('/media/atl/downloads/jira-software.8.14.0.tar.gz_completed') assert lockfile.exists assert lockfile.user == 'root' From 51604a8609dd6ccc2298df8c3efeebe87fbd780a Mon Sep 17 00:00:00 2001 From: bmeehan Date: Wed, 20 Jul 2022 17:52:43 +1000 Subject: [PATCH 30/39] ITSD-94667 install jira_jsm obr to product_install bundled-plugins instead --- roles/product_install/tasks/jira-servicedesk_as_obr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 09bfe77..6e5cc63 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -202,8 +202,8 @@ unarchive: remote_src: true src: "{{ atl_obr_download }}" - dest: "{{ atl_product_home_shared }}/plugins/installed-plugins" - creates: "{{ atl_product_home_shared }}/plugins/installed-plugins/jira-servicedesk-application-{{ atl_jsd_build }}.jar" + dest: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins" + creates: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/jira-servicedesk-application-{{ atl_jsd_build }}.jar" list_files: no exclude: - M* @@ -215,6 +215,6 @@ - name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed shell: - cmd: "mv {{ atl_product_home_shared }}/plugins/installed-plugins/dependencies/*.jar {{ atl_product_home_shared }}/plugins/installed-plugins" - creates: "{{ atl_product_home_shared }}/plugins/installed-plugins/servicedesk-core-ui-plugin-{{ atl_jsd_build }}-*.jar" + cmd: "mv {{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/*.jar {{ atl_product_home_shared }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins" + creates: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/servicedesk-core-ui-plugin-{{ atl_jsd_build }}-*.jar" when: obr_unpack.changed From b7b6ac60b4df796418db9fc5965927a2b905619b Mon Sep 17 00:00:00 2001 From: bmeehan Date: Wed, 20 Jul 2022 21:24:35 +1000 Subject: [PATCH 31/39] ITSD-94667 install jira_jsm obr to product_install bundled-plugins instead - fixed mv dest --- roles/product_install/tasks/jira-servicedesk_as_obr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 6e5cc63..fba2b04 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -215,6 +215,6 @@ - name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed shell: - cmd: "mv {{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/*.jar {{ atl_product_home_shared }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins" + cmd: "mv {{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/*.jar {{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins" creates: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/servicedesk-core-ui-plugin-{{ atl_jsd_build }}-*.jar" when: obr_unpack.changed From f6face1b6a6afafe1c1976acd6087cc6ef12709b Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Thu, 21 Jul 2022 09:13:48 +1000 Subject: [PATCH 32/39] switching shell to copy/file commands and updating path --- .../tasks/jira-servicedesk_as_obr.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index fba2b04..29ca7c4 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -198,7 +198,7 @@ group: "{{ atl_product_user }}" # Note as ansible unarchive cant handle "-j junk paths" we need to ignore errors to bypass the path verify -- name: Unpack the obr into the installed-plugins dir +- name: Unpack the obr into the atlassian-bundled-plugins dir unarchive: remote_src: true src: "{{ atl_obr_download }}" @@ -214,7 +214,13 @@ ignore_errors: yes - name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed - shell: - cmd: "mv {{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/*.jar {{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins" - creates: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/servicedesk-core-ui-plugin-{{ atl_jsd_build }}-*.jar" + copy: + src: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/" + dest: "{{ atl_product_home_shared }}/plugins/installed-plugins/" when: obr_unpack.changed + +- name: Remove the empty dependencies folder # noqa 503 - ignore lint info about when changed + file: + path: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies" + state: absent + when: obr_unpack.changed \ No newline at end of file From 2f6150492ec278cbb671699f1b01d3d55d056ba2 Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Mon, 25 Jul 2022 11:49:55 +1000 Subject: [PATCH 33/39] troubleshooting some flakey JSM downloads --- roles/linux_common/tasks/amazon.yml | 6 ++- .../tasks/jira-servicedesk_as_obr.yml | 54 ++++++++++++++----- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/roles/linux_common/tasks/amazon.yml b/roles/linux_common/tasks/amazon.yml index 9dc15ae..a0958c1 100644 --- a/roles/linux_common/tasks/amazon.yml +++ b/roles/linux_common/tasks/amazon.yml @@ -16,4 +16,8 @@ regexp: '^[Cc]iphers' line: "Ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc" insertbefore: "BOF" - ignore_errors: yes # No sshd == no problem + register: ssh_cypher_results + failed_when: # No sshd == no problem + - ssh_cypher_results.rc > 0 + - ssh_cypher_results.stderr is defined + - "'Destination /etc/ssh/sshd_config does not exist' not in ssh_cypher_results.stderr" # fails for errors other than this one diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 29ca7c4..7438f2c 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -96,6 +96,10 @@ path: "{{ atl_obr_shared_download }}" register: home_shared_download +- name: debug home_shared_download + debug: + var: home_shared_download + # If obr exists and lockdir exists use this obr instead - name: Check lock directory and obr exists on shared_home set_fact: @@ -103,10 +107,11 @@ atl_obr_download: "{{ atl_obr_shared_download }}" when: - home_shared_download.stat.exists + - home_shared_download.stat.mimetype is match("application/zip") - completed_lock.stat.isdir is defined - completed_lock.stat.isdir -# Fetch obr if required +# Fetch obr if required - note we validate it by mimetype rather than checksum due to https://ecosystem.atlassian.net/browse/AMKT-25526 - name: download_obr is true so fetch and do all the things block: - debug: @@ -120,9 +125,29 @@ url: "{{ atl_obr_download_url }}" dest: "{{ atl_obr_download }}" mode: 0755 - force: false + force: true + timeout: 600 register: atl_obr_completed + - name: Confirm the output from the download task + debug: + var: atl_obr_completed + + # get details about the obr + - name: Stat the new obr file + stat: + path: "{{ atl_obr_completed.dest }}" + get_mime: yes + register: atl_obr_stats + when: + - atl_obr_completed.dest is defined + + - name: fail if the downloaded OBR is not a zip file + fail: + msg: "The downloaded OBR was not detected as being a valid ZIP file: {{ atl_obr_stats }}" + when: + - (atl_obr_stats.stat.mimetype is not defined) or (atl_obr_stats.stat.mimetype is not match("application/zip")) + # If obr was fetched make the lock directory - name: Create moving_lock. file: @@ -200,27 +225,28 @@ # Note as ansible unarchive cant handle "-j junk paths" we need to ignore errors to bypass the path verify - name: Unpack the obr into the atlassian-bundled-plugins dir unarchive: - remote_src: true + remote_src: yes src: "{{ atl_obr_download }}" dest: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins" creates: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/jira-servicedesk-application-{{ atl_jsd_build }}.jar" list_files: no exclude: - M* + - obr.xml owner: "{{ atl_product_user }}" group: "{{ atl_product_user }}" mode: 0750 + extra_opts: [-j] # pass the junk paths to the unzip command so we flatten the dependencies directory register: obr_unpack - ignore_errors: yes -- name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed - copy: - src: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/" - dest: "{{ atl_product_home_shared }}/plugins/installed-plugins/" - when: obr_unpack.changed +# - name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed +# copy: +# src: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/" +# dest: "{{ atl_product_home_shared }}/plugins/installed-plugins/" +# when: obr_unpack.changed -- name: Remove the empty dependencies folder # noqa 503 - ignore lint info about when changed - file: - path: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies" - state: absent - when: obr_unpack.changed \ No newline at end of file +# - name: Remove the empty dependencies folder # noqa 503 - ignore lint info about when changed +# file: +# path: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies" +# state: absent +# when: obr_unpack.changed \ No newline at end of file From e5c1954b814468f1d0674594ee4218c496ab2f1d Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Mon, 25 Jul 2022 12:28:33 +1000 Subject: [PATCH 34/39] adding the file command on azl2 to help with mimetype discovery. adding some failed_when logic to unarchiving the obr --- roles/linux_common/tasks/amazon.yml | 7 ++++--- roles/product_install/tasks/jira-servicedesk_as_obr.yml | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/linux_common/tasks/amazon.yml b/roles/linux_common/tasks/amazon.yml index a0958c1..8541669 100644 --- a/roles/linux_common/tasks/amazon.yml +++ b/roles/linux_common/tasks/amazon.yml @@ -3,10 +3,11 @@ - name: Install Amazon-Linux-specific support packages yum: name: - - shadow-utils - - libxml2 - - git-{{ git_version }} - dejavu-sans-fonts + - file + - git-{{ git_version }} + - libxml2 + - shadow-utils - name: Limit the SSH ciphers lineinfile: diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 7438f2c..6d5af31 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -238,6 +238,11 @@ mode: 0750 extra_opts: [-j] # pass the junk paths to the unzip command so we flatten the dependencies directory register: obr_unpack + failed_when: # validation doesn't handle the -j flag, so this deals with the /dependencies/ directory not existing on dest. + - obr_unpack.rc > 0 + - "'Unexpected error when accessing exploded file' not in obr_unpack.msg" + - "'No such file or directory' not in obr_unpack.msg" + - "'{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/' not in obr_unpack.msg" # - name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed # copy: From 47cb955cbb7b56646403d790a5f828dffe3a972b Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Mon, 25 Jul 2022 13:13:24 +1000 Subject: [PATCH 35/39] changing file mode, going back to moving the dependency jars since unarchive -j brings other problems --- .../tasks/jira-servicedesk_as_obr.yml | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_as_obr.yml b/roles/product_install/tasks/jira-servicedesk_as_obr.yml index 6d5af31..73e7c3b 100644 --- a/roles/product_install/tasks/jira-servicedesk_as_obr.yml +++ b/roles/product_install/tasks/jira-servicedesk_as_obr.yml @@ -235,23 +235,18 @@ - obr.xml owner: "{{ atl_product_user }}" group: "{{ atl_product_user }}" - mode: 0750 - extra_opts: [-j] # pass the junk paths to the unzip command so we flatten the dependencies directory + mode: 0644 register: obr_unpack - failed_when: # validation doesn't handle the -j flag, so this deals with the /dependencies/ directory not existing on dest. - - obr_unpack.rc > 0 - - "'Unexpected error when accessing exploded file' not in obr_unpack.msg" - - "'No such file or directory' not in obr_unpack.msg" - - "'{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/' not in obr_unpack.msg" -# - name: Move JSD dependency jars into the installed-plugins dir # noqa 503 - ignore lint info about when changed -# copy: -# src: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/" -# dest: "{{ atl_product_home_shared }}/plugins/installed-plugins/" -# when: obr_unpack.changed +- name: Move JSD dependency jars into the bundled-plugins dir # noqa 503 - ignore lint info about when changed + copy: + remote_src: yes + src: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies/" + dest: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/" + when: obr_unpack.changed -# - name: Remove the empty dependencies folder # noqa 503 - ignore lint info about when changed -# file: -# path: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies" -# state: absent -# when: obr_unpack.changed \ No newline at end of file +- name: Remove the empty dependencies folder # noqa 503 - ignore lint info about when changed + file: + path: "{{ atl_product_installation_versioned }}/atlassian-jira/WEB-INF/atlassian-bundled-plugins/dependencies" + state: absent + when: obr_unpack.changed \ No newline at end of file From 2df1ea28bca01c0f87bfe402da797768c6dd2864 Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Mon, 25 Jul 2022 13:30:59 +1000 Subject: [PATCH 36/39] updating molecule tests to reflect the new expected location of the file --- roles/product_install/molecule/jira_all/tests/test_default.py | 4 ++-- .../molecule/jira_tarball_download_url/tests/test_default.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/product_install/molecule/jira_all/tests/test_default.py b/roles/product_install/molecule/jira_all/tests/test_default.py index cca4380..1d793bf 100644 --- a/roles/product_install/molecule/jira_all/tests/test_default.py +++ b/roles/product_install/molecule/jira_all/tests/test_default.py @@ -42,7 +42,7 @@ def test_obr_completed_lockfile(host): assert lockfile.user == 'root' def test_obr_is_unpacked(host): - jsdjar = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-4.14.0.jar') + jsdjar = host.file('/opt/atlassian/jira-software/8.14.0/atlassian-jira/WEB-INF/atlassian-bundled-plugins/jira-servicedesk-application-4.14.0.jar') assert jsdjar.exists assert jsdjar.user == 'jira' - assert jsdjar.mode == 0o0750 \ No newline at end of file + assert jsdjar.mode == 0o0644 \ No newline at end of file diff --git a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py index 6c398b6..a86c061 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py +++ b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py @@ -42,7 +42,7 @@ def test_obr_completed_lockfile(host): assert lockfile.user == 'root' def test_obr_is_unpacked(host): - jsdjar = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-4.18.0.jar') + jsdjar = host.file('/opt/atlassian/jira-software/8.14.0/atlassian-jira/WEB-INF/atlassian-bundled-plugins/jira-servicedesk-application-4.14.0.jar') assert jsdjar.exists assert jsdjar.user == 'jira' - assert jsdjar.mode == 0o0750 \ No newline at end of file + assert jsdjar.mode == 0o0644 \ No newline at end of file From 3dc9bd38abbbbe0e73e790a545856d548df72360 Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Mon, 25 Jul 2022 13:58:50 +1000 Subject: [PATCH 37/39] jira_tarball_download_url uses a different jsm version --- .../molecule/jira_tarball_download_url/molecule.yml | 2 ++ .../molecule/jira_tarball_download_url/tests/test_default.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml index 3ea826a..644207c 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml +++ b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml @@ -21,3 +21,5 @@ provisioner: group_vars: ../../../../group_vars/ verifier: name: testinfra + additional_files_or_dirs: + - ../../resources/tests/test_*.py diff --git a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py index a86c061..b884603 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py +++ b/roles/product_install/molecule/jira_tarball_download_url/tests/test_default.py @@ -42,7 +42,7 @@ def test_obr_completed_lockfile(host): assert lockfile.user == 'root' def test_obr_is_unpacked(host): - jsdjar = host.file('/opt/atlassian/jira-software/8.14.0/atlassian-jira/WEB-INF/atlassian-bundled-plugins/jira-servicedesk-application-4.14.0.jar') + jsdjar = host.file('/opt/atlassian/jira-software/8.14.0/atlassian-jira/WEB-INF/atlassian-bundled-plugins/jira-servicedesk-application-4.18.0.jar') assert jsdjar.exists assert jsdjar.user == 'jira' assert jsdjar.mode == 0o0644 \ No newline at end of file From 8855452c79e6544c6154ff57b2f39a7105fd3d25 Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Mon, 25 Jul 2022 14:43:55 +1000 Subject: [PATCH 38/39] don't include the jira core tests since this is all software + jsm --- .../molecule/jira_tarball_download_url/molecule.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml index 644207c..3ea826a 100644 --- a/roles/product_install/molecule/jira_tarball_download_url/molecule.yml +++ b/roles/product_install/molecule/jira_tarball_download_url/molecule.yml @@ -21,5 +21,3 @@ provisioner: group_vars: ../../../../group_vars/ verifier: name: testinfra - additional_files_or_dirs: - - ../../resources/tests/test_*.py From 4d84174b7b44240b3a260a308834ee148a74e791 Mon Sep 17 00:00:00 2001 From: Geoff Jacobs Date: Tue, 26 Jul 2022 06:41:39 +1000 Subject: [PATCH 39/39] reverting my handling of the missing sshd_config and going back to ignoring errors. the failed_when logic was failing on a real node (but fine in molecule) --- roles/linux_common/tasks/amazon.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/roles/linux_common/tasks/amazon.yml b/roles/linux_common/tasks/amazon.yml index 8541669..325397c 100644 --- a/roles/linux_common/tasks/amazon.yml +++ b/roles/linux_common/tasks/amazon.yml @@ -17,8 +17,4 @@ regexp: '^[Cc]iphers' line: "Ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc" insertbefore: "BOF" - register: ssh_cypher_results - failed_when: # No sshd == no problem - - ssh_cypher_results.rc > 0 - - ssh_cypher_results.stderr is defined - - "'Destination /etc/ssh/sshd_config does not exist' not in ssh_cypher_results.stderr" # fails for errors other than this one + ignore_errors: yes # No sshd == no problem