Continuous Integration

cancel
Showing results for 
Search instead for 
Did you mean: 

Jenkins: Integrate with GitHub to build after each commit using webhook?

Solved!
Go to solution

Hi All.

 

I working on setting up Jenkins with Github. I'm using NI CLI.

The basic setup is working and I can clone a private repo on Github from Jenkins and do a LabVIEW mass compile e.g.

 

Now I want to setup this test to automatically start after each commit. This setup is also described in this video:

https://www.youtube.com/watch?v=Z3S2gMBUkBo&t=304s

 

It's using a webhook - however that requires my Jenkins server to be "visible" outside our office network by using port forwarding.

Basically I just want to ask if this the way to do it - do I need to expose my Jenkins server by opening the port?

 

Thanks!

Best Regards

Alex E. Munkhaus
Certified LabVIEW Developer (CLD)
System Engineer
0 Kudos
Message 1 of 8
(5,147 Views)
Solution
Accepted by topic author A.E.M

Hi A.E.M

 

Yeah, you need to have Jenkins on a public IP.

 

I had this exact issue last week.

I solved it by using ngrok. They offer a free web hosting service (via a TCP tunnel). I haven't had any issues with it and it worked straight away.

 

There are four really straightforward steps to get started: https://dashboard.ngrok.com/get-started

 

NB: This can also be solved with port forwarding, however, due to our IT infrastructure, that option was unavailable to me. 

0 Kudos
Message 2 of 8
(5,142 Views)

If you're in some institution with an IT department, they might set up a reverse proxy for you.

 

Your alternative (considerably less desirable option) is to not use webhooks and instead poll the repository(ies?) This saves you some networking trouble potentially but loads your Jenkins server and delays your builds (with faster polling increasing one and decreasing the other).


GCentral
0 Kudos
Message 3 of 8
(5,135 Views)

Thanks for your suggestions!

I really want to avoid polling the repo's, as that doesn't really seems like a viable solution.

 

The best solution is to get IT involved etc, but currently I'm experienting to collect information to understand what is needed and required. I just wanted to make sure I understood the usage of webhooks correctly, so thanks for verifying.

 

I just tested with ngrok. That just worked out of the box, with easy configuration. Thanks for pointing me to that solution. That seems to be working just fine. Do you see any performance issues? Are you still using the free plan or do you see any advances in upgrading to a paid plan?

Best Regards

Alex E. Munkhaus
Certified LabVIEW Developer (CLD)
System Engineer
0 Kudos
Message 4 of 8
(5,097 Views)

I really want to avoid polling the repo's, as that doesn't really seems like a viable solution.

Agreed!

 

I just tested with ngrok. That just worked out of the box, with easy configuration. Thanks for pointing me to that solution. That seems to be working just fine. Do you see any performance issues? Are you still using the free plan or do you see any advances in upgrading to a paid plan?


I'm still using the free version - the only downside of the free version is that you'll have to create a new forwarding URL if your PC restarts, with the paid version you can reserve URLs I think. For me, this is okay because I'm only working on a few big projects, so it only takes a few minutes to create the URL and update the webhooks.

 

I haven't noticed any performance issues at all.

 

I was really pleasantly surprised with now simple ngrok is!

0 Kudos
Message 5 of 8
(5,094 Views)

Thanks for your input!

 

Best Regards

Alex E. Munkhaus
Certified LabVIEW Developer (CLD)
System Engineer
0 Kudos
Message 6 of 8
(5,076 Views)

There is also smee which appeared on the Jenkins blog: https://jenkins.io/blog/2019/01/07/webhook-firewalls/

 

However I'm currently having issues with it - it seems to be specific to bitbucket though so might be good for Github?

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 7 of 8
(5,017 Views)

I tried using smee for some initial trials and had no problems getting it working - however, as far as I could understand, your link/URL is not in any way protected. Not only can anyone send you anything (this is in principle true with any public facing URL I suppose) but if I know your URL I can read everything you receive via the Web interface or perhaps even by attaching my own client...


GCentral
0 Kudos
Message 8 of 8
(5,012 Views)