I'm trying to hook a module in so that just before and just after a deployment I can run some custom module code.

I've already found that you can hook into hook_deploy_operation_info() before things are run and in that you can specify preprocess and postprocess functions to call but these are run for each entity and not before/after the whole deployment has completed.
I don't really want or know whether it is worth declaring and running hook_deploy as I don't know enough about that yet.

Also it would be nice if there was a rule event which could be hooked into so that you could run custom rule actions after a deployment had completed (or failed).

Cheers

CommentFileSizeAuthor
#1 deploy-add-post-deploy-hooks.patch745 bytesbadjava
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

badjava’s picture

Issue summary: View changes
FileSize
745 bytes

Here is a patch I wrote for a post-deployment hook that can be implemented using hook_deploy_plan_publish($status) where $status is TRUE or FALSE depending on whether the deploy succeeded or not.

skwashd’s picture

Status: Active » Needs work

@badjava thanks for the patch. This is handy for use cases where hook_entity_insert()/hook_entity_update() isn't appropriate.

Overall it looks good but before it can be committed we need the hooks to be documented in deploy.api.php.

badjava’s picture

  • skwashd committed 2a1c3e5 on 7.x-2.x
    Merge pull request #10 from dickolsson/1890408
    
    Post-deploy hook d.o #...
  • skwashd committed 6cc223c on 7.x-2.x authored by badjava
    Issue #1890408 by badjava: hooks for pre/post deployment
    
  • skwashd committed 8319165 on 7.x-2.x authored by badjava
    Issue #1890408 by badjava: Add API documentation for post deployment...
skwashd’s picture

Status: Needs work » Fixed

@badjava thanks for the patch. This was reworked on github PR:10 and committed.

  • skwashd committed 6cc223c on 8.x-1.x authored by badjava
    Issue #1890408 by badjava: hooks for pre/post deployment
    
  • skwashd committed 8319165 on 8.x-1.x authored by badjava
    Issue #1890408 by badjava: Add API documentation for post deployment...
  • skwashd committed 2a1c3e5 on 8.x-1.x
    Merge pull request #10 from dickolsson/1890408
    
    Post-deploy hook d.o #...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.