Skip to content

GitLab Next

    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Menu
    Projects Groups Snippets
  • Get a free trial
  • Sign up
  • Login
  • Sign in / Register
  • gitlab-shell gitlab-shell
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 53
    • Issues 53
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 is launching on May 22! This version brings many exciting improvements, but also removes deprecated features and introduces breaking changes that may impact your workflow. To see what is being deprecated and removed, please visit Breaking changes in 15.0 and Deprecations.

  • GitLab.org
  • gitlab-shellgitlab-shell
  • Merge requests
  • !93
Closed
Created Sep 23, 2016 by Elan Ruusamäe@glensc🇪🇪
  • Review changes

  • Download
  • Email patches
  • Plain diff

Add support for global custom hooks and chained hook directories

  • Overview 84
  • Commits 21
  • Pipelines 27
  • Changes 10

This is continuation of PR#245 from GitHub and !89 (closed) addressing #32 (closed)

With changes of mine:

  1. process per project hooks <repository>.git/custom_hooks/<hook_name>.d/* as <repository>.git/custom_hooks is local dir for <repository>.git
  2. process global hooks from <repository>.git/hooks/<hook_name>.d/* because <repository>.git/hooks is symlink to gitlab-shell/hooks

the hooks matched by shell glob must be:

  1. executable (+x bit set)
  2. not matching editor backup files (*~)

the overview of the whole process:

  • <repository>.git/hooks/ - symlink to gitlab-shell/hooks global dir
  • <repository>.git/hooks/<hook_name> - executed by git itself, this is gitlab-shell/hooks/<hook_name>
  • <repository>.git/custom_hooks/<hook_name> - per project hook (this is already existing behavior)
  • <repository>.git/custom_hooks/<hook_name>.d/* - per project hooks
  • <repository>.git/hooks/<hook_name>.d/* - global hooks: all executable files (minus editor backup files)

the files matched by glob are also sorted so if order of hooks is important, one can name their hooks as:

  1. 01-hook1.sh
  2. 02-hook2.pl
  3. 03-hook3.py

Docs MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6721

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: pr-245