cancel
Showing results for 
Search instead for 
Did you mean: 
  • 310 Views

OpenShift build post-commit hook for a perl script

Hi

I have a perl script that launches a scan of the built artifacts for security vulnerabilities that is included in the git repo which is used as the source for the s2i image build. How do I set it up as a post-commit build hook using OC cli?

The script name is security_scan.pl 

Any assistance will be helpful.

Thanks

Labels (1)
2 Replies
Wasim_Raja
Moderator
Moderator
  • 266 Views

@WhiskeyRaider I think using "oc set build-hook" will be helpful.

In your case something like below:

oc set build-hook bc/mybc --post-commit --command -- /bin/bash -c 'perl /path/to/your/script.pl'

0 Kudos
Chetan_Tiwary_
Moderator
Moderator
  • 256 Views

@WhiskeyRaider Thanks for reaching out!

You can refer this for more details :

Chetan_Tiwary__0-1703016571766.png

Make sure the script is executable ( chmod u+x ) and then place it under the repo directory where it will be cloned fr the S2I build.

For perl script you can use : --command="perl /pathtoscript.pl [arguments]"

https://access.redhat.com/documentation/en-us/openshift_container_platform/4.4/html/builds/triggerin...

https://github.com/openshift/openshift-docs/blob/main/modules/builds-using-cli-post-commit-build-hoo... 

0 Kudos
Join the discussion
You must log in to join this conversation.