Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
automatic_updates
Commits
e9e7c28f
Commit
e9e7c28f
authored
3 years ago
by
Adam G-H
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3243600
by phenaproxima: ProcessFactory can cause a race condition
parent
ff08e719
No related branches found
No related tags found
1 merge request
!76
Issue #3243600: ProcessFactory can cause a race condition
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
drupalci.yml
+19
-18
19 additions, 18 deletions
drupalci.yml
package_manager/package_manager.services.yml
+3
-0
3 additions, 0 deletions
package_manager/package_manager.services.yml
package_manager/src/ProcessFactory.php
+29
-7
29 additions, 7 deletions
package_manager/src/ProcessFactory.php
with
51 additions
and
25 deletions
drupalci.yml
+
19
−
18
View file @
e9e7c28f
...
@@ -47,28 +47,29 @@ build:
...
@@ -47,28 +47,29 @@ build:
# halt-on-fail can be set on the run_tests tasks in order to fail fast.
# halt-on-fail can be set on the run_tests tasks in order to fail fast.
# suppress-deprecations is false in order to be alerted to usages of
# suppress-deprecations is false in order to be alerted to usages of
# deprecated code.
# deprecated code.
run_tests.phpunit
:
#
run_tests.phpunit:
types
:
'
PHPUnit-Unit'
#
types: 'PHPUnit-Unit'
testgroups
:
'
--all'
#
testgroups: '--all'
suppress-deprecations
:
false
#
suppress-deprecations: false
halt-on-fail
:
false
#
halt-on-fail: false
run_tests.kernel
:
run_tests.kernel
:
types
:
'
PHPUnit-Kernel'
types
:
'
PHPUnit-Kernel'
testgroups
:
'
--all'
testgroups
:
'
--all'
suppress-deprecations
:
false
suppress-deprecations
:
false
halt-on-fail
:
false
halt-on-fail
:
falses
run_tests.build
:
repeat
:
100
# Limit concurrency due to disk space concerns.
# run_tests.build:
concurrency
:
15
# # Limit concurrency due to disk space concerns.
types
:
'
PHPUnit-Build'
# concurrency: 15
testgroups
:
'
--all'
# types: 'PHPUnit-Build'
suppress-deprecations
:
false
# testgroups: '--all'
halt-on-fail
:
false
# suppress-deprecations: false
run_tests.functional
:
# halt-on-fail: false
types
:
'
PHPUnit-Functional'
# run_tests.functional:
testgroups
:
'
--all'
# types: 'PHPUnit-Functional'
suppress-deprecations
:
false
# testgroups: '--all'
halt-on-fail
:
false
# suppress-deprecations: false
# halt-on-fail: false
# Functional JavaScript tests require a concurrency of 1 because there is
# Functional JavaScript tests require a concurrency of 1 because there is
# only one instance of PhantomJS on the testbot machine.
# only one instance of PhantomJS on the testbot machine.
#run_tests.javascript:
#run_tests.javascript:
...
...
This diff is collapsed.
Click to expand it.
package_manager/package_manager.services.yml
+
3
−
0
View file @
e9e7c28f
...
@@ -10,6 +10,9 @@ services:
...
@@ -10,6 +10,9 @@ services:
# Basic infrastructure services.
# Basic infrastructure services.
package_manager.process_factory
:
package_manager.process_factory
:
class
:
Drupal\package_manager\ProcessFactory
class
:
Drupal\package_manager\ProcessFactory
arguments
:
-
'
@file_system'
-
'
@config.factory'
package_manager.file_system
:
package_manager.file_system
:
class
:
PhpTuf\ComposerStager\Infrastructure\Filesystem\Filesystem
class
:
PhpTuf\ComposerStager\Infrastructure\Filesystem\Filesystem
arguments
:
arguments
:
...
...
This diff is collapsed.
Click to expand it.
package_manager/src/ProcessFactory.php
+
29
−
7
View file @
e9e7c28f
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
namespace
Drupal\package_manager
;
namespace
Drupal\package_manager
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\File\FileSystemInterface
;
use
PhpTuf\ComposerStager\Infrastructure\Process\ProcessFactory
as
StagerProcessFactory
;
use
PhpTuf\ComposerStager\Infrastructure\Process\ProcessFactory
as
StagerProcessFactory
;
use
PhpTuf\ComposerStager\Infrastructure\Process\ProcessFactoryInterface
;
use
PhpTuf\ComposerStager\Infrastructure\Process\ProcessFactoryInterface
;
use
Symfony\Component\Process\Process
;
use
Symfony\Component\Process\Process
;
...
@@ -20,11 +22,32 @@ final class ProcessFactory implements ProcessFactoryInterface {
...
@@ -20,11 +22,32 @@ final class ProcessFactory implements ProcessFactoryInterface {
*/
*/
private
$decorated
;
private
$decorated
;
/**
* The file system service.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
private
$fileSystem
;
/**
* The config factory service.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
private
$configFactory
;
/**
/**
* Constructs a ProcessFactory object.
* Constructs a ProcessFactory object.
*
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
*/
*/
public
function
__construct
()
{
public
function
__construct
(
FileSystemInterface
$file_system
,
ConfigFactoryInterface
$config_factory
)
{
$this
->
decorated
=
new
StagerProcessFactory
();
$this
->
decorated
=
new
StagerProcessFactory
();
$this
->
fileSystem
=
$file_system
;
$this
->
configFactory
=
$config_factory
;
}
}
/**
/**
...
@@ -65,12 +88,11 @@ final class ProcessFactory implements ProcessFactoryInterface {
...
@@ -65,12 +88,11 @@ final class ProcessFactory implements ProcessFactoryInterface {
* The path which should be used as COMPOSER_HOME.
* The path which should be used as COMPOSER_HOME.
*/
*/
private
function
getComposerHomePath
():
string
{
private
function
getComposerHomePath
():
string
{
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$home_path
=
$this
->
fileSystem
->
getTempDirectory
();
$file_system
=
\Drupal
::
service
(
'file_system'
);
$home_path
.
=
'/automatic_updates_composer_home-'
;
$home_path
=
$file_system
->
getTempDirectory
()
.
'/automatic_updates_composer_home'
;
$home_path
.
=
$this
->
configFactory
->
get
(
'system.site'
)
->
get
(
'uuid'
);
if
(
!
is_dir
(
$home_path
))
{
$this
->
fileSystem
->
prepareDirectory
(
$home_path
,
FileSystemInterface
::
CREATE_DIRECTORY
|
FileSystemInterface
::
MODIFY_PERMISSIONS
);
mkdir
(
$home_path
);
}
return
$home_path
;
return
$home_path
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment