Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Looking for post-receive githook puppet environments examples

Alan Laird February 8, 2014

Hi,

In other git environments, I'm able to have the git server perform a post-receive githook to push user branches out to the puppetmaster:/etc/puppet/environments/branchname.

Stash githook support is different so I'm running into an issue where I have not seen any good examples of this workflow.

Thanks,

Alan

5 answers

0 votes
Alan Laird February 23, 2014

Hi Charles,

External Hooks should work great for me. Is there a document of exposed environment variables that can be used in the plugin environment?

Thanks!


Alan

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2014

Hi Alan,

There are the three input parameters listed on the marketplace page:

Specified executables will receive "$from_ref $to_ref $ref_name" lines on stdin (see "man githooks").

For the environmental variables, the best place is to go directly to the source:

https://github.com/ngsru/atlassian-external-hooks/blob/master/src/main/java/com/ngs/stash/externalhooks/hook/ExternalPostReceiveHook.java#L55

Cheers,

Charles

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2014

Thanks Alan, that helps.

One option would be to just use raw Git hooks, putting the SSH key on the filesystem somewhere. You could use the External Hooks plugin as a mechanism to launch the script if you want per-repository configuration.

Alternatively you could either the mirror plugin mentioned above, enabling HTTP on the puppet server, or setup an SSH mirror with the Mirror Manager.

Another option would be to send a webhook to the server, which listens on HTTP and then does the fetch that way.

Do any of those options sound appealing/useful?

Charles

0 votes
Alan Laird February 21, 2014

Hi Charles,

I have old post-receive githooks that ssh from the git server to the puppet servers and perform a 'git pull'. Pretty basic stuff.

Alan

0 votes
Alan Laird February 19, 2014

Hi Charles,

I would like to push branches out to various servers and directories. Production, nonproduction and user server/dir pairs. I'm moving towards git-flow and trying to to figure out user branching and testing.

Thanks,

Alan

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2014

Hi Alan,

My apologies - I'm not all that familar with exact mechanics of Puppet. Can/does puppet do polling/fetching to receive updates? Or will you need to push to the puppet servers from Stash? If the latter is the mirror plugin linked above enough or if not then why?

Sorry for the 20 questions, I just need to understand exactly what you're trying to do.

Charles

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2014

Hi Alan,

If you need to you can certainly use raw Git hooks on the Stash server. But otherwise, or in general, we recommend using our Repository Hooks:

https://developer.atlassian.com/stash/docs/latest/how-tos/repository-hooks.html

Forgive the naive question - are you just looking to mirror the repository to your puppet environment?

https://marketplace.atlassian.com/plugins/com.englishtown.stash-hook-mirror

Cheers,

Charles

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events