From 70bbbb2ca879af28afb8d7b739e4379907fd426a Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Fri, 19 Feb 2016 18:11:25 -0200 Subject: create `githubrepo` hook documentation in README --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index a130961..21a0956 100644 --- a/README.md +++ b/README.md @@ -525,6 +525,39 @@ hooks: timeout: 120 ``` +### githubrepo + +This hook configures the repository `remote` and _push_ the code when the specified event is triggerd. If the `username` and `password` are not provided, the `Rugged::Credentials::SshKeyFromAgent` will be used. + +`githubrepo` hook recognizes following configuration keys: + + * `remote_repo`: the remote repository to be pushed to. + * `username`: username for repository auth. + * `password`: password for repository auth. + +When using groups repositories, the remotes should be passed in the `groups` config for each group. + +``` yaml +vars: {} +groups: + routers: git@git.intranet:oxidized/routers.git + switches: git@git.intranet:oxidized/switches.git + firewalls: git@git.intranet:oxidized/firewalls.git +``` + + +## Hook configuration example + +``` yaml +hooks: + push_to_gitlab: + type: githubrepo + events: [node_success, post_store] + remote_repo: git@git.intranet:oxidized/test.git + username: user + password: pass +``` + # Ruby API The following objects exist in Oxidized. -- cgit v1.2.1 From a486e086fc3b52f26ade94e58a16fa2150fc9cae Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Fri, 19 Feb 2016 18:58:47 -0200 Subject: move the groups remote to the hook config thanks to @ElvinEfendi for the idea! :+1: --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 21a0956..3c1a41e 100644 --- a/README.md +++ b/README.md @@ -535,14 +535,15 @@ This hook configures the repository `remote` and _push_ the code when the specif * `username`: username for repository auth. * `password`: password for repository auth. -When using groups repositories, the remotes should be passed in the `groups` config for each group. +When using groups repositories, each group must have its own `remote` in the `remote_repo` config. ``` yaml -vars: {} -groups: - routers: git@git.intranet:oxidized/routers.git - switches: git@git.intranet:oxidized/switches.git - firewalls: git@git.intranet:oxidized/firewalls.git +hooks: + push_to_remote: + remote_repo: + routers: git@git.intranet:oxidized/routers.git + switches: git@git.intranet:oxidized/switches.git + firewalls: git@git.intranet:oxidized/firewalls.git ``` @@ -550,7 +551,7 @@ groups: ``` yaml hooks: - push_to_gitlab: + push_to_remote: type: githubrepo events: [node_success, post_store] remote_repo: git@git.intranet:oxidized/test.git -- cgit v1.2.1 From 69210c7ddf7d77cc9eb7b78f0bc00ad2f1475955 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Mon, 22 Feb 2016 14:16:29 -0300 Subject: follow the hook remotes config also for groups repositories ref.: https://github.com/ytti/oxidized/pull/326/files#r53557892 --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 3c1a41e..1dcc426 100644 --- a/README.md +++ b/README.md @@ -354,13 +354,40 @@ output: This uses the rugged/libgit2 interface. So you should remember that normal Git hooks will not be executed. + +For a single repositories for all devices: + +``` yaml +output: + default: git + git: + user: Oxidized + email: o@example.com + repo: "/var/lib/oxidized/devices.git" ``` + +And for groups repositories: + +``` yaml output: default: git git: user: Oxidized email: o@example.com + repo: + first: "/var/lib/oxidized/first.git" + second: "/var/lib/oxidized/second.git" +``` + +If you would like to use groups and a single repository, you can force this with the `single_repo` config. + +``` yaml +output: + default: git + git: + single_repo: true repo: "/var/lib/oxidized/devices.git" + ``` ### Output types -- cgit v1.2.1