Skip to content
GitLab
    • 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
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 52,303
    • Issues 52,303
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,542
    • Merge requests 1,542
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #18049
Closed
Open
Issue created May 08, 2017 by David Turner (TS)@dturner_ts

Push event web hooks should support Git push-options

Git supports push options, which are passed to the pre-receive and post-receive hooks in environment variables GIT_PUSH_OPTION_0, GIT_PUSH_OPTION_1, and so on. Gitlab should pass them through to the web hook in an array.

Proposal

When pushing a commit, a user can provide push options: git push -o 'foo' -o 'bar'

These should be available in the push event web hook:

{
  "object_kind": "push",
  ...
  "push_options": ["foo", "bar"]
}

Documentation blurb

Gitlab supports push options in webhooks. These can be used to customize the treatment of pushes. For example, if there's a webhook that automatically creates or updates a MR on push, an option could indicate which users are listed as code reviewers, or automatically associate an issue id. If a webhook sends a message to an IRC channel, an option might specify which users to ping, or might indicate that no message should be sent.

To set options on a push, just add -o to your git push command. To use options in a webhook, look at the "push_options" array.

Links / references

  • https://git-scm.com/docs/git-push#git-push---push-option
  • https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#push-events
Edited Jun 13, 2018 by James Ramsay (ex-GitLab)
Assignee
Assign to
Time tracking