From 2860291c0ee8f0eb1ad4626927d5632ea3677d67 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 11 May 2022 13:08:41 +1000 Subject: [PATCH 01/10] DCD-1525: Remove file --- roles/product_install/tasks/jira-software_version_latest.yml | 1 - 1 file changed, 1 deletion(-) delete mode 120000 roles/product_install/tasks/jira-software_version_latest.yml diff --git a/roles/product_install/tasks/jira-software_version_latest.yml b/roles/product_install/tasks/jira-software_version_latest.yml deleted file mode 120000 index d80ce2f..0000000 --- a/roles/product_install/tasks/jira-software_version_latest.yml +++ /dev/null @@ -1 +0,0 @@ -product_version_latest.yml \ No newline at end of file From a195210b0dcd76df9c4a4fe88945f72c01388fd5 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 11 May 2022 13:17:12 +1000 Subject: [PATCH 02/10] DCD-1525: Update version URL --- .../molecule/default/tests/test_default.py | 12 ++++++------ .../jira_software_latest/tests/test_default.py | 12 ++++++------ .../molecule/jira_tarball/tests/test_default.py | 12 ++++++------ .../jira_version_latest/tests/test_default.py | 12 ++++++------ .../tasks/jira-software_version_latest.yml | 9 +++++++++ 5 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 roles/product_install/tasks/jira-software_version_latest.yml diff --git a/roles/product_install/molecule/default/tests/test_default.py b/roles/product_install/molecule/default/tests/test_default.py index 66eeb28..d157012 100644 --- a/roles/product_install/molecule/default/tests/test_default.py +++ b/roles/product_install/molecule/default/tests/test_default.py @@ -12,25 +12,25 @@ def test_version_file_is_latest(host): verfile = host.file('/media/atl/jira/shared/jira-core.version') assert verfile.exists - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] assert verfile.content.decode("UTF-8").strip() == upstream.strip() def test_latest_is_downloaded(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] installer = host.file('/media/atl/downloads/jira-core.'+upstream+'-x64.bin') assert installer.exists assert installer.user == 'root' def test_completed_lockfile(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] lockfile = host.file('/media/atl/downloads/jira-core.'+upstream+'-x64.bin_completed') assert lockfile.exists diff --git a/roles/product_install/molecule/jira_software_latest/tests/test_default.py b/roles/product_install/molecule/jira_software_latest/tests/test_default.py index 80d53b8..653ece1 100644 --- a/roles/product_install/molecule/jira_software_latest/tests/test_default.py +++ b/roles/product_install/molecule/jira_software_latest/tests/test_default.py @@ -24,25 +24,25 @@ def test_version_file_is_latest(host): verfile = host.file('/media/atl/jira/shared/jira-software.version') assert verfile.exists - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] assert verfile.content.decode("UTF-8").strip() == upstream.strip() def test_latest_is_downloaded(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] installer = host.file('/media/atl/downloads/jira-software.'+upstream+'-x64.bin') assert installer.exists assert installer.user == 'root' def test_completed_lockfile(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] lockfile = host.file('/media/atl/downloads/jira-software.'+upstream+'-x64.bin_completed') assert lockfile.exists diff --git a/roles/product_install/molecule/jira_tarball/tests/test_default.py b/roles/product_install/molecule/jira_tarball/tests/test_default.py index 7155f41..97e4f58 100644 --- a/roles/product_install/molecule/jira_tarball/tests/test_default.py +++ b/roles/product_install/molecule/jira_tarball/tests/test_default.py @@ -12,25 +12,25 @@ def test_version_file_is_latest(host): verfile = host.file('/media/atl/jira/shared/jira-core.version') assert verfile.exists - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] assert verfile.content.decode("UTF-8").strip() == upstream.strip() def test_latest_is_downloaded(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] installer = host.file('/media/atl/downloads/jira-core.'+upstream+'.tar.gz') assert installer.exists assert installer.user == 'root' def test_completed_lockfile(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] lockfile = host.file('/media/atl/downloads/jira-core.'+upstream+'.tar.gz_completed') assert lockfile.exists diff --git a/roles/product_install/molecule/jira_version_latest/tests/test_default.py b/roles/product_install/molecule/jira_version_latest/tests/test_default.py index 8e20d76..93b81b4 100644 --- a/roles/product_install/molecule/jira_version_latest/tests/test_default.py +++ b/roles/product_install/molecule/jira_version_latest/tests/test_default.py @@ -12,25 +12,25 @@ def test_version_file_is_latest(host): verfile = host.file('/media/atl/jira/shared/jira-core.version') assert verfile.exists - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] assert verfile.content.decode("UTF-8").strip() == upstream.strip() def test_latest_is_downloaded(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] installer = host.file('/media/atl/downloads/jira-core.'+upstream+'-x64.bin') assert installer.exists assert installer.user == 'root' def test_completed_lockfile(host): - upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/jira/versions/latest") + upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions") upstream_json = json.load(upstream_fd) - upstream = upstream_json['version'] + upstream = upstream_json['_embedded']['versions'][0]['name'] lockfile = host.file('/media/atl/downloads/jira-core.'+upstream+'-x64.bin_completed') assert lockfile.exists diff --git a/roles/product_install/tasks/jira-software_version_latest.yml b/roles/product_install/tasks/jira-software_version_latest.yml new file mode 100644 index 0000000..0112206 --- /dev/null +++ b/roles/product_install/tasks/jira-software_version_latest.yml @@ -0,0 +1,9 @@ +--- + +- name: Fetch the latest version from URL + set_fact: + atl_product_version_json: "{{ lookup('url', 'https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions') }}" + +- name: Set the local var to retrieved version + set_fact: + atl_latest_version: "{{ atl_product_version_json._embedded.versions[0].name }}" \ No newline at end of file From 3f07d0b9e1d813f3da213017e29686d170652538 Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 14:45:42 +1000 Subject: [PATCH 03/10] DCD-1525: removed jira-core_version_latest file to unlink symlink --- roles/product_install/tasks/jira-core_version_latest.yml | 1 - 1 file changed, 1 deletion(-) delete mode 120000 roles/product_install/tasks/jira-core_version_latest.yml diff --git a/roles/product_install/tasks/jira-core_version_latest.yml b/roles/product_install/tasks/jira-core_version_latest.yml deleted file mode 120000 index d80ce2f..0000000 --- a/roles/product_install/tasks/jira-core_version_latest.yml +++ /dev/null @@ -1 +0,0 @@ -product_version_latest.yml \ No newline at end of file From e94018d0170ef5bd129ddbaadb716d8724b7f1ba Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 14:47:00 +1000 Subject: [PATCH 04/10] DCD-1525: Jira core uses hardcoded url to get latest version --- roles/product_install/tasks/jira-core_version_latest.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 roles/product_install/tasks/jira-core_version_latest.yml diff --git a/roles/product_install/tasks/jira-core_version_latest.yml b/roles/product_install/tasks/jira-core_version_latest.yml new file mode 100644 index 0000000..0112206 --- /dev/null +++ b/roles/product_install/tasks/jira-core_version_latest.yml @@ -0,0 +1,9 @@ +--- + +- name: Fetch the latest version from URL + set_fact: + atl_product_version_json: "{{ lookup('url', 'https://marketplace.atlassian.com/rest/2/products/key/jira-software/versions') }}" + +- name: Set the local var to retrieved version + set_fact: + atl_latest_version: "{{ atl_product_version_json._embedded.versions[0].name }}" \ No newline at end of file From 9d2c7e4138eea78785d61f718097833536ae7dd7 Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 15:06:55 +1000 Subject: [PATCH 05/10] DCD-1525: JSM url hardcoded --- .../tasks/jira-servicedesk_version_latest.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/product_install/tasks/jira-servicedesk_version_latest.yml b/roles/product_install/tasks/jira-servicedesk_version_latest.yml index e7256ed..8911ae8 100644 --- a/roles/product_install/tasks/jira-servicedesk_version_latest.yml +++ b/roles/product_install/tasks/jira-servicedesk_version_latest.yml @@ -1,9 +1,9 @@ --- -- name: Fetch the ServiceDesk metadata from marketplace +- name: Fetch the latest version from URL set_fact: - atl_servicedesk_version_json: "{{ lookup('url', '{{ atl_servicedesk_latest_url }}') }}" + atl_product_version_json: "{{ lookup('url', 'https://marketplace.atlassian.com/rest/2/products/key/jira-servicedesk/versions') }}" -- name: Set the version for ServiceDesk +- name: Set the local var to retrieved version set_fact: - atl_latest_version: "{{ atl_servicedesk_version_json.name }}" + atl_latest_version: "{{ atl_product_version_json._embedded.versions[0].name }}" \ No newline at end of file From 6b94c063e39cd5ede406515bd32317cb19553faa Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 15:36:02 +1000 Subject: [PATCH 06/10] DCD-1525: node v12 upgrade --- bitbucket-pipelines.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 157ca6b..52cf1aa 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -364,6 +364,10 @@ pipelines: script: - ./bin/install-ansible --dev - apt-get update && apt-get install -y npm + - npm install npm@latest -g + - npm cache clean -f + - npm install -g n + - n stable - npm install -g snyk - snyk auth $SNYK_TOKEN - pipenv run snyk monitor --severity-threshold=high --project-name=dc-deployments-automation From dd608d13908c81f66a030ce5624e73031a0dba01 Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 15:50:45 +1000 Subject: [PATCH 07/10] DCD-1525: Install curl to run n stable --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 52cf1aa..a84711a 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -363,7 +363,7 @@ pipelines: - docker script: - ./bin/install-ansible --dev - - apt-get update && apt-get install -y npm + - apt-get update && apt-get install -y npm curl - npm install npm@latest -g - npm cache clean -f - npm install -g n From 1fbeffb0360fe5d9c417617d476e3508ef7cf736 Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 16:10:05 +1000 Subject: [PATCH 08/10] DCD-1525: upgrade image version for node 12 --- bitbucket-pipelines.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index a84711a..170e984 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -4,7 +4,7 @@ # # make > ../bitbucket-pipelines.yml -image: debian:buster +image: debian:bullseye options: size: 2x @@ -363,11 +363,7 @@ pipelines: - docker script: - ./bin/install-ansible --dev - - apt-get update && apt-get install -y npm curl - - npm install npm@latest -g - - npm cache clean -f - - npm install -g n - - n stable + - apt-get update && apt-get install -y npm - npm install -g snyk - snyk auth $SNYK_TOKEN - pipenv run snyk monitor --severity-threshold=high --project-name=dc-deployments-automation From 4c9dff881b429e1098eebe171df3bfebedd0ab85 Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 16:22:39 +1000 Subject: [PATCH 09/10] DCD-1525: update node version --- bitbucket-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 170e984..51259eb 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -4,7 +4,7 @@ # # make > ../bitbucket-pipelines.yml -image: debian:bullseye +image: debian:buster options: size: 2x @@ -363,7 +363,7 @@ pipelines: - docker script: - ./bin/install-ansible --dev - - apt-get update && apt-get install -y npm + - apt-get update && apt-get install -y npm nodejs=14.17.3 - npm install -g snyk - snyk auth $SNYK_TOKEN - pipenv run snyk monitor --severity-threshold=high --project-name=dc-deployments-automation From 6570e967cf71341b1a3d42b282ca6db8dafc80f7 Mon Sep 17 00:00:00 2001 From: Jun Date: Wed, 11 May 2022 17:36:07 +1000 Subject: [PATCH 10/10] DCD-1525: pin snyk version to 1.455.0 --- bitbucket-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 51259eb..5467a1a 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -363,7 +363,7 @@ pipelines: - docker script: - ./bin/install-ansible --dev - - apt-get update && apt-get install -y npm nodejs=14.17.3 - - npm install -g snyk + - apt-get update && apt-get install -y npm + - npm install -g snyk@1.455.0 - snyk auth $SNYK_TOKEN - pipenv run snyk monitor --severity-threshold=high --project-name=dc-deployments-automation