Jenkins Trigger With GitHub Actions

Umut Yasin Colak
Insider Engineering
3 min readApr 24, 2023
Jenkins & GitHub Logos

GitHub Actions is a platform provided by GitHub that allows developers to automate various processes such as building, testing, deploying, and more for their code repositories hosted on GitHub. With GitHub Actions, developers can create custom workflows that can be triggered by specific events such as pushes to the repository or pull requests. This allows for efficient and streamlined software development practices, such as Continuous Integration and Continuous Deployment, without the need for additional tools or services.

For Example:

  1. Building and Testing: Automatically build and test code
  2. Deployment: Automate code deployment
  3. Continuous Integration (CI): Automate continuous integration processes
  4. Automated Releases: Automate release publishing
  5. Environment Management: Manage and deploy environments
  6. Workflow Automation: Automate workflows
  7. Custom Actions: Perform custom actions

We can trigger any job we created on Jenkins with GitHub Actions.

Jenkins Part

If Jenkins is not installed locally or in any environment, you can install it with the link below.

For MacOs: How To Install ?

After installing Jenkins, let’s create a project on GitHub.

How To Create GitHub Project?

I used a python project

After creating the project, we can create a file(hello world.py) that will Print Hello World.

How To Create Python Project?

Then let’s create the job that will run this file.

If you do not have an example item/job, you can create it using the example doc.

How To Create Jenkins Job?

Then click the field below in Jenkins and create a new token.

Copy and save the token you created. The token created in the standard token logic cannot be displayed again.

Create YML File

We will create a .yml file in your project with the token you have received.

Note: I created secrets key value in my project, but you can use just a string.

How To Create GitHub Secret Key ?

Now we come to the most enjoyable place 😺

We just need to make any commits to the master of our project.

(If you are going to operate in your local, you can use ngrok for your port) Why do we use Ngrok?

The development of webhook tests is the initial point that we investigated initially. The reason is that every QA Engineer needs their own independency. I’m pretty sure no one wants to get a webhook triggered by someone else’s local. A proxy to the local, as well as the host that actual QA tests run, became the most important requirement for the overall infrastructure. Also, as the teams can have inexperienced engineers, the product would also be easy-to-configurable as a key feature.

Ngrok gives us the ability to introspect incoming http calls in real time.

How To Create Ngrok ?

Conclusion

In conclusion, GitHub Actions can be used in many fields. Today, we tried to trigger a job on Jenkins automatically using Actions. This job could have been your QA automation, security check, and many other things. Now we have jobs that will run automatically after each deployment and jobs that will run automatically on staging after each commit, and you can do it too.

Finally, I’m pleased to be a part of the Insider and very excited about the work we will do in the future. If you would like to learn how we manage QA Process at Insider, you can read this article. https://medium.com/insiderengineering/quality-at-insider-an-in-depth-look-at-our-qa-process-1ea03f7d8655

For any questions, you can reach me at the email address provided below: https://www.linkedin.com/in/umut-yasin-çolak/

--

--