I am working with Jenkins CI and am trying to properly configure my jobs to use git.
I have the git plugin installed and configured for one of my jobs. When I build the job, I expect it to pull the latest changes for the branch I specify and then continue with the rest of the build process (e.g., unit tests, etc.).
When I look at the console output, I see
> git fetch --tags --progress ssh://gerrit@git-dev/Util +refs/heads/*:refs/remotes/origin/* > git rev-parse origin/some_branch^{commit} Checking out Revision <latest_SHA1> (origin/some_branch) > git config core.sparsecheckout > git checkout -f <latest_SHA1> > git rev-list <latest_SHA1>
I see that the plugin fetches and checks out the proper commit hash, but when the tests run it seems as though the repo wasn't updated at all. If I go into the repository in Jenkins, I see there that the latest changes were never pulled.
Shouldn't it pull before it tries to build?
I have git 1.8.5 installed on my Jenkins machine, which is a recommended version. https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
After checking other similar sounding questions on SO, their answers weren't helpful for my problem.
The Jenkins git plug-in The key to Jenkins Git integration is the Git plug-in. One can easily install the Jenkins Git plug-in through the Jenkins administrative console, and once properly configured, it gives all Jenkins build jobs the option to pull content from a Git-compatible source code repository.
1 Answer. There is an option - "Checkout to specific local branch" that can be found in the section - "Additional Behaviors" for setting the "Branch name" as master. Mind you, git commit -am "blah" is still necessary. Now you could use the 'Git Publisher' under the 'Post-build Actions' for pushing changes.
The simplest way to know what has changed on your Jenkins builds! Last Changes is a Jenkin plugin that shows rich VCS diffs between builds.
git fetch is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn't do any file transferring. It's more like just checking to see if there are any changes available). git pull on the other hand does that AND brings (copy) those changes from the remote repository.
Relates me to scenario where workspace wasn't getting cleaned-up, used:
Source Code Management--> Additional Behaviours --> Clean after checkout
Other option is to use Workspace Cleanup Plugin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With