mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
// 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
|
|
|
|
* Shell script:
|
|
+
|
|
[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 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` and/or `args`.
|
|
+
|
|
[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:
|
|
+
|
|
[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:
|
|
+
|
|
[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.
|
|
====
|