From dae4cd253b8904db1fcce566e694d519c51a8266 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 12 Jul 2022 10:04:21 +1200 Subject: [PATCH] FIX Hardcode some module versions to installer version --- consts.php | 10 ++++++++++ job_creator.php | 8 ++++++++ tests/JobCreatorTest.php | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/consts.php b/consts.php index 3d7a86e..38706f0 100644 --- a/consts.php +++ b/consts.php @@ -106,3 +106,13 @@ 'silverstripe-installer' => '5', ], ]; + +const INSTALLER_TO_REPO_MINOR_VERSIONS = [ + '4.10' => [ + 'html5' => '2.3', + 'silverstripe-elemental-bannerblock' => '2.4', + 'silverstripe-session-manager' => '1.2', + 'silverstripe-userforms' => '5.12', + 'silverstripe-totp-authenticator' => '4.3', + ] +]; diff --git a/job_creator.php b/job_creator.php index 00e700a..4d3686a 100644 --- a/job_creator.php +++ b/job_creator.php @@ -32,6 +32,14 @@ public function getInstallerVersion(): string return $cmsMajor . '.' . $portions[1] . '.x-dev'; } } + // hardcoded installer version for repo version + foreach (array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS) as $installerVersion) { + foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $repoVersion) { + if ($repo === $_repo && $repoVersion === $branch) { + return $installerVersion . '.x-dev'; + } + } + } // fallback to use the latest minor version of installer $installerVersions = array_keys(INSTALLER_TO_PHP_VERSIONS); $installerVersions = array_filter($installerVersions, fn($version) => substr($version, 0, 1) === $cmsMajor); diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index dfd4bac..0a586e9 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -126,6 +126,10 @@ public function provideGetInstallerVersion(): array ['myaccount/silverstripe-tagfield', 'pulls/burger/myfeature', $latest], ['myaccount/silverstripe-tagfield', '2-release', $latest], ['myaccount/silverstripe-tagfield', '2.9-release', $latest], + // hardcoded repo version + ['myaccount/silverstripe-session-manager', '1', $latest], + ['myaccount/silverstripe-session-manager', '1.2', '4.10.x-dev'], + ['myaccount/silverstripe-session-manager', 'burger', $latest], ]; }