mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 08:53:07 -06:00
Merged in DCD-813-bitbucket-dataset-restore-rebase (pull request #74)
DCD-813: Bitbucket dataset restore rebase Approved-by: Varun Arbatti <varbatti@atlassian.com> Approved-by: Steve Smith <ssmith@atlassian.com>
This commit is contained in:
@@ -34,5 +34,6 @@
|
|||||||
- role: restore_backups
|
- role: restore_backups
|
||||||
- role: bitbucket_config
|
- role: bitbucket_config
|
||||||
- role: product_startup
|
- role: product_startup
|
||||||
|
- role: bitbucket_dataset_restore
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,6 @@ atl_restore_required: "{{ atl_backup_manifest_url is defined and atl_backup_mani
|
|||||||
|
|
||||||
atl_bitbucket_license_key: "{{ lookup('env', 'ATL_BB_LICENSEKEY') }}"
|
atl_bitbucket_license_key: "{{ lookup('env', 'ATL_BB_LICENSEKEY') }}"
|
||||||
atl_bitbucket_admin_password: "{{ lookup('env', 'ATL_BB_ADMIN_PASSWORD') }}"
|
atl_bitbucket_admin_password: "{{ lookup('env', 'ATL_BB_ADMIN_PASSWORD') }}"
|
||||||
|
|
||||||
atl_bitbucket_dataset_url: "{{ lookup('env', 'ATL_DATASET_URL') }}"
|
atl_bitbucket_dataset_url: "{{ lookup('env', 'ATL_DATASET_URL') }}"
|
||||||
atl_bitbucket_baseurl: "{{ lookup('env', 'ATL_BB_BASEURL') }}"
|
atl_bitbucket_baseurl: "{{ lookup('env', 'ATL_BB_BASEURL') }}"
|
||||||
|
|
||||||
|
|||||||
56
roles/bitbucket_dataset_restore/tasks/main.yml
Normal file
56
roles/bitbucket_dataset_restore/tasks/main.yml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
- name: Force all notified handlers to run at this point, not waiting for normal sync points
|
||||||
|
meta: flush_handlers
|
||||||
|
|
||||||
|
- name: wait for port 7990 to be up
|
||||||
|
wait_for:
|
||||||
|
port: 7990
|
||||||
|
delay: 60
|
||||||
|
|
||||||
|
- name: wait for path to become available
|
||||||
|
wait_for:
|
||||||
|
path: "{{ atl_product_home_shared }}/data/migration/import"
|
||||||
|
delay: 60
|
||||||
|
|
||||||
|
- name: Copy Bitbucket dataset from s3
|
||||||
|
get_url:
|
||||||
|
url: "{{ atl_bitbucket_dataset_url }}"
|
||||||
|
dest: "{{ atl_product_home_shared }}/data/migration/import"
|
||||||
|
|
||||||
|
- name: Invoke Import API
|
||||||
|
uri:
|
||||||
|
url: "{{ atl_bitbucket_baseurl }}/rest/api/1.0/migration/imports"
|
||||||
|
user: admin
|
||||||
|
password: "{{ atl_bitbucket_admin_password }}"
|
||||||
|
method: POST
|
||||||
|
follow_redirects: yes
|
||||||
|
force_basic_auth: yes
|
||||||
|
creates: "{{ atl_product_home_shared }}/data/migration/import/lock.file"
|
||||||
|
body: "{ \"archivePath\": \"{{ atl_bitbucket_dataset_url | basename }}\" }"
|
||||||
|
body_format: json
|
||||||
|
return_content: yes
|
||||||
|
register: output
|
||||||
|
until: output.status == 200
|
||||||
|
retries: 6
|
||||||
|
delay: 15
|
||||||
|
failed_when: output is defined and output.json is defined and output.json.state != 'INITIALISING'
|
||||||
|
|
||||||
|
- name: get import status
|
||||||
|
uri:
|
||||||
|
url: "{{ atl_bitbucket_baseurl }}/rest/api/1.0/migration/imports/{{ output.json.id }}"
|
||||||
|
user: admin
|
||||||
|
password: "{{ atl_bitbucket_admin_password }}"
|
||||||
|
method: get
|
||||||
|
force_basic_auth: yes
|
||||||
|
body_format: json
|
||||||
|
return_content: yes
|
||||||
|
register: import_status
|
||||||
|
until: import_status is defined and import_status.json is defined and import_status.json.state == 'COMPLETED'
|
||||||
|
retries: 30
|
||||||
|
delay: 10
|
||||||
|
|
||||||
|
- name: create lock file
|
||||||
|
file:
|
||||||
|
path: "{{ atl_product_home_shared }}/data/migration/import/lock.file"
|
||||||
|
state: touch
|
||||||
|
when: import_status.json.state == 'COMPLETED'
|
||||||
Reference in New Issue
Block a user