Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5e3c94d
First Attempt to add an "apply method via CI Server".
Sep 8, 2019
723deb1
Added method for reverting applied patches, added methods to reduce d…
Sep 9, 2019
690a3c7
Small fix to avoid calling apply method multiple times.
Sep 9, 2019
82befbe
Added a validation in revert method to check if a directory is empty …
Sep 9, 2019
aaeccd3
Added method for reverting applied patches, added methods to reduce d…
Sep 10, 2019
8f06c8d
Refactored JSCode for button-click events.
Sep 10, 2019
16c4158
Added Git-Request to retrieve sha in applyWithCiServer method.
Sep 10, 2019
84cb1b3
Fixed revert/applying patch methods and added language constants.
Sep 11, 2019
b5bd811
Fixed deleting files from master.
Sep 11, 2019
13bc747
Added configuration support for CI-Server. Now it is possible to swit…
Sep 11, 2019
7360369
Added patch chain to lock order of reverting - avoid demolishing own …
Sep 11, 2019
1006702
Added patch chain to lock order of reverting - avoid demolishing own …
Sep 11, 2019
4f301b2
Merge remote-tracking branch 'origin/4.0-dev' into 4.0-dev
Sep 11, 2019
a321ad0
Changed parameter of revert from db_id to pull_id. Configured resetCo…
Sep 12, 2019
3b1f157
Reworked patchChain as json to store pull_id and db_id for checking l…
Sep 12, 2019
26b5399
First attempt to move the patch_chain.json to database.
Sep 12, 2019
4ffb145
Fixes to previous commit.
Sep 12, 2019
f9eb75c
Added gate way to prevent reverting ci applied pulls with git option.…
Sep 12, 2019
f958707
Modified default value for server.url in ciSettings.
Sep 12, 2019
0e1d201
Updated composer.lock
Sep 12, 2019
5daeb04
Updated some lines to Joomla coding standards.
Sep 14, 2019
b5b0636
Re-added J3 templates and replaced JScript via anchor with event bind…
Sep 15, 2019
e7bf31b
Re-configured CI url in Helper and in default values for CI settings.
Sep 18, 2019
81f76e4
Added an additional condition to ignore the "apply by ci path" automa…
Sep 23, 2019
986b6cf
Apply suggestions from code review
sebenns Sep 30, 2019
5a19d0a
Reverted some changes f.e. white-spaces between separators in ini fil…
sebenns Sep 30, 2019
502a493
Merge branch '4.0-dev' of https://github.com/eXsiLe95/patchtester int…
sebenns Sep 30, 2019
6f4a951
Apply suggestions from code review
sebenns Oct 1, 2019
4103c5f
Regenerated composer.lock, reformatted config.xml and replaced let as…
sebenns Oct 1, 2019
bdd05fe
Merge remote-tracking branch 'origin/4.0-dev' into 4.0-dev
sebenns Oct 1, 2019
af4cecf
Merge branch '4.0-dev' into 4.0-dev
Hackwar Oct 13, 2019
8286b48
Merge remote-tracking branch 'origin/4.0-dev' into 4.0-dev
sebenns Oct 17, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,61 @@ public function execute()
$testsModel = new TestsModel(null, Factory::getDbo());

// Check the applied patches in the database first
$appliedPatches = $testsModel->getAppliedPatches();
$appliedPatches = $pullModel->getPatchesDividedInProcs();

if (count($appliedPatches))
if (count($appliedPatches["git"]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use single quotes except where double quotes are necessary.

{
$revertErrored = false;

// Let's try to cleanly revert all applied patches
foreach ($appliedPatches as $patch)
foreach ($appliedPatches["git"] as $patch)
{
try
{
$pullModel->revert($patch->id);
$pullModel->revertWithGitHub($patch->id);
}
catch (\RuntimeException $e)
{
$revertErrored = true;
}
}
}

// If we errored out reverting patches, we'll need to truncate the table
if ($revertErrored)
if (count($appliedPatches["ci"]))
{
$revertErrored = false;

// Let's try to cleanly revert all applied patches with ci
foreach ($appliedPatches["ci"] as $patch)
{
try
{
$testsModel->truncateTable();
$pullModel->revertWithCIServer($patch->insert_id);
}
catch (\RuntimeException $e)
{
$hasErrors = true;

$this->getApplication()->enqueueMessage(
Text::sprintf('COM_PATCHTESTER_ERROR_TRUNCATING_PULLS_TABLE', $e->getMessage()), 'error'
);
$revertErrored = true;
}
}
}

// If we errored out reverting patches, we'll need to truncate the table
if ($revertErrored)
{
try
{
$testsModel->truncateTable();
}
catch (\RuntimeException $e)
{
$hasErrors = true;

$this->getApplication()->enqueueMessage(
Text::sprintf('COM_PATCHTESTER_ERROR_TRUNCATING_PULLS_TABLE', $e->getMessage()), 'error'
);
}
}

// Now truncate the pulls table
try
{
Expand Down
30 changes: 30 additions & 0 deletions administrator/components/com_patchtester/PatchTester/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,34 @@ public static function initializeGithub()

return new GitHub($options);
}

/**
* Initializes the CI Settings
*
* @return Registry
*
* @since 3.0
*/
public static function initializeCISettings()
{
$params = ComponentHelper::getParams('com_patchtester');

$options = new Registry;

// Set CI server address for the request
$options->set('server.url', $params->get('ci_server', 'https://ci.joomla.org'));

// Set name of the zip archive
$options->set('zip.name', 'build.zip');
$options->set('zip.log.name', 'deleted_files.log');

// Set temp archive for extracting and downloading files
$options->set('folder.temp', Factory::getConfig()->get('tmp_path'));
$options->set('folder.backups', JPATH_COMPONENT . '/backups');

// Set full url for addressing the file
$options->set('zip.url', $options->get('server.url') . '/artifacts/joomla-cms/4.0-dev/%s/patchtester/' . $options->get('zip.name'));

return $options;
}
}
Loading