mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2026-07-30 17:50:47 -05:00
ITPLT-4718 Query Marketplace for JSM app software ID
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- name: Marketplace JSM - Resolve app software IDs by hosting preference
|
||||
ansible.builtin.uri:
|
||||
url: "{{ atl_mpac_api_base_url }}/app-software/app-key/{{ atl_mpac_jsm_app_key }}?hosting={{ item }}"
|
||||
return_content: true
|
||||
loop: "{{ atl_mpac_jsm_hosting_preference }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
register: atl_jsm_app_software_lookup
|
||||
|
||||
- name: Marketplace JSM - Set non-archived app software IDs
|
||||
ansible.builtin.set_fact:
|
||||
atl_jsm_app_software_ids: "{{ atl_jsm_app_software_lookup.results | map(attribute='json') | flatten | rejectattr('archived') | map(attribute='appSoftwareId') | list }}"
|
||||
|
||||
- name: Marketplace JSM - Ensure at least one app software ID was resolved
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- atl_jsm_app_software_ids | length > 0
|
||||
fail_msg: >-
|
||||
Marketplace did not return a non-archived app software ID for
|
||||
{{ atl_mpac_jsm_app_key }} using hosting preferences
|
||||
{{ atl_mpac_jsm_hosting_preference | join(', ') }}.
|
||||
@@ -19,23 +19,47 @@
|
||||
ansible.builtin.debug:
|
||||
msg="buildNumber={{ atl_product_version_info.json.buildNumber }}"
|
||||
|
||||
- name: Marketplace OBR - Get the JSD build version info
|
||||
- name: Marketplace OBR - Resolve JSM app software IDs
|
||||
ansible.builtin.include_tasks: jira-servicedesk_app_software_ids.yml
|
||||
|
||||
- name: Marketplace OBR - Get JSD build version info for resolved app software IDs
|
||||
ansible.builtin.uri:
|
||||
url: "{{ atl_mpac_api_base_url }}/app-software/{{ atl_mpac_jsm_app_software_id }}/versions?parentSoftwareId=jira&parentSoftwareVersionId={{ atl_product_version_info.json.buildNumber }}&state=ACTIVE&limit=1"
|
||||
return_content: yes
|
||||
url: "{{ atl_mpac_api_base_url }}/app-software/{{ item }}/versions?parentSoftwareId=jira&parentSoftwareVersionId={{ atl_product_version_info.json.buildNumber }}&state=ACTIVE&limit=1"
|
||||
return_content: true
|
||||
loop: "{{ atl_jsm_app_software_ids }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
register: atl_jsd_build_info
|
||||
|
||||
- name: Marketplace OBR - Set compatible JSD build versions
|
||||
ansible.builtin.set_fact:
|
||||
atl_jsd_build_versions: "{{ atl_jsd_build_info.results | map(attribute='json') | map(attribute='versions') | flatten | list }}"
|
||||
|
||||
- name: Marketplace OBR - Ensure a compatible JSD build was returned
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- atl_jsd_build_versions | length > 0
|
||||
fail_msg: >-
|
||||
Marketplace returned no compatible JSM version for Jira {{ atl_product_version }}
|
||||
(build {{ atl_product_version_info.json.buildNumber }}) using app key
|
||||
{{ atl_mpac_jsm_app_key }} and app software IDs
|
||||
{{ atl_jsm_app_software_ids | join(', ') }}.
|
||||
|
||||
- name: Marketplace OBR - Set selected JSD build version
|
||||
ansible.builtin.set_fact:
|
||||
atl_jsd_build_info: "{{ atl_jsd_build_versions | first }}"
|
||||
|
||||
- name: Marketplace OBR - Show the returned obr artifact ID
|
||||
ansible.builtin.debug:
|
||||
msg="obr_artifact_id={{ atl_jsd_build_info.json.versions[0].frameworkDetails.attributes.artifactId }}"
|
||||
msg="obr_artifact_id={{ atl_jsd_build_info.frameworkDetails.attributes.artifactId }}"
|
||||
|
||||
- name: Marketplace OBR - Set atl_obr_download_url
|
||||
ansible.builtin.set_fact:
|
||||
atl_obr_download_url: "{{ atl_mpac_base_url }}/artifacts/{{ atl_jsd_build_info.json.versions[0].frameworkDetails.attributes.artifactId }}/download"
|
||||
atl_obr_download_url: "{{ atl_mpac_base_url }}/artifacts/{{ atl_jsd_build_info.frameworkDetails.attributes.artifactId }}/download"
|
||||
|
||||
- name: Marketplace OBR - Set atl_jsd_build
|
||||
ansible.builtin.set_fact:
|
||||
atl_jsd_build: "{{ atl_jsd_build_info.json.versions[0].versionNumber }}"
|
||||
atl_jsd_build: "{{ atl_jsd_build_info.versionNumber }}"
|
||||
|
||||
- name: Marketplace OBR - Show the obr filename
|
||||
ansible.builtin.debug:
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
---
|
||||
|
||||
- name: Fetch the latest version from URL
|
||||
- name: Resolve JSM app software IDs
|
||||
ansible.builtin.include_tasks: jira-servicedesk_app_software_ids.yml
|
||||
|
||||
- name: Fetch latest JSM versions for resolved app software IDs
|
||||
ansible.builtin.uri:
|
||||
url: "{{ atl_mpac_api_base_url }}/app-software/{{ item }}/versions?parentSoftwareId=jira&state=ACTIVE&limit=1"
|
||||
return_content: true
|
||||
loop: "{{ atl_jsm_app_software_ids }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
register: atl_jsm_latest_version_info
|
||||
|
||||
- name: Set compatible latest JSM versions
|
||||
ansible.builtin.set_fact:
|
||||
atl_product_version_json: "{{ lookup('url', '{{ atl_mpac_api_base_url }}/app-software/{{ atl_mpac_jsm_app_software_id }}/versions?parentSoftwareId=jira&state=ACTIVE&limit=1') }}"
|
||||
atl_jsm_latest_versions: "{{ atl_jsm_latest_version_info.results | map(attribute='json') | map(attribute='versions') | flatten | list }}"
|
||||
|
||||
- name: Ensure Marketplace returned a latest JSM version
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- atl_jsm_latest_versions | length > 0
|
||||
fail_msg: >-
|
||||
Marketplace returned no active JSM version for app key {{ atl_mpac_jsm_app_key }}
|
||||
using app software IDs {{ atl_jsm_app_software_ids | join(', ') }}.
|
||||
|
||||
- name: Set the local var to retrieved version
|
||||
ansible.builtin.set_fact:
|
||||
atl_latest_version: "{{ atl_product_version_json.versions[0].versionNumber }}"
|
||||
atl_latest_version: "{{ (atl_jsm_latest_versions | first).versionNumber }}"
|
||||
|
||||
Reference in New Issue
Block a user