What I already know: Using Jenkins Rest API (using Curl command line way, Groovy, Python etc) way, Im able to successfully initiate a Jenkins build from my local machine or any other host locally. There are lots of posts/blogs online which give good info about the same. Anonymous user has overall READ access in Jenkins security, and Im using API key user ID and token key to run these successfully.
My issue Case:
- In my case, Jenkins master/instance is running in AWS ec2 instance.
- My company's webapp is designed to create alerts (which are raised by the webapp automatically so a user can see them and find the cause of that alert). For these alerts, I'm getting email notifications and Slack messages as well.
- In the webapp, a user can create various alerts, for example "memory or free disk less than 900M" etc, by creating a query/condition for that alert to trigger. This alert part works.
- This webapp also allows a user to create web hookup. The web hookup can be configured to various trigger methods like notify Slack with some meaningful info in a user defined Slack #channel or create a Pagerduty alert or email notification or call a REST API call end point.
- An alert (bullet 3) can be tied / configured to a given web hookup (bullet 4).
My understanding is, that the webapp is running in a different Amazon VPC than the VPC where Jenkins instance is running.
What I'm trying to do is: Create a simple alert in the webapp, then create a web hookup where I will call a Jenkins job RESTful way and pass some parameters to initiate a build / run (which will do some necessary action).
As VPCs are different --or-- due to some other reason (may be the webapp doesn't support RFC1918 supported Webhooks), I think due to RFC 1918 mechanism, Im not able to initiate a Jenkins build from my web app's webhook which is triggering the Jenkins Rest API endpointand getting the following error message.
Im getting the following error message through the web hookup logs.
Cannot save notification receiver, please try again. (400) Bad Request URL validation failed. URI host does not resolve to a public ip. :
Is there any way I can resolve this. Do I need to spin up / create a Amazon API Gateway to front Jenkins (to get rid of this issue) i.e. webhookup will talk to Amazon API gayeway and that will direct the request to Jenkins instance via Restful call? I don't want to make it complicated so looking for an easy implementation.