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

Executing arbitrary code in remote/local on push/pull #142

Closed
joeguilmette opened this issue Apr 6, 2015 · 7 comments
Closed

Executing arbitrary code in remote/local on push/pull #142

joeguilmette opened this issue Apr 6, 2015 · 7 comments

Comments

@joeguilmette
Copy link

I was thinking that it would be really neat to be able to have wordmove execute commands before or after a push or pull, dependent on environment. With this functionality, Wordmove will be become instantly more extensible and able to integrate with just about any other tool or API.

This could be configured in the Movefile like so:

production: #environment

[...]

  push: # on push to production
    remote: # execute the following in the production environment
      before: # before wordmove pushes
        - "php /etc/scripts/do-this-before-push.php" # execute code that exists on remote
      after:  # after push is complete
        - "sudo find /var/www/*/htdocs/ -type f -exec chmod 0675 {} \;" # help out with permissions on production after push
    local: # execute the following locally
      after:
        - "/etc/scripts/slackupdate.sh 'project' '@channel: Push to production by Joe' 'api/from/service'" # notify a Slack channel that a push has to production from a user has been made

  pull: # on pull from production
    local:
      after: 
        - "php /etc/scripts/dothisonpull.php" # execute code that exists on remote
        - "/etc/scripts/slackupdate.sh 'project' 'Pull from production by Joe' 'api/from/service'" # post in a Slack channel that a pull from local to production by a user has been made

And an example script (local:/etc/scripts/slackupdate.sh) to accompany the above Movefile:

#!/bin/bash

echo 'Sending update to #$0'
curl -X POST --data-urlencode 'payload={"channel": "#$0", "username": "Wordmove", "text": "$1"}' https://hooks.slack.com/services/$2" # integrate with external APIs
@joeguilmette joeguilmette changed the title Executing arbitrary code in remote and local on push/pull Executing arbitrary code in remote/local on push/pull Apr 6, 2015
@joeguilmette
Copy link
Author

I'm no ruby dev, so this is obviously beyond me. But it'd be useful enough that I'm willing to hire a dev on Elance or oDesk or whatever.

Do you guys think that this would be reasonably simple to implement by decent Ruby dev?

@delphaber
Copy link
Contributor

Hi @joeguilmette :) Yep, I think it reasonably easy to add this feature.
We have to think about it and decide if it should be implemented for the 1.3 release or not ( @pioneerskies )

@joeguilmette
Copy link
Author

Well, I'm willing to pay for this feature. If you guys don't have time,
like I said I am more than happy to go on oDesk.

Glad to hear you guys are receptive to adding it!
On Sun, Apr 26, 2015 at 9:14 PM Fabrizio Monti notifications@github.com
wrote:

Hi @joeguilmette https://github.com/joeguilmette :) Yep, I think it
reasonably easy to add this feature.
We have to think about it and decide if it should be implemented it for
the 1.3 release or not ( @pioneerskies https://github.com/pioneerskies )


Reply to this email directly or view it on GitHub
#142 (comment).

@veganista
Copy link

veganista commented Nov 29, 2017

Was this implemented in 2.2.0? I can't see any reference to it.

I'm having trouble with permissions getting copied over when pushing, so i'd like to use an after hook to run some scripts to fix the permissions.

Edit - It looks like this did the trick for me instead.

@alessandro-fazzi
Copy link
Member

Glad to read that @veganista .

The feature was never implemented; though convenient, it would be a more massive implementation than we thought. So we keep track, but it's actually stalled :(

@alessandro-fazzi
Copy link
Member

@joeguilmette , @veganista it's always fun to update issue after 2 years waiting ^^'''

But...we're on the way to go. Take a look here and here

I have to update a bit more of documentation, but feature is almost here and moreover it looks really cool to me. ;)

@alessandro-fazzi
Copy link
Member

Guys. We are on air. Closing this one 🎉 🌮

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants