SonarQube Jenkins
  1. SonarQube Jenkins
  2. SONARJNKNS-9

Provide a new "Build with Sonar" action

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.7
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      We very, very rarely would want Sonar to run on a user initiated build. In the 1.7 version, the environment variable exclusion trigger was added such that a build parameter could be added to the project and when the job is manually run, the user could disable sonar by checking a boolean parameter. This is not very user friendly for us as we almost never want sonar to execute when a build is manually run. Now users have to go to a subsequent page and click a boolean every time a manual build is run.

      Instead, I would ask that a specific skip user cause trigger exclusion be added. This would always prevent sonar from running when a manual build is requested. Pull request on github: https://github.com/SonarSource/jenkins-sonar-plugin/pull/4#issuecomment-2580276

      In order to address the use case where once in a great while one would want a manual build to include sonar, I would propose that a new project action be created to "Run with Sonar" that kicks off a build with a cause of SonarCause (which can't be configured as a skip) and the Sonar analysis is conducted. This would only have to be enabled if the skip user cause is configured as true.

        Activity

        Hide
        Freddy Mallet added a comment -

        Hi Peter, for me even if we provide a new trigger exclusion option there won't be a big difference with what is currently possible. Indeed with this new trigger exclusion option, it will be up to the Hudson user to :

        • uncheck this option
        • launch the build
        • check back this option

        With the current Hudson plugin, it's up to the Hudson user to :

        • parameterize the build with a predefined Sonar parameter
        • launch the build
        • remove the parameter
        Show
        Freddy Mallet added a comment - Hi Peter, for me even if we provide a new trigger exclusion option there won't be a big difference with what is currently possible. Indeed with this new trigger exclusion option, it will be up to the Hudson user to : uncheck this option launch the build check back this option With the current Hudson plugin, it's up to the Hudson user to : parameterize the build with a predefined Sonar parameter launch the build remove the parameter
        Hide
        Peter Hayes added a comment -

        Yes, I agree that that would not be good. In the description above, the last piece to add would be an additional project action called "Run with Sonar" that kicks off a build with Sonar enabled. I have implemented this but am still testing. Doing this then requires just a single click of the run with sonar button to have a manual build kicked off that will trigger the Sonar analysis. This action is only available if the user cause trigger exclusion is enabled.

        Show
        Peter Hayes added a comment - Yes, I agree that that would not be good. In the description above, the last piece to add would be an additional project action called "Run with Sonar" that kicks off a build with Sonar enabled. I have implemented this but am still testing. Doing this then requires just a single click of the run with sonar button to have a manual build kicked off that will trigger the Sonar analysis. This action is only available if the user cause trigger exclusion is enabled.
        Hide
        Freddy Mallet added a comment -

        And so I agree Peter. I'm going to change the title of this JIRA ticket to prevent any further misunderstanding.

        Show
        Freddy Mallet added a comment - And so I agree Peter. I'm going to change the title of this JIRA ticket to prevent any further misunderstanding.
        Hide
        Peter Hayes added a comment -

        I committed additional code to support the Build with Sonar project action that is made available if the sonar analysis is configured to be skipped on a user initiated build.

        Show
        Peter Hayes added a comment - I committed additional code to support the Build with Sonar project action that is made available if the sonar analysis is configured to be skipped on a user initiated build.
        Hide
        Jens Bannmann added a comment -

        The proposed solution of

        1. adding a "Skip if initiated by user" exclusion and
        2. a "Run with Sonar" action

        would be perfect for me, too.

        What's the status of this issue? Can the code written by Peter be easily integrated into the next plugin version?

        Show
        Jens Bannmann added a comment - The proposed solution of adding a "Skip if initiated by user" exclusion and a "Run with Sonar" action would be perfect for me, too. What's the status of this issue? Can the code written by Peter be easily integrated into the next plugin version?
        Hide
        Aristedes Maniatis added a comment -

        Hi Peter

        What happened to your code for this plugin? It looks like it was never committed or else there are multiple forks of the plugin. Did your go to Hudson and not to the Jenkins version of the plugin?

        Show
        Aristedes Maniatis added a comment - Hi Peter What happened to your code for this plugin? It looks like it was never committed or else there are multiple forks of the plugin. Did your go to Hudson and not to the Jenkins version of the plugin?
        Hide
        Peter Hayes added a comment -

        The pull request is still open but it doesn't appear that the maintainers are inclined to move forward with this enhancement.

        Show
        Peter Hayes added a comment - The pull request is still open but it doesn't appear that the maintainers are inclined to move forward with this enhancement.

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Hayes
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: