How to use sonar TFVC plugin? - plugins

I want use the TFVC plugin with sonar.
I have copied the file sonar-scm-tfvc-plugin-2.0.jar in Sonar\extensions\plugins.
I use the following config sonar.properties :
sonar.scm.enabled=true
sonar.scm.provider=tfvc
sonar.tfvc.username=my Tfs UserAccount
sonar.tfvc.password.secured=My TFS password
When I run a sonar analysis on the command line c:sonar.net-runner.cmd,
the analysis is successful.
But on the web side, all issues are not assigned....
Is there something wrong ?

SonarQube version 5.x+ will automatically assign issue to the last committer on the line if:
It is a new issue that has been introduced since the last analysis
It was possible to match the SCM user to a SonarQube user
So, if you did an initial analysis of your project, then enabled the SonarQube SCM TFVC plugin, and redid an analysis, none of the issues are new, and so it is expected for all of them to stay unassigned.
Start by verifying that you get the SCM data from TFVC properly imported into SonarQube:

Related

Applying sonarqube for remote repository

I have a project in my github.Sonarqube was running in local machine(windows).Now I want to apply sonarqube on my repository project in my local machine only without using jenkins.
I have applied the sonarqube when that project is in local machine.
Two requirements I want to do
1)Applying sonarqube to remote repository
2)whenever a commit happens update sonarqube on that changes.
Applying sonarqube to remote repository
That means a remote process running Sonar on the GitHub side.
For now, you have GitHub Actions which allow, on push, to run specific programs.
For instance: sonarsource/sonarcloud-github-action will run SonarCloud (you can sign up an account for free) in order to detects bugs, vulnerabilities and code smells in more than 20 programming languages.
No Jenkins required.

VSTS\Azure-DevOps: Enabling Continuous Integration on pipeline with source from Bitbucket fails with error

Regards,
Your help will be appreciated.
I have created a pipeline in VSTS\Azure-DevOps. It gets its sources from a repository in Bitbucket. Queueing a build works fine. It builds and the tests succeed.
Now I want a build to run on every commit to the repository on Bitbucket. However, when I edit the pipeline and in the Triggers tab enable 'Continuous Integration' and click 'Save' I get the following error:
Unable to configure a service on the selected Bitbucket repository. Bitbucket returned the error 'Forbidden: '.
I am confused that I get 'Forbidden', while getting the source-code already works.
What is it that I am doing wrong? Is there something I must configure in VSTS\Azure-DevOps or in Bitbucket?
Answering my own question:
It appeared that in Bitbucket I only had the rights of 'Writer' for the Repository. When we changed it to 'Administrator' enabling Continuous Integration worked and we verified that committing a code change triggered the build.
Good news / bad news.
It looks like - for now - you can configure a pipeline without being a BitBucket admin on the repo... but not using the templates.
So you can build an empty pipeline based on a BitBucket repo (no admin access), and manually add each of the tasks.
Based on further tests: what you cannot do is set the Continuous Integration trigger, because that requires admin access to set up the webhooks
I know, this is not what you want... but at least there is a way to end up with a working pipeline.
Regards,
Jose

Switch branch in TFS when executing tests from Jenkins

If I have multiple branches in TFS for my automation code (QA branch, Beta branch, Live branch, etc.), is there a way to switch the branch being used when executing the tests via Jenkins?
I use Eclipse IDE and have multiple Maven projects set up in Jenkins that execute my tests. We use TFS as our source control at the moment.
I have different automation branches due to code base differences between environments and would like to be able to specify the automation code branch to use depending on what environment is being ran against on build time in Jenkins.
I am using a Choice Parameter for the environment. If I could set another variable off of that, maybe something like if env.contains("Dev") then set branchPath="QA" and then use the branchPath as the Project path in Source Code Management?
You can specify the project path in Source Code Management section of Jenkin, in Project path, you can specify the branch you need:

sonar+github integration

I want to enable sonar with git but is it neccesary that first pull the project from git repository using hudson or something else and then sonar will analyse the code periodically on hudson .am I right means my steps :
1.Pull project from git using hudson.
2.Sonar on hudson will analyse the code and send the updates.?
or directly we can use git+sonar how it works ,can anybody guide me to get it work.
Yes, you need first to pull your project from GitHub, and then launch a Sonar analysis on your local copy (Sonar needs the file to exist on the file system to be able to analyse them).
So you can pull your project manually or obvioulsy using a CI server like Jenkins/Hudson.
The good news, yesterday (2015-07-08) SonarQube has launched a Github Pluging, every time a pull request is submitted, the CI system launches a SonarQube preview analysis.
Reference:
http://www.sonarqube.org/github-pull-request-analysis-helps-fix-the-leak/

${CHANGES} does not work in the mail-ext plugin if jenkins job is driven by a bash script

I have setup a Jenkins job to build a project. I'm using email-ext plugin to send out build notifications with the intent of showing who did what and the path to the files changed. But unfortunately I'm not getting anything. I believe the reason why is that under "Source Code Management" I'm setting it to "None". My shell script that I'm using to drive the build is responsible for check-in out a copy of the code based on a CVS tag and run maven to do the build. In the ext-email i'm using the following syntax
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, showPaths=true,
format="\n====\nChanges for Build # %n\n%c\n",
changesFormat="\n[%r] %d %a %m %p\n"}
Same thing with CHANGES: ${CHANGES, showPaths=true}
Is there a way of getting CHANGES and CHANGES_SINCE_LAST_SUCCESS to work if None option is used under Source Code Management?
Thanks for your help folks.
EmailExt plugin gets that info from Jenkins. As Jenkins has access to that info only via its SCM plugins the answer is "no", you can't do it without specifying the SCM option.
There are two things you can do:
(1) Do it by hand. Which with CVS, if I remember correctly, means having a working copy checked out anyway.
(2) Use SCM checkout/update option, but store the working copy on the side without using it in the build. You'll use twice as much disk-space, but nowadays disk-space is not a problem.
By the way, why are you using CVS? SVN, GIT, and Mercurial are all free.