0
votes

I've configured a Jenkins job which is monitoring a TFS git repository and is supposed to trigger a build when a code is changed (pushed).

Things I've done to configure the solution:

  • I've created a service hook for Jenkins on the TFS repository.

  • I've installed Team Foundation Server Plug-in and VS Team Services Continuous Deployment on Jenkins and configured the jobs like so:

Under "Source code management" I chose Team Foundation Version Control (TFVC) and configured it like so:

Collection URL: https://company.visualstudio.com/defaultcollection
Project path: $/Wilhelm/_git/NWilhelm
Credentials: Automatic (I've also tried with Manual creds and got the same result)

Then, In "Manage Jenkins -> Configure system", under TFS/Team Services, I've configured:

Collection URL: https://company.visualstudio.com    
Credentials: Selected the correct user which has access to the repo
Enable Push Trigger for all jobs: checked

And clicked save.

These are the tests I've done:

I ran the build manually:

Started by user Itai
Building remotely on jenkins-windows-slave (windows-slave) in workspace c:\jenkins\workspace\iis-deploy-new
Querying for remote changeset at '$/Wilhelm/_git/NWilhelm' as of 'D2017-03-19T15:39:58Z'...
Query returned no result!
FATAL: null
java.lang.NullPointerException
    at hudson.plugins.tfs.model.Project.extractChangesetNumber(Project.java:276)
    at hudson.plugins.tfs.model.Project.getRemoteChangesetVersion(Project.java:271)
    at hudson.plugins.tfs.model.Project.getRemoteChangesetVersion(Project.java:287)
    at hudson.plugins.tfs.TeamFoundationServerScm.recordWorkspaceChangesetVersion(TeamFoundationServerScm.java:359)
    at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:308)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1728)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:404)
Finished: FAILURE

That's the error I get when I run the job through Jenkins.

  • I've pushed a change to the repo expecting it to trigger a build on Jenkins but nothing happened.

  • I've checked the TFS webhook log on the job but it's empty.

Any idea what I'm doing wrong?

1
Have you take a look at this tutorial: visualstudio.com/en-us/docs/marketplace/integrate/service-hooks/… and check your config on TFS and are you work with VSTS or on-premise TFS ?What's the detail TFS version if you are using on-premise TFS? - PatrickLu-MSFT

1 Answers

1
votes

"Team Foundation Version Control (TFVC)" option is used to get files from TFVC version control system while you are using Git version control system. Please select "Git" option under "Source code management" and then try again.