Search code examples
gitgithubjenkinsgitignoregit-fetch

Can I set in Jenkins to not fetch every file from gitHUB?


I have a project on gitHUB where I have two '.txt' file at .project level. I would use them for comparison a previus run to a new run to find out the difference.

enter image description here

I use Jenkins to build the project, but every time when a new Run starts, the git fetch overwrite thoso two '.txt' so it doesn't make sense anymore.

Can I set in Jenkins somehow to not overwrite all the files -or skip those two- when git fetch starting in the beggining of the run?


Solution

  • (more like a comment than the actual steps)

    The question is if you want those files to be versioned or not. I presume you need those files only in Jenkins and not in .git.

    One solution that pops my mind is to make sure to check for "clean workspace" (not sure the exact name as it changed from version to version) end ensure is not checked, together with adding those files to .gitignore.

    You can also archive the files so you keep those to files in Jenkins for each build so you can check them in time.

    If you chose to archive, your build can also use Jenkins API to download the files so you can have the file from any number of builds in your history.

    I'm sure there are multiple solutions