Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AL-1599 - Switched the workflow used by Environment::import(Files|Database) #1909

Merged
merged 1 commit into from
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,18 @@ All notable changes to this project will be documented in this file. This projec
- The empty-list notice on `payment-method:list` has become a warning. (#1906)
- The empty-list notice on `site:list` has become a warning. (#1906)
- The empty-list notice on `site:org:list` has become a warning. (#1906)
- Slashes are no longer escaped when converting the body of requests to JSON before cURL. (#1909)

### Deprecated
- `service-level:set` is now deprecated. Please use `plan:set`. (#1901)
- `Site::updateServiceLevel()` is now deprecated. Please use `Plans::set()`. (#1901)

### Fixed
- Fixed `Environment::importDatabase()` by switching from using the `import_database` workflow to `do_import`. (#1909)
- Fixed `Environment::importFiles()` by switching from using the `import_files` workflow to `do_import`. (#1909)
- Fixed `import:database` by switching from using the `import_database` workflow to `do_import`. (#1909)
- Fixed `import:files` by switching from using the `import_files` workflow to `do_import`. (#1909)

## 1.9.0 - 2018-09-11
### Added
- Added a `hide_git_mode_warning` option to disable the warning presented when users run Drush or WP-CLI commands on Pantheon sites that are in git mode. (#1882)
Expand Down
20 changes: 18 additions & 2 deletions src/Models/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,15 @@ public function hasDeployableCode()
*/
public function importDatabase($url)
{
return $this->getWorkflows()->create('import_database', ['params' => compact('url'),]);
return $this->getWorkflows()->create(
'do_import',
[
'params' => [
'database' => 1,
'url' => $url,
],
]
);
}

/**
Expand All @@ -610,7 +618,15 @@ public function import($url)
*/
public function importFiles($url)
{
return $this->getWorkflows()->create('import_files', ['params' => compact('url'),]);
return $this->getWorkflows()->create(
'do_import',
[
'params' => [
'files' => 1,
'url' => $url,
],
]
);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function request($path, array $options = [])

$body = $debug_body = null;
if (isset($options['form_params'])) {
$body = json_encode($options['form_params']);
$body = json_encode($options['form_params'], JSON_UNESCAPED_SLASHES);
$debug_body = $options['form_params'];
}

Expand All @@ -163,10 +163,10 @@ public function request($path, array $options = [])
$this->logger->debug(
self::DEBUG_REQUEST_STRING,
[
'headers' => json_encode($this->stripSensitiveInfo($headers)),
'headers' => json_encode($this->stripSensitiveInfo($headers), JSON_UNESCAPED_SLASHES),
'uri' => $uri,
'method' => $method,
'body' => json_encode($this->stripSensitiveInfo($debug_body)),
'body' => json_encode($this->stripSensitiveInfo($debug_body), JSON_UNESCAPED_SLASHES),
]
);

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/backup-restore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
Content-type: application/json
Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:a594b620-9afd-11e6-9ac3-bc764e10d7c2:jUtT1HcKBZkGKptt6ZBEh'
Accept: null
body: '{"type":"restore_code","params":{"key":"11111111-1111-1111-1111-111111111111\/dev\/1477422817_backup\/behat-tests_dev_2016-10-25T19-13-37_UTC_code.tar.gz","bucket":"onebox-pantheon-backups"}}'
body: '{"type":"restore_code","params":{"key":"11111111-1111-1111-1111-111111111111/dev/1477422817_backup/behat-tests_dev_2016-10-25T19-13-37_UTC_code.tar.gz","bucket":"onebox-pantheon-backups"}}'
response:
status:
http_version: '1.1'
Expand Down Expand Up @@ -229,7 +229,7 @@
Content-type: application/json
Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:a594b620-9afd-11e6-9ac3-bc764e10d7c2:jUtT1HcKBZkGKptt6ZBEh'
Accept: null
body: '{"type":"restore_files","params":{"key":"11111111-1111-1111-1111-111111111111\/dev\/1477422817_backup\/behat-tests_dev_2016-10-25T19-13-37_UTC_files.tar.gz","bucket":"onebox-pantheon-backups"}}'
body: '{"type":"restore_files","params":{"key":"11111111-1111-1111-1111-111111111111/dev/1477422817_backup/behat-tests_dev_2016-10-25T19-13-37_UTC_files.tar.gz","bucket":"onebox-pantheon-backups"}}'
response:
status:
http_version: '1.1'
Expand Down
6 changes: 3 additions & 3 deletions tests/fixtures/import-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
absolute_url: ''
json: ''
Accept: null
body: '{"type":"import_database","params":{"url":"https:\/\/s3.amazonaws.com\/pantheondemofiles\/database.tar.gz"}}'
body: '{"type":"do_import","params":{"database":1,"url":"https://s3.amazonaws.com/pantheondemofiles/database.tar.gz"}}'
response:
status:
http_version: '1.1'
Expand All @@ -215,7 +215,7 @@
Cache-Control: no-cache
Pragma: no-cache
Vary: Accept-Encoding
body: '{"environment_id": "dev", "user_id": "11111111-1111-1111-1111-111111111111", "site_id": "11111111-1111-1111-1111-111111111111", "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "params": {"url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz"}, "task_ids": ["0bf649ec-6642-11e6-b1a5-bc764e1022a9", "0bf7fb7a-6642-11e6-b1a5-bc764e1022a9", "0bf96244-6642-11e6-b1a5-bc764e1022a9"], "role": "owner", "type": "import_database", "id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "key": "1471633200", "waiting_for_task_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "keep_forever": false, "phase": "created", "queued_time": null, "run_time": null, "created_at": 1471634453.506142, "reason": "", "environment": "dev", "final_task_id": null, "result": null, "total_time": null, "active_description": "Import database to \"dev\"", "description": "Import database to \"dev\"", "step": 1, "has_operation_log_output": false, "number_of_tasks": 3, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.506142Z%27,mode:quick,to:%27now%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "[email protected]"}, "user_email": "[email protected]", "waiting_for_task": {"environment": "dev", "fn_name": "queue_jenkins_task", "params": {"files": 0, "code": 0, "job_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "database": 1, "url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz", "site": "11111111-1111-1111-1111-111111111111", "host": "ellis.live.getpantheon.com", "task_type": "import_site", "env": "dev", "drush_archive": 0}, "site_id": "11111111-1111-1111-1111-111111111111", "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "key": "1471633200", "responses": [], "queued_time": null, "host": "ellis.live.getpantheon.com", "result": null, "phase": "created", "created_at": 1471634453.594366, "allow_concurrent": false, "run_time": null, "total_time": null, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.594366Z%27,mode:quick,to:%27now%27))", "type": "import_site", "build_url": null, "messages": {}}}'
body: '{"environment_id": "dev", "user_id": "11111111-1111-1111-1111-111111111111", "site_id": "11111111-1111-1111-1111-111111111111", "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "params": {"url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz"}, "task_ids": ["0bf649ec-6642-11e6-b1a5-bc764e1022a9", "0bf7fb7a-6642-11e6-b1a5-bc764e1022a9", "0bf96244-6642-11e6-b1a5-bc764e1022a9"], "role": "owner", "type": "do_import", "id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "key": "1471633200", "waiting_for_task_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "keep_forever": false, "phase": "created", "queued_time": null, "run_time": null, "created_at": 1471634453.506142, "reason": "", "environment": "dev", "final_task_id": null, "result": null, "total_time": null, "active_description": "Import database to \"dev\"", "description": "Import database to \"dev\"", "step": 1, "has_operation_log_output": false, "number_of_tasks": 3, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.506142Z%27,mode:quick,to:%27now%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "[email protected]"}, "user_email": "[email protected]", "waiting_for_task": {"environment": "dev", "fn_name": "queue_jenkins_task", "params": {"files": 0, "code": 0, "job_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "database": 1, "url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz", "site": "11111111-1111-1111-1111-111111111111", "host": "ellis.live.getpantheon.com", "task_type": "import_site", "env": "dev", "drush_archive": 0}, "site_id": "11111111-1111-1111-1111-111111111111", "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "key": "1471633200", "responses": [], "queued_time": null, "host": "ellis.live.getpantheon.com", "result": null, "phase": "created", "created_at": 1471634453.594366, "allow_concurrent": false, "run_time": null, "total_time": null, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.594366Z%27,mode:quick,to:%27now%27))", "type": "import_site", "build_url": null, "messages": {}}}'
-
request:
method: GET
Expand Down Expand Up @@ -251,4 +251,4 @@
Pragma: no-cache
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
body: '{"environment_id": "dev", "params": {"url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz"}, "role": "owner", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471634453.65632, "task_ids": ["0bf649ec-6642-11e6-b1a5-bc764e1022a9", "0bf7fb7a-6642-11e6-b1a5-bc764e1022a9", "0bf96244-6642-11e6-b1a5-bc764e1022a9"], "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "type": "import_database", "user_id": "11111111-1111-1111-1111-111111111111", "id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "key": "11111111-1111-1111-1111-111111111111", "waiting_for_task_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "keep_forever": false, "phase": "started", "queued_time": null, "run_time": null, "created_at": 1471634453.506142, "reason": "", "environment": "dev", "final_task_id": null, "result": "succeeded", "total_time": null, "active_description": "Importing database to \"dev\"", "description": "Import database to \"dev\"", "step": 1, "has_operation_log_output": false, "number_of_tasks": 3, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.506142Z%27,mode:quick,to:%27now%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "[email protected]"}, "user_email": "[email protected]", "waiting_for_task": {"build": {"url": "job/import_site/42760/", "number": 42760, "phase": "STARTED", "estimated_duration": 1691, "duration": 0, "full_url": "https://104.239.201.18:8090/jenkins/job/import_site/42760/"}, "environment": "dev", "fn_name": "queue_jenkins_task", "params": {"files": 0, "code": 0, "job_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "database": 1, "url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz", "site": "11111111-1111-1111-1111-111111111111", "host": "ellis.live.getpantheon.com", "task_type": "import_site", "env": "dev", "drush_archive": 0}, "queued_at": 1471634453.656653, "responses": [{"code": 201, "body": "Successfully queued import_site", "error_details": "", "internal_reason": ""}], "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471634454.911915, "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "key": "1471633200", "queued_time": 1.2552621364593506, "host": "ellis.live.getpantheon.com", "result": null, "phase": "started", "created_at": 1471634453.594366, "allow_concurrent": false, "run_time": null, "total_time": null, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.594366Z%27,mode:quick,to:%27now%27))", "type": "import_site", "build_url": "https://104.239.201.18:8090/jenkins/job/import_site/42760/", "messages": {"2016-08-19T19:20:55.302980": {"message": "Successfully queued import_site", "level": "INFO"}}}}'
body: '{"environment_id": "dev", "params": {"url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz"}, "role": "owner", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471634453.65632, "task_ids": ["0bf649ec-6642-11e6-b1a5-bc764e1022a9", "0bf7fb7a-6642-11e6-b1a5-bc764e1022a9", "0bf96244-6642-11e6-b1a5-bc764e1022a9"], "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "type": "do_import", "user_id": "11111111-1111-1111-1111-111111111111", "id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "key": "11111111-1111-1111-1111-111111111111", "waiting_for_task_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "keep_forever": false, "phase": "started", "queued_time": null, "run_time": null, "created_at": 1471634453.506142, "reason": "", "environment": "dev", "final_task_id": null, "result": "succeeded", "total_time": null, "active_description": "Importing database to \"dev\"", "description": "Import database to \"dev\"", "step": 1, "has_operation_log_output": false, "number_of_tasks": 3, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.506142Z%27,mode:quick,to:%27now%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "[email protected]"}, "user_email": "[email protected]", "waiting_for_task": {"build": {"url": "job/import_site/42760/", "number": 42760, "phase": "STARTED", "estimated_duration": 1691, "duration": 0, "full_url": "https://104.239.201.18:8090/jenkins/job/import_site/42760/"}, "environment": "dev", "fn_name": "queue_jenkins_task", "params": {"files": 0, "code": 0, "job_id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "database": 1, "url": "https://s3.amazonaws.com/pantheondemofiles/database.tar.gz", "site": "11111111-1111-1111-1111-111111111111", "host": "ellis.live.getpantheon.com", "task_type": "import_site", "env": "dev", "drush_archive": 0}, "queued_at": 1471634453.656653, "responses": [{"code": 201, "body": "Successfully queued import_site", "error_details": "", "internal_reason": ""}], "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471634454.911915, "trace_id": "0be1f050-6642-11e6-a69e-9d129c74acd7", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "0be8d3ac-6642-11e6-b1a5-bc764e1022a9", "id": "0bf649ec-6642-11e6-b1a5-bc764e1022a9", "key": "1471633200", "queued_time": 1.2552621364593506, "host": "ellis.live.getpantheon.com", "result": null, "phase": "started", "created_at": 1471634453.594366, "allow_concurrent": false, "run_time": null, "total_time": null, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:0be1f050-6642-11e6-a69e-9d129c74acd7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:15:53.594366Z%27,mode:quick,to:%27now%27))", "type": "import_site", "build_url": "https://104.239.201.18:8090/jenkins/job/import_site/42760/", "messages": {"2016-08-19T19:20:55.302980": {"message": "Successfully queued import_site", "level": "INFO"}}}}'
Loading