From TFS + TeamBuild to Jenkins + Perforce - tfs

Our current CI build process is all around TFS and its TeamBuild. We're evaluating Jenkins + Perforce as our future solution.
My question is how do I translate everything I have configured in the TFS build definitions to Jenkins in order to make it build my projects? My understanding is Jenkins uses MSBuild's config file to build. If that's true, does that mean I'll have to somehow have all the information currently in TFS build definition in MSBuild's config file?

Jenkins does not use any msbuild files per default. It might bpossible be possible using plugins though. Or simply calling msbuild which will have the same effect. If you know how to build from a commandline, its trivial doing it from Jenkins. Simply create a freestyle project and add a windows 32 shell command.

Related

TFS + Jenkins job

I have a project on local TFS server. This project has a PowerShell script which creates the build.
I need to create a correct JOB in Jenkins, which will start when any change happens in the project (TFS). This job will automatically start PS script on project directory.
Please, help me with this task.
Based on your description, you just need to integrate Jenkins with TFS and set CI/CD to trigger the build/release in Jenkins.
To run PowerShell in Jenkins you can refer this article: Running Powershell scripts using Jenkins
For the Jenkins integration and CI/CD, you can reference below articles:
TFS and Jenkins Integration
Visual Studio Team Services Integration with Jenkins
Tutorial: Integrate your Jenkins CI jobs with VSTS CD to Azure

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.

Migration from Jenkins to Teamcity

Suggest me how to migrate all build logs, jobs, config files jenkins to teamcity .
From teamcity to teamcity it is possible, from same CI servers it is possible.. But what are the steps to migrate jenkins to teamcity?
There is no direct upgrade path.
You must manually recreate project, build configurations and steps based on the technology you use.
It's not possible to convert build history, artifacts or other data from Jenkins.

Can I store Jenkins configuration in the project repo (like Travis CI)?

How do you maintain the Jenkins job configuration in SCM along side the source code?
As source code evolves, so does the job configuration. It would be ideal to be able to keep the job configuration in SCM, for the following benefits:
easy to see who a history of the changes, including the author and the description
able to rebuild old branch/tag by checking out the revision and build just work
not having to scroll through the UI to find the appropriate section and make change
I see there is a Jenkins Job Builder plugin. I prefer a solution along the lines of Travis CI, where the job configuration is maintained in a YAML file (.travis.yml). Any good suggestions?
Note: Most of our projects are using Java & Maven.
Update 2016: Jenkins now provides a Jenkinsfile which provides exactly this. This is supported by the core Jenkins developers and actively developed.
Benefits:
Creating a Jenkinsfile, which is checked into source control, provides a number of immediate benefits:
Code review/iteration on the Pipeline
Audit trail for the Pipeline
Single source of truth for the Pipeline, which can be viewed and edited by multiple members of the project.
I've written a plugin that does this!
Other than my plugin, you have some (limited) options with existing Jenkins plugins:
Use a single test script
If you configure your Jenkins to simply run:
$ bash run_tests.sh
You can then check in a run_tests.sh file into your SCM repo and you're now tracking changes for how you run tests. However, this won't track configuration of any plugins.
Similarly, if you're using Maven, the Maven Project Plugin simply runs a specified goal for your repo.
The Literate Plugin does allow Jenkins to run the commands in your README.md, but it hasn't yet been released.
Track changes to Jenkins configuration
You can use the SCM Sync configuration plugin to write configuration changes to SCM, so you at least have a persistent record. This is global, across all projects on your Jenkins instance.
There's also the job config history plugin, which stores config history on the filesystem.
Write Jenkins configuration from SCM
The Jenkins job builder project you mentioned lets you check config changes into SCM and have them applied to your Jenkins instance. Again, this is across all projects on your Jenkins instance.
Write Jenkins configuration from another job
You can use the Job DSL Plugin with a repo of groovy scripts. Jenkins then polls that repo, executes the groovy scripts, which create job configurations.
Discussions
Issue 996 (now closed) discusses this, and it has also been discussed on the mailing list: 'Keeping track of Hudson's configuration changes', and 'save hudson config in svn'.
you can do this all with the workflow plugin and a lot more. Workflow is one of the most advanced technics to use jenkins and it has a very strong support.
It is based on a groovy DSL and allows you to keep the whole configuration in the SCM of your choise (e.g. GIT, SVN...).

What is the advantage of the Jenkins SonarQube plugin over adding sonar:sonar to maven build step

I am using Maven as a build tool and Jenkins as a CI tool. Currently I have a Jenkins job configured with a Maven build step.
I started using SonarQube and was wondering what is the advantage of using the Jenkins SonarQube plugin and configuring the SonarQube analysis as a post-build-action over simply adding sonar:sonar to the goals of my existing Maven build step.
Thanks and best regards,
Ronald
You can save a lot of configuration. So, if you use jenkins sonar plugin you can centralize database credentials and sonar credentials but if you make a decision about execute sonar:sonar in each jenkins job you will configure each with the same credentials.
I just found: Why use sonar plugin for Jenkins rather than simply use maven goal "sonar:sonar"?
And to add one reason: Using the Jenkins SonarQube plugins one can specify "Skip if triggered by SCM Changes". This is nice if you trigger your Jenkins job for each commit but only want to do a SonarQube analysis at a scheduled time, e.g. one per night.
And here is a summary of the the points made by "emelendez":
Centralize database credentials and sonar credentials Use jenkins
Use jenkins sonar plugin configuring SonarRunner for non Java projects
I've just changed to maven-sonar-plugin from the Jenkins SonarQube plugin to avoid divergence of information between the pom.xml and sonar-project.properties.
For example, developers elsewhere had bumped the project version number in the pom.xml, but they don't use the Jenkins builds and didn't care about the sonar-project.properties (or probably understand it). By switching to the maven plugin instead, the project version is defined once and referenced in the sonar property set within the pom.
The downside is that I no longer have the SonarQube link from the project's Jenkins page.
I'm not sure where the responsibility might be for adding this link back for projects using maven-sonar-plugin... The link is "owned" by the Jenkins SonarQube Plugin, but this is not being used here. Meanwhile the maven-sonar-plugin component is integrating with maven not Jenkins.
Something would need to observe the build and extract the SonarQube link which is emitted as a [INFO] ANALYSIS SUCCESSFUL, you can browse http://... line in the log.

Resources