Can Jenkins pull TFS gated checkin code for build? - jenkins

I'm trying to make Jenkins pull TFS gated checkin code but failed to do so.
I have managed to add a Jenkins build step in TFS, This build step is a "trigger" to start a build job in Jenkins, This job taking the source code from TFS and compile it, the problem is that this code is without the gated checkin.
For example:
My code base is "A" and compilation is working.
I'm pushing new change (lets call it "B" delta) that should break the build (invalid c# syntax).
This trigger a build in TFS which call Jenkins job, this job taking only "A" code (without "B" delta).
Jenkins succsusfully building the code (base only on "A") which TFS then mark this build as succsusfully and let the bad "B" delta code inside.
Now every change set including a fix to this one will cause the next build to break because jenkins will take the bad "B" code and always fail.
Is there a way to make Jenkins take the code with the current gated checkin?
The reason I want to use Jenkins build instead of TFS is that the build process for .Net Core 2.0 in Jenkins is about X4 faster then TFS, and our source control is managed in TFS.
Using:
TFS - Version 15.117.26714.0

To avoid this issue, you could add a VS Build task before queue Jenkins Job task:

Related

Continuous Integration build over TFS2017

I would like to know what is the equivalent of "Continuous Integration - build each check-in" (XAML definition) in VNext definitions.
1- Is it "Run continuous integration triggers for commited changes" in Gated trigger?
2-Or it is a "Continuous Integration trigger with batch changes checked" in build definition.
I ask this question because I was not able to launch a CI build after successfully Gated Check-in. My CI build does different steps than Gated.
I'm over TFS 2017 (15.117.27414.0).
The equivalent of "Continuous Integration - build each check-in" (XAML definition) in VNext definitions is Continuous Integration trigger:
Enable CI trigger if you want the build to run whenever someone checks
in code.
Select Batch changes check box if you have a lot of team members
uploading changes often and you want to reduce the number of builds
you are running. If you select this option, when a build is running,
the system waits until the build is completed and then queues another
build of all changes that have not yet been built.
Select the version control paths you want to include and exclude. In
most cases, you should make sure that these filters are consistent
with your TFVC mappings on the Repository tab.
You can get more details in the link below:
https://learn.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/triggers?view=vsts

TFS 2015 Gated Build is creating a Build and Triggering Release Job

We are working on TFS 2015 Update 1
The same Job is triggering CI / Gated / Scheduled Build
I want CI/Scheduled build to Publish Artifact
Unable to find a way to disable Build Step Dynamically
I am calling a Powershell Script before 'Publish Build Artifact' Step and trying to find a solution to access the next Step and Set it to 'Skip'
But I have seen even when the Drop folder is empty, the Release (CI/CD) triggers as the Gated Job is creating a Build
Is there a way to avoid Gated Job to create a Build
or to avoid Release Job to trigger in case of Gated Build
In TFS 2015 update 1 I think you're way too far behind. There are solutions for later versions. In your case, you'd need a separate Build Definition for the gated build and if my memory serves me right, you don't have the task group option yet. Task Groups were introduced in TFS 2017, they would at least allow you to share process and variables between separate build definitions.
You're on an unsupported TFS version, in any case, TFS 2015 update 1 was replaced by TFS 2015 update 3.1 any versions between TFS 2015.0 and 2015.3.1 are unsupported and TFS 2015 update 1 contains a number of XSS security vulnerabilities that were fixed in TFS 2015.3.1 as well as in TFS 2017.0.1, 2017.3.1 and 2018.1. This would be a good time to upgrade and make the jump.
In TFS 2018 this would be possible with an artefact tag filter:
Prevent Release Trigger on Gated Check-in build
One option that remains available is to turn off the CI trigger of the release workflow and then from a powershell script, conditionally trigger the release from the build.

Import Jenkins job definition into TFS 2017

Is it possible, or are there tools available to allow you, to import or convert a legacy Jenkins job build definition into a TFS 2017 build definition. I'm not looking to convert the job to a Jenkins job within TFS, but simply use the steps contained in the Jenkins job to create a new build definition.
If the steps contained in jenkins job you are meaning just as the following screen shows which you can specify the details of the job.
Unfortunately, it's not able to directly covert this to a TFS build definition. There is no such kind tool could do this. It's only able to Export/Import TFS vNext Build Definition itself. You have to manually convert jenkins job build definition to TFS build definition.

On Premise Gated Check-in Fails with "The shelveset ... could not be found for check-in"

I am having an issue with the new TFS 2015 Update 2 Gated Builds.
After attempting a check-in the gated build queues just fine, every part of the build is successful until it reaches the last step of "Check in gated changes".
When I look at the log for that step I get:
[Error]The shelveset _Build_5427;Build\ad8fe058-f936-4908-91de-57e7bc6a2f9d could not be found for check-in
When I look at the 'Get Sources' log, I see:
2016-04-01T19:11:12.3062092Z tf get /version:C6213
2016-04-01T19:11:13.2125013Z tf shelve _Build_5427 /replace
2016-04-01T19:11:13.3218610Z Successfully created new shelveset _Build_5427;Domain\BuildServiceUser
I recognize the username as the service user (and have thus redacted it here). It looks like it is trying to find the correct shelveset name, but for the wrong user.
Update 4/20/2016 :
I ended up having to create a brand new project.
The failed reason: your are trying to check in files with your own account. But the build agent try to check in the changes with the service account.
It seems there are something wrong with your build agent. After you update your TFS server to TFS update2, you also need to update your build agent. If still not work , try to download the agent and deploy a new one. Detail steps from MSDN: Deploy a Windows build agent
I experienced this issue using on-premise TFS 2015 Update 2. As a workaround I settled with a regular CI-build instead of the Gated trigger and I scheduled a release buiild nightly.
However, we have recently installed TFS 2015 Update 3 and that solved the issue. We now use the configuration that we wanted: 1 Gated build that checks in the changes and 1 Continuous Integration build for the release.

Have TeamCity pull a specific ChangeSet from TFS?

I have a CI build in TeamCity that runs on check-in. I have a QA build that is run manually. I would like to specify which ChangeSet the QA build should use so it doesn't inadvertantly push changes that are not ready. Is there a way to tell TeamCity to tell TFS that we want to pull xyz changeset?
Yes, use the "Run ..." button to the right of the build configuration you want to run (ie. click on the ... part).
In that dialog you should be able to pick exactly which changeset TeamCity should use. Note that it seems TeamCity only sees changesets which have occured in TFS after TeamCity started monitoring the repository, so if you want to build against an old changeset you might still be out of luck.

Resources