Jenkins Trigger With GitHub Actions
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:
- Building and Testing: Automatically build and test code
- Deployment: Automate code deployment
- Continuous Integration (CI): Automate continuous integration processes
- Automated Releases: Automate release publishing
- Environment Management: Manage and deploy environments
- Workflow Automation: Automate workflows
- 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.
I used a python project
After creating the project, we can create a file(hello world.py) that will Print Hello World.
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.
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.
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.
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/