Home > Net >  Is there a way or a bash script through JENKINS to give me the name of the folder in which the files
Is there a way or a bash script through JENKINS to give me the name of the folder in which the files

Time:04-05

i am a beginner in the DEVOPS field and I have a "trial" repo in github which i'm tracking through Jenkins here is the folder

i would like to ask if there is any way(jenkins plugin or bash script) that if i modify a file in ok1,ok2, or ok3 folders and do a push, i get which folder was modified.

the result of the console's output shall be something like this :

"folder ok1 was changed" or "folder ok1 , ok2 were changed" ...etc

thank you

CodePudding user response:

Yes, you can. You just need to set up the Git repo to trigger a build job on your Jenkins machine every time you push using the Github Jenkins webhook. You can read on how to do this here

Once the job successfully builds with every push, you can just do a git-diff to get the files that were changed. After that, its just a matter of extracting the folder name using regex or string manipulation.

  • Related