From 3bb16bc1523169ff3eba97c9ccc98efc90b6c068 Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Wed, 3 Feb 2021 17:13:44 +0100 Subject: [PATCH] SONAR-14432 SonarQube support Azure DevOps Services --- .../almIntegration/AlmIntegrationRenderer.tsx | 2 +- .../components/almIntegration/AzureForm.tsx | 9 +- .../AlmIntegrationRenderer-test.tsx.snap | 12 +-- .../__snapshots__/AzureForm-test.tsx.snap | 22 ++++- .../AlmSpecificForm.tsx | 9 +- .../BranchAnalysisStepContent.tsx | 33 +++++-- .../BranchAnalysisStepContent-test.tsx.snap | 90 +++++++++++++++++-- .../resources/org/sonar/l10n/core.properties | 38 ++++---- 8 files changed, 167 insertions(+), 48 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx index 5f4bd44a36e..2583b5c064e 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx @@ -92,7 +92,7 @@ const tabs = [ height={16} src={`${getBaseUrl()}/images/alm/azure.svg`} /> - Azure DevOps Server + Azure DevOps ), requiresBranchesEnabled: false diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx index 182a44de178..1b9338566e3 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx @@ -48,9 +48,14 @@ export default function AzureForm(props: AzureFormProps) { - {translate('settings.almintegration.form.url.azure.help')} + {translate('settings.almintegration.form.url.azure.help1')}
- https://ado.your-company.com/DefaultCollection + https://ado.your-company.com/your_collection +
+
+ {translate('settings.almintegration.form.url.azure.help2')} +
+ https://dev.azure.com/your_organization } id="url.azure" diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegrationRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegrationRenderer-test.tsx.snap index f5f4acd5265..a7b63393329 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegrationRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegrationRenderer-test.tsx.snap @@ -56,7 +56,7 @@ exports[`should render correctly: azure 1`] = ` height={16} src="/images/alm/azure.svg" /> - Azure DevOps Server + Azure DevOps , "requiresBranchesEnabled": false, }, @@ -146,7 +146,7 @@ exports[`should render correctly: bitbucket 1`] = ` height={16} src="/images/alm/azure.svg" /> - Azure DevOps Server + Azure DevOps , "requiresBranchesEnabled": false, }, @@ -236,7 +236,7 @@ exports[`should render correctly: default 1`] = ` height={16} src="/images/alm/azure.svg" /> - Azure DevOps Server + Azure DevOps , "requiresBranchesEnabled": false, }, @@ -326,7 +326,7 @@ exports[`should render correctly: delete modal 1`] = ` height={16} src="/images/alm/azure.svg" /> - Azure DevOps Server + Azure DevOps , "requiresBranchesEnabled": false, }, @@ -421,7 +421,7 @@ exports[`should render correctly: gitlab 1`] = ` height={16} src="/images/alm/azure.svg" /> - Azure DevOps Server + Azure DevOps , "requiresBranchesEnabled": false, }, @@ -511,7 +511,7 @@ exports[`should render correctly: loading 1`] = ` height={16} src="/images/alm/azure.svg" /> - Azure DevOps Server + Azure DevOps , "requiresBranchesEnabled": false, }, diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap index e12787f70fd..69f49790db3 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap @@ -13,10 +13,17 @@ exports[`should render correctly: create 1`] = ` - settings.almintegration.form.url.azure.help + settings.almintegration.form.url.azure.help1
- https://ado.your-company.com/DefaultCollection + https://ado.your-company.com/your_collection + +
+
+ settings.almintegration.form.url.azure.help2 +
+ + https://dev.azure.com/your_organization } @@ -51,10 +58,17 @@ exports[`should render correctly: edit 1`] = ` - settings.almintegration.form.url.azure.help + settings.almintegration.form.url.azure.help1 +
+ + https://ado.your-company.com/your_collection + +
+
+ settings.almintegration.form.url.azure.help2
- https://ado.your-company.com/DefaultCollection + https://dev.azure.com/your_organization } diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx index 1fc2a7e95b4..69ecd2f9e36 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx @@ -23,6 +23,7 @@ import { Link } from 'react-router'; import HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip'; import { Alert } from 'sonar-ui-common/components/ui/Alert'; import { translate } from 'sonar-ui-common/helpers/l10n'; +import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { AlmKeys, ProjectAlmBindingResponse } from '../../../../types/alm-settings'; import InputForBoolean from '../inputs/InputForBoolean'; @@ -178,7 +179,7 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) { propKey: 'repository', value: repository || '' })} - {renderMonoRepoFieldWithDocLink('/documentation/analysis/azuredevops-integration/')} + {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.Azure])} ); case AlmKeys.Bitbucket: @@ -216,7 +217,7 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) { propKey: 'slug', value: slug || '' })} - {renderMonoRepoFieldWithDocLink('/documentation/analysis/bitbucket-integration/')} + {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.Bitbucket])} ); case AlmKeys.GitHub: @@ -237,7 +238,7 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) { propKey: 'summaryCommentEnabled', value: summaryCommentEnabled === undefined ? true : summaryCommentEnabled })} - {renderMonoRepoFieldWithDocLink('/documentation/analysis/github-integration/')} + {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub])} ); case AlmKeys.GitLab: @@ -249,7 +250,7 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) { propKey: 'repository', value: repository || '' })} - {renderMonoRepoFieldWithDocLink('/documentation/analysis/gitlab-integration/')} + {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.GitLab])} ); default: diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx index 211661ac723..755a685a000 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx @@ -23,6 +23,8 @@ import { Link } from 'react-router'; import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; import { Alert } from 'sonar-ui-common/components/ui/Alert'; import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n'; +import { ALM_DOCUMENTATION_PATHS } from '../../../helpers/constants'; +import { AlmKeys } from '../../../types/alm-settings'; import CodeSnippet from '../../common/CodeSnippet'; import { withAppState } from '../../hoc/withAppState'; import RenderOptions from '../components/RenderOptions'; @@ -71,9 +73,26 @@ sonar.projectKey=${component.key}`; optionLabelKey="onboarding.build" options={Object.values(BuildTechnology)} /> -
    - {buildTechnology && ( - <> + {buildTechnology && ( + <> + + + {translate( + 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link' + )} + + ) + }} + /> + +
    1. + {translate( 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.branch_protection.link' )} @@ -213,9 +232,9 @@ sonar.projectKey=${component.key}`; /> )} - - )} -
    +
+ + )} ); } diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/BranchAnalysisStepContent-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/BranchAnalysisStepContent-test.tsx.snap index 2af6fbe23a9..fd282d774be 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/BranchAnalysisStepContent-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/BranchAnalysisStepContent-test.tsx.snap @@ -18,9 +18,6 @@ exports[`should render correctly: branches enabled 1`] = ` ] } /> -
    `; @@ -42,9 +39,6 @@ exports[`should render correctly: branches not enabled 1`] = ` ] } /> -
      `; @@ -67,6 +61,27 @@ exports[`should render correctly: dotnet 1`] = ` ] } /> + + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link + , + } + } + /> +
        @@ -208,6 +223,27 @@ exports[`should render correctly: gradle 1`] = ` ] } /> + + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link + , + } + } + /> +
          @@ -356,6 +392,27 @@ exports[`should render correctly: maven 1`] = ` ] } /> + + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link + , + } + } + /> +
            @@ -504,6 +561,27 @@ exports[`should render correctly: other 1`] = ` ] } /> + + + onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link + , + } + } + /> +
              diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index e43c3e42cc5..3aff37f6d0a 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -359,7 +359,7 @@ Sa=Sa # #------------------------------------------------------------------------------ -alm.azure=Azure DevOps Server +alm.azure=Azure DevOps alm.azure.short=Azure DevOps alm.bitbucket=Bitbucket Server alm.bitbucket.short=Bitbucket @@ -1086,7 +1086,6 @@ settings.almintegration.check_configuration=Check configuration settings.almintegration.checking_configuration=Checking configuration settings.almintegration.configuration_valid=Configuration valid settings.almintegration.could_not_validate=Could not validate this configuration. -settings.almintegration.no_validation=SonarQube doesn't currently validate Azure DevOps Server configurations. settings.almintegration.delete.header=Delete configuration settings.almintegration.delete.message=Are you sure you want to delete the {id} configuration? settings.almintegration.delete.info={0} projects will no longer get Pull Request Decorations. @@ -1102,8 +1101,9 @@ settings.almintegration.form.name.github=Configuration name settings.almintegration.form.name.github.help=Give your configuration a clear and succinct name. This name will be used at project level to identify the correct configured GitHub App for a project. settings.almintegration.form.name.gitlab=Configuration name settings.almintegration.form.name.gitlab.help=Give your configuration a clear and succinct name. This name will be used at project level to identify the correct configured GitLab instance for a project. -settings.almintegration.form.url.azure=Azure DevOps Server collection URL -settings.almintegration.form.url.azure.help=Provide the full Azure DevOps Server collection URL. For example: +settings.almintegration.form.url.azure=Azure DevOps URL +settings.almintegration.form.url.azure.help1=For Azure DevOps Server, provide the full collection URL: +settings.almintegration.form.url.azure.help2=For Azure DevOps Services, provide the full organization URL: settings.almintegration.form.url.bitbucket=Bitbucket Server URL settings.almintegration.form.url.bitbucket.help=Example: {example} settings.almintegration.form.url.github=GitHub API URL @@ -1145,9 +1145,9 @@ settings.pr_decoration.binding.form.monorepo=Enable mono repository support settings.pr_decoration.binding.form.monorepo.help=Enable this setting if your project is part of a mono repository. {doc_link} settings.pr_decoration.binding.form.monorepo.warning=This setting must be enabled for all SonarQube projects that are part of a mono repository. settings.pr_decoration.binding.form.azure.project=Project Name -settings.pr_decoration.binding.form.azure.project.help=The name of the Azure DevOps Server project containing your repository. +settings.pr_decoration.binding.form.azure.project.help=The name of the Azure DevOps project containing your repository. settings.pr_decoration.binding.form.azure.repository=Repository Name -settings.pr_decoration.binding.form.azure.repository.help=The name of your Azure DevOps Server repository. +settings.pr_decoration.binding.form.azure.repository.help=The name of your Azure DevOps repository. settings.pr_decoration.binding.form.github.repository=Repository identifier settings.pr_decoration.binding.form.github.repository.help=The path of your repository URL. Example: {example} settings.pr_decoration.binding.form.github.summary_comment_setting=Enable analysis summary under the GitHub Conversation tab @@ -3144,7 +3144,7 @@ footer.web_api=Web API # ONBOARDING # #------------------------------------------------------------------------------ -onboarding.alm.azure=Azure DevOps Server +onboarding.alm.azure=Azure DevOps onboarding.alm.bitbucket=Bitbucket Server onboarding.alm.gitlab=GitLab @@ -3157,7 +3157,7 @@ onboarding.create_project.help_set_up_x=Learn more on how to set up {0} onboarding.create_project.setup_manually=Create a project onboarding.create_project.select_method.manual=Manually -onboarding.create_project.select_method.azure=From Azure DevOps Server +onboarding.create_project.select_method.azure=From Azure DevOps onboarding.create_project.select_method.bitbucket=From Bitbucket Server onboarding.create_project.select_method.github=From GitHub onboarding.create_project.select_method.gitlab=From GitLab @@ -3187,10 +3187,10 @@ onboarding.create_project.from_bbs=Create a project from Bitbucket Server onboarding.create_application.key.description=If specified, this value is used as the key instead of generating it from the name of the Application. Only letters, digits, dashes and underscores can be used. -onboarding.create_project.pat_form.title.azure=Allow SonarQube to access and list your Azure DevOps Server repositories +onboarding.create_project.pat_form.title.azure=Allow SonarQube to access and list your Azure DevOps repositories onboarding.create_project.pat_form.title.bitbucket=Grant access to your repositories onboarding.create_project.pat_form.title.gitlab=Grant access to your projects -onboarding.create_project.pat_form.help.azure=SonarQube needs a personal access token to access and list your repositories from Azure DevOps Server. +onboarding.create_project.pat_form.help.azure=SonarQube needs a personal access token to access and list your repositories from Azure DevOps. onboarding.create_project.pat_form.help.bitbucket=SonarQube needs a personal access token to access and list your repositories from Bitbucket Server. onboarding.create_project.pat_form.help.gitlab=SonarQube needs a personal access token to access and list your projects from GitLab. onboarding.create_project.pat_form.pat_required=Please enter a personal access token @@ -3213,7 +3213,7 @@ onboarding.create_project.pat_incorrect.bitbucket=Your personal access couldn't onboarding.create_project.pat_incorrect.gitlab=Your personal access couldn't be validated. Please make sure it has the right scope and that it is not expired. onboarding.create_project.pat_help.title=How to create a personal access token? -onboarding.create_project.pat_help.instructions.azure=Create and provide an Azure DevOps Server {link}. You need to select the {scope} scope so we can display a list of your repositories which are available for analysis. +onboarding.create_project.pat_help.instructions.azure=Create and provide an Azure DevOps {link}. You need to select the {scope} scope so we can display a list of your repositories which are available for analysis. onboarding.create_project.pat_help.instructions.link.azure=personal access token onboarding.create_project.pat_help.instructions=Click the following link to generate a token in {alm}, and copy-paste it into the personal access token field. @@ -3234,8 +3234,8 @@ onboarding.create_project.only_showing_X_first_repos=We're only displaying the f onboarding.create_project.import_selected_repo=Set up selected repository onboarding.create_project.go_to_project=Go to project -onboarding.create_project.azure.title=Which Azure DevOps Server repository do you want to set up? -onboarding.create_project.azure.no_projects=No projects could be fetched from Azure DevOps Server. Contact your system administrator, or {link}. +onboarding.create_project.azure.title=Which Azure DevOps repository do you want to set up? +onboarding.create_project.azure.no_projects=No projects could be fetched from Azure DevOps. Contact your system administrator, or {link}. onboarding.create_project.azure.no_repositories=Could not fetch repositories for this project. Contact your system administrator, or {link}. onboarding.create_project.azure.no_results=No repositories match your search query. onboarding.create_project.github.title=Which GitHub repository do you want to set up? @@ -3513,13 +3513,13 @@ onboarding.tutorial.with.jenkins.refresh=This page will then refresh with your a onboarding.tutorial.with.jenkins.refresh.why=If the page doesn't refresh after a while, please double-check the analysis configuration. onboarding.tutorial.with.azure_pipelines.title=Analyze your project with Azure DevOps Pipelines -onboarding.tutorial.with.azure_pipelines.unsupported=This tutorial is only available for projects bound to Azure DevOps Server. -onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title=Install SonarQube extension for Azure DevOps Server -onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence=From your Azure DevOps Server instance, navigate to the Visual Studio Marketplace and install the {link} by clicking the {button} button. +onboarding.tutorial.with.azure_pipelines.unsupported=This tutorial is only available for projects bound to Azure DevOps. +onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title=Install SonarQube extension for Azure DevOps +onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence=From your Azure DevOps instance, navigate to the Visual Studio Marketplace and install the {link} by clicking the {button} button. onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence.link=SonarQube extension onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence.button=Get it free onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.title=Add a new SonarQube Service Endpoint -onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step1.sentence=In Azure DevOps Server, go to {menu} +onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step1.sentence=In Azure DevOps, go to {menu} onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step1.sentence.menu=Project settings > Service connections onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step2.sentence=Add a new service connection of type {type} onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step2.sentence.type=SonarQube @@ -3528,7 +3528,9 @@ onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step4.sentence=Enter yo onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step5.sentence=Enter an existing token, or a newly generated one onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step6.sentence=Create the service connection onboarding.tutorial.with.azure_pipelines.BranchAnalysis.title=Configure analysis -onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.sentence=In Azure DevOps Server, create or edit a {pipeline} and add a new {task} task {before} your build task +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info=The following steps assume you are using the Azure Pipelines classic editor. Check out our {doc_link} for the yaml counterpart. +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link=Azure DevOps integration page +onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.sentence=In Azure DevOps, create or edit a {pipeline} and add a new {task} task {before} your build task onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.sentence.pipeline=Build Pipeline onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.sentence.task=Prepare Analysis Configuration onboarding.tutorial.with.azure_pipelines.BranchAnalysis.prepare.sentence.before=before -- 2.39.5