Applying Security Updates to Drupal Core on Pantheon
The Pantheon platform is an easy method to apply core and security updates to your Drupal sites. All you need to do is navigate to the dashboard of your site to see if there are any new releases for Drupal core. If there is, you will see an “Apply Updates” button. Once you click this button, you’ll be ready to run some tests and deploy them to production.
However, it is important for you to remember to not update Drupal core on the live server. It is recommended that you first create a dev environment and then update Drupal core on it.
Pantheon maintains the core upstream repository for WordPress and Drupal 8. The upstream repository acts as a parent source to the site repository.
The update is made by Pantheon in the core update repository. Apply a one-click update to the individual site repository using the site dashboard on Pantheon, manually from the command line.
Let’s take a look at how you can apply and debug upstream updates from Pantheon or a Custom Upstream:
How To Apply Upstream Updates Via The Site Dashboard?
1. Navigate to the ‘Code’ tab in the site dashboard on the dev environment where you can check the available updates.
2. If your SFTP changes are active, then you can change files through the SFTP mode. You will see changes on the dashboard. Deploy the changes and set the site’s connection mode to git.
3. Check for the auto-resolve conflicts, if you want to automatically resolve conflicts during the update.
4. Click apply updates.
5. If the update is done successfully without conflicts, then visit the development site in the development environment to test and QA the site.
But sometimes merge conflicts occur while updating from the Pantheon dashboard.
How To Resolve Conflicts?
There are two ways to resolve them:
(A) Manually resolving conflicts by removing or reuploading conflict files
1. Switch back to the SFTP mode.
2. Check the conflict files and compare them with the core upstream repository master branch of Pantheon-systems /drops-8.
3. Files that are changed in the master branch of Pantheon-systems /drops-8 or removed from this branch are then manually re-uploaded and removed from the files through SFTP.
4. Commit the changes in the dashboard.
5. Switch back to the connection mode git and reapply updates.
(B) You can apply Upstreams update manually through the following steps to resolve merge conflicts:
Pantheon’s git FAQ states that Pantheon support will not help you with the resolution of issues with git.
Interestingly, Grazitti’s technical team has installed the git locally, and we can resolve the conflicts using the git command line.
Step 1:
Use the clone with git and clone your site’s repo with the command line.
git clone ssh://[URL-YOU-GET-FROM-PANTHEON-DASHBOARD] [NAME OF SITE-YOU-GET-FROM-PANTHEON-DASHBOARD]
cd [NAME OF SITE]
Step 2:
git pull -Xtheirs git://github.com/pantheon-systems/drops-8.git master
After this step if you get a message that says:
“Pull is not possible because you have unmerged files,” you can fix them up in the work tree, and then use ‘git add/rm <file> ‘ as appropriate to resolve this, or use ‘git commit -a’.
Step 3:
Adding all files using the command.
Git add – a
Then commit the file using the command.
git commit – m “Manually merged upstream update”
Now, push all changes on the Pantheon server.
git push – force
If you are unsure of what you just committed, you can see the change using this command.
git reset – hard HEAD~1
git push
In this article, you learned about installing security updates to Drupal core on Pantheon. Should you want to know more, please email us at [email protected] and we’ll take it from there.