// Module included in the following assemblies:
//
// * builds/triggering-builds-build-hooks.adoc

:_mod-docs-content-type: PROCEDURE
[id="builds-configuring-post-commit-build-hooks_{context}"]
= Configuring post commit build hooks

There are different ways to configure the post-build hook. All forms in the following examples are equivalent and run `bundle exec rake test --verbose`.

.Procedure

* Use one of the following options to configure post-build hooks:
+
|===
|Option |Description

|Shell script
a|
[source,yaml]
----
postCommit:
  script: "bundle exec rake test --verbose"
----

The `script` value is a shell script to be run with `/bin/sh -ic`. Use this option when a shell script is appropriate to execute the build hook. For example, for running unit tests as above. To control the image entry point or if the image does not have `/bin/sh`, use `command`, or `args`, or both.

[NOTE]
====
The additional `-i` flag was introduced to improve the experience working with CentOS and RHEL images, and may be removed in a future release.
====

|Command as the image entry point
a|
[source,yaml]
----
postCommit:
  command: ["/bin/bash", "-c", "bundle exec rake test --verbose"]
----

In this form, `command` is the command to run, which overrides the image
entry point in the exec form, as documented in the link:https://docs.docker.com/engine/reference/builder/#entrypoint[Dockerfile reference]. This is needed if the image does not have `/bin/sh`, or if you do not want to use a shell. In all other cases, using `script` might be more convenient.

|Command with arguments
a|
[source,yaml]
----
postCommit:
  command: ["bundle", "exec", "rake", "test"]
  args: ["--verbose"]
----

This form is equivalent to appending the arguments to `command`.
|===

[NOTE]
====
Providing both `script` and `command` simultaneously creates an invalid build hook.
====
