I am trying to trigger jenkins via TFS service hook, I want to use jenkin to extract out check in information to create a log using powershell script. I have it set up to trigger the jenkins on check in. but I can not figure out a way to parse message info sent from TFS service hook. Looking at https://github.com/jenkinsci/tfs-plugin/blob/master/README.md I can see there are few environment variables created on trigger but I want to extract some of the check in information as in username who checked in and tfs id it was checked in against etc. TFS_USERNAME only record the username of the account that is configured to access tfs in Jekins
You can use TFS REST API to get a changset on Jekins side. The API is as below:
GET http://({server:port})/DefaultCollection/_apis/tfvc/changesets/{id}?api-version=1.0
There isn't any way to extract the hooks that Jenkins received in the build trigger. However, if the Jenkins job download the latest source code to local after the job is triggered, the information you want like the user who check in the changes is already in local. You can simple run tf changeset /latest /noprompt to get this information. And you can also install TFS Power Tools and then create a powershell script to get these information via TFS Powershell Command. For example:
add-pssnapin Microsoft.TeamFoundation.PowerShell
$cs = Get-TfsChangeset -Latest
Write-Host $cs.CommitterDisplayName
Write-Host $cs.Committer
Related
How do i get TFS to trigger a jenkins build when a pull request is created? it would be a smoketest, to make sure everything works before merging with main.
You can use Team Foundation Server plugin for Jenkins. Integrate TFS as a git repository.
check the checkbox next to Enable Push Trigger for all jobs in the Jenkins global configuration
I need to trigger build in jenkins which is in cloud (AZURE) by a command passed in HipChat Integration.
The thing that you are looking for is often referred to as ChatOps. There are couple of tools that allow you to do such thing, which is effectively a program joining the chat room (the "bot") and waiting for commands.
The list of tools includes Hubot and StackStorm, which then call Jenkins API to trigger the job. An adapter for StackStorm exists here.
I have configure my Jenkins profile with BitBucket (Mercurial). Please see the configuration.
On Jenkins profile, changes displays correctly as per bitbucket check-in history.
Jenkins build confirms the success on new builds.
But, on Jenkins server work-space folder I don't see all changes that are supposed to be part of those check-ins
Wondering why is it sometimes missing to pull some changes part of check-in history.
You actually need to configure Bitbucket hook service (Project Settings).
This way, Bitbucket will notify your Jenkins server each repository changes on the targeted branch.
I have installed Jenkins in Unix box and I am trying to trigger a build i.e. initiating BuildDefinition present in TFS project. I am new to this so I am not sure how to trigger BuildDefinition from jenkins.
Note: I am able to checkout the source file present in TFS from jenkins. Also i installed TEE-CLC-12.0 in Jenkins Unix box.
Please help!!!
How can I report from my build scripts who the current tfs user is?
I'm setting up automated builds with TFS 2013 and VSO and I'm having workspace errors.
I'm unable to checkout files through the build script.
I'd like to know what the user is running the tf.exe command (I've already had issues with the user running the build being automatically set to a Network Service user, who has not permissions)
In any of the pre-/post-script print the USERNAME variable. In Powershell
Write-Output "Running as '$env:USERNAME"
In a batch file
echo Running as %USERNAME%