When a PR is submitted on Github our Jenkins Pipeline automatically creates an s3 bucket to host a static website based on that branch.
How can we run a script to remove that bucket when the PR gets merged?
When a PR is submitted on Github our Jenkins Pipeline automatically creates an s3 bucket to host a static website based on that branch.
How can we run a script to remove that bucket when the PR gets merged?
Sadly, there is currently (May of 2017) no way to do "post merge hooks" for PRs with Jenkinsfiles. https://issues.jenkins-ci.org/browse/JENKINS-36109 suggests that it could be done with a plugin, but no such things exists at this moment in time.
You can add integration between Jenkins and Github webhooks. There's PullRequestEvent which you can use to e.g. trigger specific job in Jenkins. More information how to use that event when PR is merged is in this answer