-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Make kernel build time optionally deterministic #26128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HttpKernel] Make kernel build time optionally deterministic #26128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is going to be fun to document :)
I'd suggest to open a doc issue/PR related to this ongoing work on reproducibility
@@ -717,6 +717,7 @@ protected function getKernelParameters() | |||
'kernel.bundles_metadata' => $bundlesMetadata, | |||
'kernel.charset' => $this->getCharset(), | |||
'kernel.container_class' => $this->getContainerClass(), | |||
'kernel.container_build_time' => time(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, this doesn't work: before this change, the container had always the same hash, thus was stored always in the same dir. Now that this param is time dependent - and since it's dumped into the container, this property is broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean because kernel.container_build_time will be different for every request? That is indeed true but it’s only used in the dumper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to just introduce a method that returns the build time. People who want to make it deterministic can hook their own getenv() magic in there.
@@ -855,6 +855,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container | |||
'as_files' => true, | |||
'debug' => $this->debug, | |||
'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null, | |||
'build_time' => $this->getContainerBuildTime(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the method, what about adding the option only when a kernel.container_build_time parameter exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this?
Thank you @lstrojny. |
This PR was merged into the 3.4 branch. Discussion ---------- Make kernel build time optionally deterministic | Q | A | ------------- | --- | Branch? | master for features / 2.7 up to 4.0 for bug fixes <!-- see below --> | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As part of the effort to enable reproducible builds, this PR allows setting a deterministic build time for the dumped kernel. Parent issue is #25958. Commits ------- 48e8249 Make kernel build time optionally deterministic
As part of the effort to enable reproducible builds, this PR allows setting a deterministic build time for the dumped kernel. Parent issue is #25958.