Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
yakatz committed Feb 15, 2024
1 parent 48662b6 commit 6059809
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 49 deletions.
38 changes: 16 additions & 22 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

### Defined types

* [`gitlab::custom_hook`](#gitlab--custom_hook): Manage custom hook files within a GitLab project.
* [`gitlab::global_hook`](#gitlab--global_hook): Manage global chain loaded hook files for all GitLab projects.
* [`gitlab::custom_hook`](#gitlab--custom_hook): Manage custom hook files within a GitLab project. Custom hooks can be created as a pre-receive, post-receive, or update hook. Only one of each is currently supported by this module.
* [`gitlab::global_hook`](#gitlab--global_hook): Manage global chain loaded hook files for all GitLab projects. Hooks can be created as a pre-receive, post-receive, or update hook. It's possible to create multipe hooks per type as long as their names are unique. Support for chained (global) hooks is introduced in GitLab Shell 4.1.0 and GitLab 8.15.
* [`gitlab::system_hook`](#gitlab--system_hook): A file hook will run on each event so it's up to you to filter events or projects

### Tasks
Expand Down Expand Up @@ -1185,29 +1185,29 @@ Default value: `$gitlab::skip_post_deployment_migrations`

### <a name="gitlab--custom_hook"></a>`gitlab::custom_hook`

Custom hooks can be created as a pre-receive, post-receive, or update hook.
It is possible to create different custom hook types for the same project - one each for pre-receive, post-receive and update.
Manage custom hook files within a GitLab project. Custom hooks can be created as a pre-receive, post-receive, or update hook. Only one of each is currently supported by this module.

#### Examples

##### Custom hook usage

```puppet
gitlab::custom_hook { 'my_custom_hook':
namespace => 'my_group',
project => 'my_project',
type => 'post-receive',
source => 'puppet:///modules/my_module/post-receive',
namespace => 'my_group',
project => 'my_project',
type => 'post-receive',
source => 'puppet:///modules/my_module/post-receive',
}
```

##### Calculate hashed storage path

```puppet
gitlab::custom_hook { 'my_custom_hook':
project => 93,
type => 'post-receive',
source => 'puppet:///modules/my_module/post-receive',
project => 93,
hashed_storage => true,
type => 'post-receive',
source => 'puppet:///modules/my_module/post-receive',
}
# Hook path will be `@hashed/6e/40/6e4001871c0cf27c7634ef1dc478408f642410fd3a444e2a88e301f5c4a35a4d`
```
Expand Down Expand Up @@ -1248,17 +1248,15 @@ The custom hook type. Should be one of pre-receive, post-receive, or update.

Data type: `Optional[String]`

Specify the custom hook contents either as a string or using the template function. If this paramter is specified source
parameter must not be present.
Specify the custom hook contents either as a string or using the template function. If this paramter is specified source parameter must not be present.

Default value: `undef`

##### <a name="-gitlab--custom_hook--source"></a>`source`

Data type: `Optional[String]`

Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not
be present.
Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not be present.

Default value: `undef`

Expand All @@ -1280,9 +1278,7 @@ Default value: `false`

### <a name="gitlab--global_hook"></a>`gitlab::global_hook`

Hooks can be created as a pre-receive, post-receive, or update hook.
It's possible to create multipe hooks per type as long as their names are unique.
Support for chained (global) hooks is introduced in GitLab Shell 4.1.0 and GitLab 8.15.
Manage global chain loaded hook files for all GitLab projects. Hooks can be created as a pre-receive, post-receive, or update hook. It's possible to create multipe hooks per type as long as their names are unique. Support for chained (global) hooks is introduced in GitLab Shell 4.1.0 and GitLab 8.15.

#### Examples

Expand Down Expand Up @@ -1322,17 +1318,15 @@ Default value: `$gitlab::custom_hooks_dir`

Data type: `Optional[String[1]]`

Specify the custom hook contents either as a string or using the template function. If this paramter is specified source
parameter must not be present.
Specify the custom hook contents either as a string or using the template function. If this paramter is specified source parameter must not be present.

Default value: `undef`

##### <a name="-gitlab--global_hook--source"></a>`source`

Data type: `Optional[Pattern[/^puppet:/]]`

Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not
be present.
Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not be present.

Default value: `undef`

Expand Down
27 changes: 11 additions & 16 deletions manifests/custom_hook.pp
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
# @summary
# Manage custom hook files within a GitLab project.
#
# Custom hooks can be created as a pre-receive, post-receive, or update hook.
# It is possible to create different custom hook types for the same project - one each for pre-receive, post-receive and update.
# @summary Manage custom hook files within a GitLab project. Custom hooks can be created as a pre-receive, post-receive, or update hook. Only one of each is currently supported by this module.
#
# @example Custom hook usage
# gitlab::custom_hook { 'my_custom_hook':
# namespace => 'my_group',
# project => 'my_project',
# type => 'post-receive',
# source => 'puppet:///modules/my_module/post-receive',
# namespace => 'my_group',
# project => 'my_project',
# type => 'post-receive',
# source => 'puppet:///modules/my_module/post-receive',
# }
#
# @example Calculate hashed storage path
# gitlab::custom_hook { 'my_custom_hook':
# project => 93,
# type => 'post-receive',
# source => 'puppet:///modules/my_module/post-receive',
# project => 93,
# hashed_storage => true,
# type => 'post-receive',
# source => 'puppet:///modules/my_module/post-receive',
# }
# # Hook path will be `@hashed/6e/40/6e4001871c0cf27c7634ef1dc478408f642410fd3a444e2a88e301f5c4a35a4d`
#
# @param project The GitLab project name, or the hashed directory name or project ID number
# @param namespace The GitLab group namespace for the project.
# @param type The custom hook type. Should be one of pre-receive, post-receive, or update.
# @param content Specify the custom hook contents either as a string or using the template function. If this paramter is specified source
# parameter must not be present.
# @param source Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not
# be present.
# @param content Specify the custom hook contents either as a string or using the template function. If this paramter is specified source parameter must not be present.
# @param source Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not be present.
# @param repos_path The GitLab shell repos path. This defaults to '/var/opt/gitlab/git-data/repositories' if not present.
# @param hashed_storage Whether to treat the project name as a hashed storage directory name or ID number
#
Expand Down
14 changes: 3 additions & 11 deletions manifests/global_hook.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# @summary
# Manage global chain loaded hook files for all GitLab projects.
#
# Hooks can be created as a pre-receive, post-receive, or update hook.
# It's possible to create multipe hooks per type as long as their names are unique.
# Support for chained (global) hooks is introduced in GitLab Shell 4.1.0 and GitLab 8.15.
# @summary Manage global chain loaded hook files for all GitLab projects. Hooks can be created as a pre-receive, post-receive, or update hook. It's possible to create multipe hooks per type as long as their names are unique. Support for chained (global) hooks is introduced in GitLab Shell 4.1.0 and GitLab 8.15.
#
# @example Global hook usage
# gitlab::custom_hook { 'my_custom_hook':
Expand All @@ -13,11 +8,8 @@
#
# @param type The custom hook type. Should be one of pre-receive, post-receive, or update.
# @param custom_hooks_dir The GitLab shell repos path. This defaults to '/opt/gitlab/embedded/service/gitlab-shell/hooks' if not present.
# @param content Specify the custom hook contents either as a string or using the template function. If this paramter is specified source
# parameter must not be present.
# @param source Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not
# be present.
#
# @param content Specify the custom hook contents either as a string or using the template function. If this paramter is specified source parameter must not be present.
# @param source Specify a file source path to populate the custom hook contents. If this paramter is specified content parameter must not be present.
define gitlab::global_hook (
Enum['post-receive', 'pre-receive', 'update'] $type,
Stdlib::Absolutepath $custom_hooks_dir = $gitlab::custom_hooks_dir,
Expand Down

0 comments on commit 6059809

Please sign in to comment.