Monday, January 2, 2023

How to make Code changes directly in Github and remotely In your Project (local Machine)with Vscode

 

How to make Code changes directly in Github and remotely In your Project (local Machine)with Vscode

 steps to make a code change in github to trigger builds in Jenkins and view results in Tomcat.


How to make sure code change to trigger automated build? you can do in one of two ways:

1. Make code changes directly in bitbucket which are given below:
2. change in your computer after cloning. refer to steps given in lab exercise #2

How to make code changes directly in github?

1. Go to https://www.github.com
2. Click on repo you had created earlier and configured in jenkins freestyle job or pipeline.
3. Click on MyWebApp
4. Click on src/main/webapp
5. Click on index.jsp
6. Click on Edit and make the change highlighted in yellow:

<html>
<body>
<h2>Hello Guys !!! Im a DevOps Engineer!</h2>
</body>
</html>
7. Commit (no need to create a pull request for this change)
8. Now this should have triggered automated build/deployment in Jenkins.
9. Go to browser, enter public dns name where tomcat is deployed to see output in the browser
10. Now you should see the output in the browser

Hello Guys !!! Im a DevOps Engineer!

Next Go to Your Project on you local machine

Right click and open Git Bash Here
Type code . to load the project into Vscode

Click on the Pull/push icon to get the latest changes from your repo
Navigate to MyWebApp--src--main--webapp and click on index.jsp. This is the main code of your web application
Edit the code. Add Devops is the Next best thing in IT!
Click file--- save

The Source control icon will indicate you have pending changes

Enter a commit message in the Message prompt the click the check symbol to save the commit and click Yes to Stage



You will notice there is 1 pending change to your local repo. Click the Push/Pull icon to update this changes to your remote repo
This will automatically push changes to your repo and trigger a new build in Jenkins.
Go to browser, enter public dns name where tomcat is deployed to see output in the browser
Now you should see the output in the browser

Devops is the Next best thing in IT!

No comments:

Post a Comment

Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, deploy WARs using Jenkins Pipeline - Build pipelines integrate with github, Sonarqube, Slack, JaCoCo, Nexus, Tomcat

  Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, depl...