Skip to content
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

Issue #813: Clear twig caches on deployments. #1151

Merged
merged 2 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion phing/tasks/deploy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
</target>

<target name="deploy:build" description="Generates a deploy-ready build in deploy.dir."
depends="frontend, setup:hash-salt, deploy:copy, deploy:composer:install, deploy:sanitize">
depends="frontend, setup:hash-salt, deploy:copy, deploy:composer:install, deploy:id, deploy:sanitize">
<!--Allow custom commands to be run before commit.-->
<phingcall target="target-hook:invoke">
<property name="hook-name" value="post-deploy-build"/>
Expand All @@ -139,6 +139,16 @@
</if>
</target>

<target name="deploy:id" description="Writes deployment id information to artifact.">
<if>
<isset property="deploy.tag"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why only do this for tags? I seems like we'd want it for all build artifacts.

<then>
<!-- Write tag name for the benefit of environments like ACE that can't access it. -->
<exec dir="${deploy.dir}" command="echo '${deploy.tag}' > deployment_identifier" logoutput="true" checkreturn="true" level="${blt.exec_level}"/>
</then>
</if>
</target>

<target name="deploy:commit" hidden="true">
<!-- We make these commands quiet because they can cause the output to be so long that Travis CI stops logging. -->
<exec command="git add -A" dir="${deploy.dir}" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
Expand Down
14 changes: 14 additions & 0 deletions settings/blt.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@
*/
$settings['hash_salt'] = file_get_contents(DRUPAL_ROOT . '/../salt.txt');

/**
* Deployment identifier.
*
* Drupal's dependency injection container will be automatically invalidated and
* rebuilt when the Drupal core version changes. When updating contributed or
* custom code that changes the container, changing this identifier will also
* allow the container to be invalidated as soon as code is deployed.
*/
$settings['deployment_identifier'] = \Drupal::VERSION;
$deploy_id_file = DRUPAL_ROOT . '/../deployment_identifier';
if (file_exists($deploy_id_file)) {
$settings['deployment_identifier'] = file_get_contents($deploy_id_file);
}

/*******************************************************************************
* Environment-specific includes.
******************************************************************************/
Expand Down
5 changes: 5 additions & 0 deletions template/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
"drush/contrib/{$name}": [
"type:drupal-drush"
]
},
"patches": {
"drupal/core": {
"Clear Twig caches on deploys": "https://www.drupal.org/files/issues/no_reliable_method-2752961-29.patch"
}
}
},
"scripts": {
Expand Down