DCD-224: Download locally rather than to the shared drive to avoid races.

This commit is contained in:
Steve Smith
2019-04-15 14:18:25 +10:00
parent 94c06ce4d5
commit 6c70ce323e
4 changed files with 14 additions and 3 deletions

View File

@@ -7,4 +7,5 @@ atl_product_latest_version_url: "{{ atl_product_base_url }}/latest"
atl_product_version_cache: "{{ atl_product_home_shared }}/{{ atl_product_edition }}.version" atl_product_version_cache: "{{ atl_product_home_shared }}/{{ atl_product_edition }}.version"
atl_product_download_url: "{{ atl_product_base_url }}/atlassian-{{ atl_product_edition }}-{{ atl_product_version_file.stdout }}-x64.bin" atl_product_download_url: "{{ atl_product_base_url }}/atlassian-{{ atl_product_edition }}-{{ atl_product_version_file.stdout }}-x64.bin"
atl_product_download_cache: "{{ atl_product_home_shared }}/{{ atl_product_edition }}.{{ atl_product_version_file.stdout }}.bin" atl_product_download_filename: "{{ atl_product_edition }}.{{ atl_product_version_file.stdout }}.bin"
atl_product_download: "{{ atl_installer_temp }}/{{ atl_product_download_filename }}"

View File

@@ -25,7 +25,7 @@ def test_latest_is_downloaded(host):
upstream_fd = urllib.request.urlopen("https://s3.amazonaws.com/atlassian-software/releases/jira-software/latest") upstream_fd = urllib.request.urlopen("https://s3.amazonaws.com/atlassian-software/releases/jira-software/latest")
upstream = upstream_fd.read().decode("UTF-8").strip() upstream = upstream_fd.read().decode("UTF-8").strip()
installer = host.file('/media/atl/jira/shared/jira-software.'+upstream+'.bin') installer = host.file('/opt/atlassian/tmp/jira-software.'+upstream+'.bin')
assert installer.exists assert installer.exists
assert installer.user == 'root' assert installer.user == 'root'
assert installer.mode == 0o0755 assert installer.mode == 0o0755

View File

@@ -18,3 +18,8 @@ def test_version_is_latest(host):
assert verfile.content.decode("UTF-8").strip() == "7.13.2" assert verfile.content.decode("UTF-8").strip() == "7.13.2"
def test_latest_is_downloaded(host):
installer = host.file('/opt/atlassian/tmp/jira-software.7.13.2.bin')
assert installer.exists
assert installer.user == 'root'
assert installer.mode == 0o0755

View File

@@ -17,10 +17,15 @@
- name: Use version for product version - name: Use version for product version
command: "cat {{ atl_product_version_cache }}" command: "cat {{ atl_product_version_cache }}"
register: atl_product_version_file register: atl_product_version_file
changed_when: False
# Note: We don't cache this in the shared drive to the complexity
# around download race-conditions if multiple nodes are starting at
# the same time. When downloading from product-downloads.atlassian.com
# (which is a CDN) takes seconds anyway.
- name: Fetch product installer - name: Fetch product installer
get_url: get_url:
url: "{{ atl_product_download_url }}" url: "{{ atl_product_download_url }}"
dest: "{{ atl_product_download_cache }}" dest: "{{ atl_product_download }}"
mode: 0755 mode: 0755
force: false force: false