$ podman inspect --format='{{ index .Config.Labels "io.openshift.s2i.scripts-url" }}' wildfly/wildfly-centos7
To modify the default assemble and run script behavior in OKD, you can customize source-to-image (S2I) builder images. You can adapt S2I builders to meet your specific application requirements when the default scripts are not suitable.
To extend builder image behavior while preserving supported script logic and upgrade compatibility in OKD, you can start embedded S2I image scripts by creating wrapper scripts. These wrapper scripts run custom logic and then call the default scripts from the image.
Inspect the value of the io.openshift.s2i.scripts-url label to determine the location of the scripts inside of the builder image:
$ podman inspect --format='{{ index .Config.Labels "io.openshift.s2i.scripts-url" }}' wildfly/wildfly-centos7
image:///usr/libexec/s2i
Create a script that includes an invocation of one of the standard scripts wrapped in other commands:
.s2i/bin/assemble script#!/bin/bash
echo "Before assembling"
/usr/libexec/s2i/assemble
rc=$?
if [ $rc -eq 0 ]; then
echo "After successful assembling"
else
echo "After failed assembling"
fi
exit $rc
This example shows a custom assemble script that prints the message, runs the standard assemble script from the image, and prints another message depending on the exit code of the assemble script.
|
When wrapping the run script, you must use |
.s2i/bin/run script#!/bin/bash
echo "Before running application"
exec /usr/libexec/s2i/run