I am moving all of the "deployment hooks" code from devshop to Hosting Git, now calling them "git hooks". That's what I called the checkboxes for running updb, cc all, etc.

I'm moving them into Hosting Git.

Here's the plan:

  1. Add 'git_hooks' column to {hosting_git} table.
  2. Add 'Git Hooks' field listing checkboxes of available hooks along with code for insert and update. (For site nodes only.)
  3. Add 'hook_hosting_git_hooks()' to allow modules to return list of git hooks.
  4. Add git_hooks as a provision context property.
  5. Add code to run each git hook on git checkout and git pull tasks. If git pull or checkout is being run on a platform, run the git hooks for every site on the platform.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jon Pugh created an issue. See original summary.

  • Jon Pugh committed c00f59c on 2897894-git-hooks
    Issue #2897894: Add configurable "Git Hooks"  to site nodes:
    - Add '...

  • Jon Pugh committed d5aff35 on 2897894-git-hooks
    Issue #2897894: Get list of site aliases using...
  • Jon Pugh committed efb86a8 on 2897894-git-hooks
    Issue #2897894: Add a post hosting checkout and pull hook to queue...

  • Jon Pugh committed 5d7d155 on 2897894-git-hooks
    Issue #2897894: Add hooks container element so that we can hide it when...
  • Jon Pugh committed 69099a6 on 2897894-git-hooks
    Issue #2897894: Add hooks form elements to Git Pull task form.
    
Jon Pugh’s picture

Status: Active » Needs review
FileSize
21.39 KB
Jon Pugh’s picture

FileSize
21.39 KB
helmo’s picture

I added one minor fix to the feature branch.

On a test platform (from git) with a site (not in git) I get "No hooks to invoke in site s1.example.com: %hooks." ..
Clearly a missing placeholder ... but more.

I selected two hook for the platform, but none for the site.
Looking at the code there seems no way that it uses the hooks configured for the site ... should that be removed from the create node form?

Jon Pugh’s picture

I think we should only allow hooks on sites.

Also, a site can have git hooks even if it is not in git, if it's platform is in git.

I have a big branch in devshop that would switch to use these tasks, so it's going to take a bit more time to get this right. I don't think we will get it done for 3.12.0

helmo’s picture

#2888523: Add "Sanitize database" site task would also be a nice one to add to the default list once ready.

Jon Pugh’s picture

Right now if you use Hosting Git to setup a site with a git repo using the recommended "drupal-composer" project, the platform verify fails.

The reason is that the site is missing components until composer install is run. So we need to be able to run composer install pre-verify for situations like this.

See https://www.drupal.org/docs/develop/using-composer/using-composer-to-man...
or
https://github.com/drupal-composer/drupal-project

  • Jon Pugh committed 693c6c2 on 2897894-git-hooks
    Issue #2897894: Add "git hooks" to allow extensible reactions to Git...
Jon Pugh’s picture

Status: Needs review » Needs work

The problem I'm describing in the comment above is fixed in #2937147: Add Composer support directly to Provision., going out in the next release.

helmo’s picture

FileSize
1.32 KB

I just pushed some api doc updates...

And here's a patch that might help with the site vs platform hooks ... let me know if it conflicts with your thoughts.

Jon Pugh’s picture

I've created a pull request for improved tests that check Git settings.

They aren't passing yet, and need tests to confirm the hooks run on task execute.

https://github.com/aegir-project/tests/pull/15