Commit 67a56c5a authored by Anja Leichsenring's avatar Anja Leichsenring Committed by Andreas Fernandez
Browse files

[BUGFIX] Use composer min version depending on PHP version handled

The composer min stage in nightly tests should respect the PHP version
the run is executed with.
So the platform.php setting will be the lowest possible PHP version
of its own input, not the lowest possible TYPO3 currently supports.

Resolves: #93020
Releases: master, 10.4
Change-Id: Id5cd4d4bce5f015ae35303cbcd0d0d561730204a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66940


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 7cf3dac9
......@@ -34,6 +34,8 @@ import com.atlassian.bamboo.specs.util.MapBuilder;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* Abstract class with common methods of pre-merge and nightly plan
......@@ -57,6 +59,8 @@ abstract class AbstractCoreSpec {
// will execute `composer update --prefer-lowest`
public static final int COMPOSER_MIN = 2;
static Map<String, String> phpMinVersions = new HashMap<String, String>();
/**
* Default permissions on core plans
*/
......@@ -1752,18 +1756,18 @@ abstract class AbstractCoreSpec {
* This will update all dependencies to current possible minimum version.
* Used in nightly to see if we are compatible with lowest possible dependency versions.
* <p>
* We update in 2 steps: First composer install as usual, then update. This
* way it is easy to see which packages are updated in comparison to what is
* currently defined in composer.lock.
* We set the php platform requirement to the lowest for the given PHP version.
* In reality we use PHP 7.4.1 or 7.2.1, depending on the currently handled PHP version.
*/
Task getTaskComposerUpdateMin(String requirementIdentifier) {
String phpVersion = phpMinVersions.get(requirementIdentifier);
return new ScriptTask()
.description("composer update --prefer-lowest")
.interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
.inlineBody(
this.getScriptTaskBashInlineBody() +
this.getScriptTaskComposer(requirementIdentifier) +
"composer config platform.php 7.4.1\n" +
"composer config platform.php " + phpVersion + "\n" +
"composer update --prefer-lowest --no-progress --no-interaction"
)
.environmentVariables(this.composerRootVersionEnvironment);
......
......@@ -53,10 +53,12 @@ public class NightlySpec extends AbstractCoreSpec {
* Run main to publish plan on Bamboo
*/
public static void main(final String[] args) throws Exception {
phpMinVersions.put("PHP74", "7.4.1");
// By default credentials are read from the '.credentials' file.
BambooServer bambooServer = new BambooServer(bambooServerName);
bambooServer.publish(new NightlySpec().createPlan());
bambooServer.publish(new NightlySpec().getDefaultPlanPermissions(projectKey, planKey));
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment