Let's make a beautiful CI/CD Pipeline for your Node JS Application 😍
Task-01
Fork the repository:
- Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.
Open Jenkins.
Click on create a job.
3. Enter name and click on freestyle project and finally click on ok.
4. Provide github url.
5. Click on Build Steps and select Execute Shell.
6. Click on Save button and the job will appear on dashboard screen.
7. Click on job->configure and select “GitHub hook trigger for GITScm pollling”.
8. Add a webhook. To add it , follow the section given below.
9. Make any change in github repo and edit any header file. Job will run automatically and changes will be made.
- Read About GitHub WebHooks and make sure you have CICD setup.
Github provides a handy way to call webhooks’ URLs when certain events are triggered. The list of these events is long and includes: on pushing to a repository, on a pull request opening, closing, and reopening, on creation of a release, and many more.
Adding Jenkins Webhook in Github
Open Github repository.
Go to “settings” and then to “hooks”.
Click the “Add webhook” button. Enter “<Jenkins url>//github-webhook/” Payload URL. Click on Add webhook.
Task-02
- In the Execute shell, run the application using Docker compose.
Give docker commands in the execute shell(Project should be integrated with github repo and jenkins). Click on save.
Click on build now. Job will run successfully.
Open the particular IP on which it is hosted. It will be up and running.
Thank you for reading this blog. Hope it helps.
— Safia Khatoon