From: Junio C Hamano <gitster@pobox.com>
To: Jessica Lucci <jessicalucci14@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: post-receive hooks based on push content
Date: Tue, 31 Jul 2012 12:07:34 -0700 [thread overview]
Message-ID: <7vsjc7iwax.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAC=i8BzHi6UF=GEAiEdUzcjQM3NjibPw=p5S2uOeaE31nDkkjA@mail.gmail.com> (Jessica Lucci's message of "Tue, 31 Jul 2012 13:27:57 -0500")
Jessica Lucci <jessicalucci14@gmail.com> writes:
> Hey guys,
>
> I'm trying to set up a post-receive hook that redirects code based on
> the content of the actual push. Specifically, I'm trying to set up
> automatic deployment of web apps with the option of sending the code
> to a build farm first. For example, if you push your code to a git
> repo, there should be a post-receive hook in there that looks to see
> if /www is empty or something. If /www is empty, the app has yet to be
> "built", so the hook should push the code to a build farm that can
> compile the code into a WAR file (or whatever is appropriate). If /www
> is already populated, we assume the code has already been compiled and
> will then push the code directly onto the node.
>
> So, first of all, is this even possible?
Should be.
> And if so, how would I go about writing this specific hook?
By writing the necessary pieces and then stringing them together?
- How do you see /www is empty? That is one piece. It is outside
of the scope of "git", but it perhaps involves looking at the
output of "ls /www" or something.
- How do you know if the app "has yet to be built"? That is
another piece and depends on how your build infrasture is set
up. It is outside of the scope of "git".
- How do you push the code to a build farm? You would be using
"git push $there $what", and presumably you know where $there is
(the repository your build farm reads from). $what is given as
the input for post-receive hook, or you can read the tip of the
ref you care about yourself, as your hook will run in the
receiving repository of the push.
- How do you push the code to a node? That would be left as an
exercise to the reader ;-), but would be similar to how you push
to your build farm, I would imagine.
prev parent reply other threads:[~2012-07-31 19:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 18:27 post-receive hooks based on push content Jessica Lucci
2012-07-31 19:07 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vsjc7iwax.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jessicalucci14@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).