Check if all issues PRs are merged
This commit is contained in:
committed by
M. Shull
parent
29bc60daaa
commit
98c9461a15
17
RoboFile.php
17
RoboFile.php
@@ -518,6 +518,9 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$version = $this->releaseVersionAssign($version, ['return' => true]);
|
$version = $this->releaseVersionAssign($version, ['return' => true]);
|
||||||
|
|
||||||
return $this->collectionBuilder()
|
return $this->collectionBuilder()
|
||||||
|
->addCode(function () use ($version) {
|
||||||
|
return $this->releaseCheckIssues($version);
|
||||||
|
})
|
||||||
->addCode(function () use ($version) {
|
->addCode(function () use ($version) {
|
||||||
return $this->releaseVersionWrite($version);
|
return $this->releaseVersionWrite($version);
|
||||||
})
|
})
|
||||||
@@ -527,6 +530,20 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function releaseCheckIssues($version = null) {
|
||||||
|
$jira = $this->createJiraController();
|
||||||
|
$version = $jira->getVersion($this->releaseVersionGetNext($version));
|
||||||
|
$issues = $jira->getIssuesDataForVersion($version);
|
||||||
|
$pull_requests_id = \MailPoetTasks\Release\JiraController::PULL_REQUESTS_ID;
|
||||||
|
foreach ($issues as $issue) {
|
||||||
|
if (strpos($issue['fields'][$pull_requests_id], 'state=OPEN') !== false) {
|
||||||
|
$key = $issue['key'];
|
||||||
|
$this->yell("Some pull request associated to task {$key} is not merged yet!", 40, 'red');
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function releasePublish($version = null) {
|
public function releasePublish($version = null) {
|
||||||
$version = $this->releaseVersionGetNext($version);
|
$version = $this->releaseVersionGetNext($version);
|
||||||
return $this->collectionBuilder()
|
return $this->collectionBuilder()
|
||||||
|
@@ -9,6 +9,7 @@ class JiraController {
|
|||||||
const CHANGELOG_FIELD_ID = 'customfield_10500';
|
const CHANGELOG_FIELD_ID = 'customfield_10500';
|
||||||
const RELEASENOTE_FIELD_ID = 'customfield_10504';
|
const RELEASENOTE_FIELD_ID = 'customfield_10504';
|
||||||
const VERSION_INCREMENT_FIELD_ID = 'customfield_10509';
|
const VERSION_INCREMENT_FIELD_ID = 'customfield_10509';
|
||||||
|
const PULL_REQUESTS_ID = 'customfield_10000';
|
||||||
|
|
||||||
const WONT_DO_RESOLUTION_ID = '10001';
|
const WONT_DO_RESOLUTION_ID = '10001';
|
||||||
|
|
||||||
@@ -100,7 +101,8 @@ class JiraController {
|
|||||||
function getIssuesDataForVersion($version) {
|
function getIssuesDataForVersion($version) {
|
||||||
$changelog_id = self::CHANGELOG_FIELD_ID;
|
$changelog_id = self::CHANGELOG_FIELD_ID;
|
||||||
$release_note_id = self::RELEASENOTE_FIELD_ID;
|
$release_note_id = self::RELEASENOTE_FIELD_ID;
|
||||||
$issues_data = $this->search("fixVersion={$version['id']}", ['key', $changelog_id, $release_note_id, 'status', 'resolution']);
|
$pull_requests_id = self::PULL_REQUESTS_ID;
|
||||||
|
$issues_data = $this->search("fixVersion={$version['id']}", ['key', $changelog_id, $release_note_id, 'status', 'resolution', $pull_requests_id]);
|
||||||
// Sort issues by importance of change (Added -> Updated -> Improved -> Changed -> Fixed -> Others)
|
// Sort issues by importance of change (Added -> Updated -> Improved -> Changed -> Fixed -> Others)
|
||||||
usort($issues_data['issues'], function($a, $b) use ($changelog_id) {
|
usort($issues_data['issues'], function($a, $b) use ($changelog_id) {
|
||||||
$order = array_flip(['added', 'updat', 'impro', 'chang', 'fixed']);
|
$order = array_flip(['added', 'updat', 'impro', 'chang', 'fixed']);
|
||||||
|
Reference in New Issue
Block a user