DCD-224: Add lookup table for appropriate ServiceDesk version depending on the Jira major version.

This commit is contained in:
Steve Smith
2019-04-30 11:21:28 +10:00
parent c36a31863c
commit efc14025ea
10 changed files with 140 additions and 5 deletions

View File

@@ -25,5 +25,20 @@ atl_tomcat_redirectport: ""
atl_tomcat_scheme: "http" atl_tomcat_scheme: "http"
atl_tomcat_secure: "false" atl_tomcat_secure: "false"
atl_servicedesk_latest_version_url: "https://marketplace.atlassian.com/rest/2/products/key/jira-servicedesk/versions/latest" # As SD releases need to be mapped to a Jira release, and there's now
# straightforward way of doing this via the Marketplace REST API we do
# a course mapping here and rely on UPM to prompt to upgrade to the
# latest. See:
#
# https://marketplace.atlassian.com/apps/1213632/jira-service-desk/version-history
#
# for version details.
atl_servicedesk_download_map:
'8':
version: "4.1.0"
url: "https://marketplace.atlassian.com/download/apps/1213632/version/1040010000"
'7':
version: "3.16.3"
url: "https://marketplace.atlassian.com/download/apps/1213632/version/1030160003"
atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk-{{ atl_servicedesk_version }}.obr" atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk-{{ atl_servicedesk_version }}.obr"

View File

@@ -1,6 +1,7 @@
--- ---
- name: Converge - name: Converge
hosts: all hosts: all
vars: vars:
atl_product_bundle: servicedesk atl_product_bundle: servicedesk
bundle_map: bundle_map:
@@ -12,6 +13,7 @@
atl_product_edition: "jira-{{ bundle_map[atl_product_bundle] }}" atl_product_edition: "jira-{{ bundle_map[atl_product_bundle] }}"
atl_product_family: "jira" atl_product_family: "jira"
atl_product_user: "jira" atl_product_user: "jira"
atl_product_version: "7.13.3"
atl_jdbc_user: 'atljira' atl_jdbc_user: 'atljira'
atl_jvm_heap: 'PLACEHOLDER' atl_jvm_heap: 'PLACEHOLDER'

View File

@@ -0,0 +1,37 @@
import os
import urllib.request
import testinfra.utils.ansible_runner
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() == "7.13.3"
def test_is_downloaded(host):
installer = host.file('/opt/atlassian/tmp/jira-software.7.13.3.tar.gz')
assert installer.exists
assert installer.user == 'root'
def test_is_unpacked(host):
installer = host.file('/opt/atlassian/jira-software/7.13.3')
assert installer.exists
assert installer.is_directory
assert installer.user == 'jira'
assert installer.mode == 0o0755
def test_sd_is_downloaded(host):
installer = host.file('/opt/atlassian/tmp/jira-servicedesk-3.16.3.obr')
assert installer.exists
assert installer.user == 'root'
def test_is_unpacked(host):
installer = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-3.16.3.jar')
assert installer.exists
assert installer.user == 'jira'
assert installer.mode == 0o0750

View File

@@ -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

View File

@@ -0,0 +1,30 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
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
lint:
name: ansible-lint
inventory:
links:
group_vars: ../../../../group_vars/
verifier:
name: testinfra
lint:
name: flake8
enabled: false

View File

@@ -0,0 +1,26 @@
---
- name: Converge
hosts: all
vars:
atl_product_bundle: servicedesk
bundle_map:
all: software
servicedesk: software
core: core
software: software
atl_product_edition: "jira-{{ bundle_map[atl_product_bundle] }}"
atl_product_family: "jira"
atl_product_user: "jira"
atl_product_version: "latest"
atl_jdbc_user: 'atljira'
atl_jvm_heap: 'PLACEHOLDER'
atl_cluster_node_id: 'FAKEID'
roles:
- role: linux_common
- role: product_common
- role: product_download
- role: jira_config

View File

@@ -24,3 +24,14 @@ def test_is_unpacked(host):
assert installer.is_directory assert installer.is_directory
assert installer.user == 'jira' assert installer.user == 'jira'
assert installer.mode == 0o0755 assert installer.mode == 0o0755
def test_sd_is_downloaded(host):
installer = host.file('/opt/atlassian/tmp/jira-servicedesk-4.1.0.obr')
assert installer.exists
assert installer.user == 'root'
def test_is_unpacked(host):
installer = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-4.1.0.jar')
assert installer.exists
assert installer.user == 'jira'
assert installer.mode == 0o0750

View File

@@ -35,15 +35,15 @@
- name: Install ServiceDesk if required - name: Install ServiceDesk if required
block: block:
- name: Fetch the latest version data - name: Extract the Jira major version, default to 8 if not found or 'latest'
set_fact: set_fact:
atl_servicedesk_version_json: "{{ lookup('url', '{{ atl_servicedesk_latest_version_url }}') }}" atl_jira_major_version: "{{ atl_product_version | regex_search('^\\d+') | default('8', true) }}"
- name: Extract the latest version number - name: Extract the latest version number
set_fact: set_fact:
atl_servicedesk_version: "{{ atl_servicedesk_version_json.name }}" atl_servicedesk_version: "{{ atl_servicedesk_download_map[atl_jira_major_version].version }}"
- name: Extract the download url - name: Extract the download url
set_fact: set_fact:
atl_servicedesk_download_url: "{{ atl_servicedesk_version_json._embedded.artifact._links.binary.href }}" atl_servicedesk_download_url: "{{ atl_servicedesk_download_map[atl_jira_major_version].url }}"
- name: Download ServiceDesk - name: Download ServiceDesk
get_url: get_url: