Bladeren bron

SONAR-14892 Enable Jenkins tutorial to BitbucketCloud projects

tags/9.0.0.45539
Jeremy Davis 3 jaren geleden
bovenliggende
commit
a8a13e5e2d

+ 3
- 1
server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx Bestand weergeven

@@ -56,7 +56,9 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender

const jenkinsAvailable =
projectBinding &&
[AlmKeys.BitbucketServer, AlmKeys.GitHub, AlmKeys.GitLab].includes(projectBinding.alm);
[AlmKeys.BitbucketCloud, AlmKeys.BitbucketServer, AlmKeys.GitHub, AlmKeys.GitLab].includes(
projectBinding.alm
);

return (
<>

+ 2
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx Bestand weergeven

@@ -26,6 +26,7 @@ import { setCurrentUserSetting } from '../../../store/users';
import {
AlmSettingsInstance,
isProjectBitbucketBindingResponse,
isProjectBitbucketCloudBindingResponse,
isProjectGitHubBindingResponse,
isProjectGitLabBindingResponse,
ProjectAlmBindingResponse
@@ -62,6 +63,7 @@ export function JenkinsTutorial(props: JenkinsTutorialProps) {

// Failsafe; should never happen.
if (
!isProjectBitbucketCloudBindingResponse(projectBinding) &&
!isProjectBitbucketBindingResponse(projectBinding) &&
!isProjectGitHubBindingResponse(projectBinding) &&
!isProjectGitLabBindingResponse(projectBinding)

+ 49
- 4
server/sonar-web/src/main/js/components/tutorials/jenkins/MultiBranchPipelineStep.tsx Bestand weergeven

@@ -23,9 +23,11 @@ import { translate } from 'sonar-ui-common/helpers/l10n';
import {
AlmSettingsInstance,
isProjectBitbucketBindingResponse,
isProjectBitbucketCloudBindingResponse,
isProjectGitHubBindingResponse,
isProjectGitLabBindingResponse,
ProjectBitbucketBindingResponse,
ProjectBitbucketCloudBindingResponse,
ProjectGitHubBindingResponse,
ProjectGitLabBindingResponse
} from '../../../types/alm-settings';
@@ -35,20 +37,37 @@ import SentenceWithHighlights from '../components/SentenceWithHighlights';
import Step from '../components/Step';
import { buildGithubLink } from '../utils';

type validBindingResponse =
| ProjectBitbucketCloudBindingResponse
| ProjectBitbucketBindingResponse
| ProjectGitHubBindingResponse
| ProjectGitLabBindingResponse;

export interface MultiBranchPipelineStepProps {
almBinding?: AlmSettingsInstance;
finished: boolean;
onDone: () => void;
onOpen: () => void;
open: boolean;
projectBinding:
| ProjectBitbucketBindingResponse
| ProjectGitHubBindingResponse
| ProjectGitLabBindingResponse;
projectBinding: validBindingResponse;
}

/* Capture [workspaceID] from this pattern: https://bitbucket.org/[workspaceId]/ */
const bitbucketcloudUrlRegex = new RegExp('https:\\/\\/bitbucket.org\\/(.+)\\/');

function extractBitbucketCloudWorkspaceId(almBinding?: AlmSettingsInstance): string | undefined {
if (almBinding?.url) {
const result = almBinding.url.match(bitbucketcloudUrlRegex);

return result ? result[1] : undefined;
}
}

export default function MultiBranchPipelineStep(props: MultiBranchPipelineStepProps) {
const { almBinding, finished, open, projectBinding } = props;

const workspaceId = extractBitbucketCloudWorkspaceId(almBinding);

return (
<Step
finished={finished}
@@ -94,6 +113,32 @@ export default function MultiBranchPipelineStep(props: MultiBranchPipelineStepPr
</li>
</>
)}
{isProjectBitbucketCloudBindingResponse(projectBinding) && (
<>
<li>
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.server" />
</li>
<li>
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.creds" />
</li>
<li>
{workspaceId ? (
<LabelValuePair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.owner"
value={workspaceId}
/>
) : (
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.owner" />
)}
</li>
<li>
<LabelValuePair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.repo"
value={projectBinding.repository}
/>
</li>
</>
)}
{isProjectGitHubBindingResponse(projectBinding) && (
<>
<li>

+ 1
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStep.tsx Bestand weergeven

@@ -45,6 +45,7 @@ function renderAlmSpecificInstructions(props: WebhookStepProps) {
const { almBinding, branchesEnabled, projectBinding } = props;

switch (projectBinding.alm) {
case AlmKeys.BitbucketCloud:
case AlmKeys.BitbucketServer:
return (
<WebhookStepBitbucket

+ 88
- 31
server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx Bestand weergeven

@@ -21,7 +21,11 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { AlmSettingsInstance, ProjectAlmBindingResponse } from '../../../types/alm-settings';
import {
AlmKeys,
AlmSettingsInstance,
ProjectAlmBindingResponse
} from '../../../types/alm-settings';
import CodeSnippet from '../../common/CodeSnippet';
import LabelActionPair from '../components/LabelActionPair';
import SentenceWithHighlights from '../components/SentenceWithHighlights';
@@ -32,19 +36,34 @@ export interface WebhookStepBitbucketProps {
projectBinding: ProjectAlmBindingResponse;
}

function buildUrlSnippet(branchesEnabled: boolean, ownUrl = '***BITBUCKET_URL***') {
return branchesEnabled
? `***JENKINS_SERVER_URL***/bitbucket-scmsource-hook/notify?server_url=${ownUrl}`
: '***JENKINS_SERVER_URL***/job/***JENKINS_JOB_NAME***/build?token=***JENKINS_BUILD_TRIGGER_TOKEN***';
function buildUrlSnippet(
branchesEnabled: boolean,
isBitbucketcloud: boolean,
ownUrl = '***BITBUCKET_URL***'
) {
if (!branchesEnabled) {
return '***JENKINS_SERVER_URL***/job/***JENKINS_JOB_NAME***/build?token=***JENKINS_BUILD_TRIGGER_TOKEN***';
}
return isBitbucketcloud
? '***JENKINS_SERVER_URL***/bitbucket-scmsource-hook/notify'
: `***JENKINS_SERVER_URL***/bitbucket-scmsource-hook/notify?server_url=${ownUrl}`;
}

export default function WebhookStepBitbucket(props: WebhookStepBitbucketProps) {
const { almBinding, branchesEnabled, projectBinding } = props;

const linkUrl =
almBinding &&
almBinding.url &&
`${almBinding.url}/plugins/servlet/webhooks/projects/${projectBinding.repository}/repos/${projectBinding.slug}/create`;
const isBitbucketCloud = projectBinding.alm === AlmKeys.BitbucketCloud;

let linkUrl;
if (almBinding?.url) {
if (isBitbucketCloud) {
linkUrl =
projectBinding.repository &&
`${almBinding.url}${projectBinding.repository}/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin`;
} else {
linkUrl = `${almBinding.url}/plugins/servlet/webhooks/projects/${projectBinding.repository}/repos/${projectBinding.slug}/create`;
}
}

return (
<>
@@ -55,10 +74,18 @@ export default function WebhookStepBitbucket(props: WebhookStepBitbucketProps) {
values={{
link: linkUrl ? (
<a href={linkUrl} rel="noopener noreferrer" target="_blank">
{translate('onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.link')}
{translate(
'onboarding.tutorial.with.jenkins.webhook',
projectBinding.alm,
'step1.link'
)}
</a>
) : (
translate('onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.link')
translate(
'onboarding.tutorial.with.jenkins.webhook',
projectBinding.alm,
'step1.link'
)
)
}}
/>
@@ -72,9 +99,13 @@ export default function WebhookStepBitbucket(props: WebhookStepBitbucketProps) {
</p>
<CodeSnippet
isOneLine={true}
snippet={buildUrlSnippet(branchesEnabled, almBinding && almBinding.url)}
snippet={buildUrlSnippet(
branchesEnabled,
isBitbucketCloud,
almBinding && almBinding.url
)}
/>
{branchesEnabled && (
{branchesEnabled && !isBitbucketCloud && (
<Alert variant="info">
{translate('onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.url.warning')}
</Alert>
@@ -82,27 +113,53 @@ export default function WebhookStepBitbucket(props: WebhookStepBitbucketProps) {
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={['events']}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step2"
/>
<ul className="list-styled">
<li>
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.repo" />
</li>
{branchesEnabled && (
{isBitbucketCloud ? (
<li>
<SentenceWithHighlights
highlightKeys={['triggers', 'option']}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2"
/>
<ul className="list-styled">
<li>
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.pr" />
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.repo" />
</li>
)}
</ul>
</li>
{branchesEnabled && (
<li>
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.pr" />
</li>
)}
</ul>
</li>
) : (
<li>
<SentenceWithHighlights
highlightKeys={['events']}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step2"
/>
<ul className="list-styled">
<li>
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.repo" />
</li>
{branchesEnabled && (
<li>
<LabelActionPair translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.pr" />
</li>
)}
</ul>
</li>
)}
<li>
<SentenceWithHighlights
highlightKeys={['create']}
translationKey="onboarding.tutorial.with.jenkins.webhook.step3"
/>
{isBitbucketCloud ? (
<SentenceWithHighlights
highlightKeys={['save']}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step3"
/>
) : (
<SentenceWithHighlights
highlightKeys={['create']}
translationKey="onboarding.tutorial.with.jenkins.webhook.step3"
/>
)}
</li>
</>
);

+ 9
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/MultiBranchPipelineStep-test.tsx Bestand weergeven

@@ -22,6 +22,7 @@ import * as React from 'react';
import {
mockAlmSettingsInstance,
mockProjectBitbucketBindingResponse,
mockProjectBitbucketCloudBindingResponse,
mockProjectGithubBindingResponse,
mockProjectGitLabBindingResponse
} from '../../../../helpers/mocks/alm-settings';
@@ -32,6 +33,14 @@ it('should render correctly', () => {
const wrapper = shallowRender();
expect(wrapper).toMatchSnapshot('Step wrapper');
expect(renderStepContent(wrapper)).toMatchSnapshot('content for bitbucket');
expect(
renderStepContent(
shallowRender({
almBinding: mockAlmSettingsInstance({ url: 'https://bitbucket.org/workspaceId/' }),
projectBinding: mockProjectBitbucketCloudBindingResponse()
})
)
).toMatchSnapshot('content for bitbucket cloud');
expect(
renderStepContent(
shallowRender({

+ 2
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStep-test.tsx Bestand weergeven

@@ -23,6 +23,7 @@ import {
mockAlmSettingsInstance,
mockProjectAlmBindingResponse,
mockProjectBitbucketBindingResponse,
mockProjectBitbucketCloudBindingResponse,
mockProjectGithubBindingResponse
} from '../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../types/alm-settings';
@@ -31,6 +32,7 @@ import WebhookStep, { WebhookStepProps } from '../WebhookStep';

it.each([
[AlmKeys.Azure, mockProjectAlmBindingResponse({ alm: AlmKeys.Azure })],
[AlmKeys.BitbucketCloud, mockProjectBitbucketCloudBindingResponse()],
[AlmKeys.BitbucketServer, mockProjectBitbucketBindingResponse()],
[AlmKeys.GitHub, mockProjectGithubBindingResponse()],
[AlmKeys.GitLab, mockProjectAlmBindingResponse({ alm: AlmKeys.GitLab })]

+ 13
- 5
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepBitbucket-test.tsx Bestand weergeven

@@ -21,14 +21,22 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockAlmSettingsInstance,
mockProjectBitbucketBindingResponse
mockProjectBitbucketBindingResponse,
mockProjectBitbucketCloudBindingResponse
} from '../../../../helpers/mocks/alm-settings';
import WebhookStepBitbucket, { WebhookStepBitbucketProps } from '../WebhookStepBitbucket';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
expect(shallowRender({ almBinding: undefined })).toMatchSnapshot('with no alm binding');
expect(shallowRender({ branchesEnabled: false })).toMatchSnapshot('with branches disabled');
it.each([
['bitbucket server', mockProjectBitbucketBindingResponse()],
['bitbucket cloud', mockProjectBitbucketCloudBindingResponse()]
])('should render correctly for %s', (_name, projectBinding) => {
expect(shallowRender({ projectBinding })).toMatchSnapshot();
expect(shallowRender({ projectBinding, almBinding: undefined })).toMatchSnapshot(
'with no alm binding'
);
expect(shallowRender({ projectBinding, branchesEnabled: false })).toMatchSnapshot(
'with branches disabled'
);
});

function shallowRender(props: Partial<WebhookStepBitbucketProps> = {}) {

+ 115
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/MultiBranchPipelineStep-test.tsx.snap Bestand weergeven

@@ -126,6 +126,121 @@ exports[`should render correctly: content for bitbucket 1`] = `
</div>
`;

exports[`should render correctly: content for bitbucket cloud 1`] = `
<div
className="boxed-group-inner"
>
<p
className="big-spacer-bottom"
>
onboarding.tutorial.with.jenkins.multi_branch_pipeline.intro
</p>
<ol
className="list-styled"
>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"new_item",
"type",
]
}
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step1"
/>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"tab",
"source",
]
}
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud"
/>
<ul
className="list-styled"
>
<React.Fragment>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.server"
/>
</li>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.creds"
/>
</li>
<li>
<LabelValuePair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.owner"
value="workspaceId"
/>
</li>
<li>
<LabelValuePair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.repo"
value="PROJECT_KEY"
/>
</li>
</React.Fragment>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.behaviour"
/>
</li>
</ul>
<p
className="big-spacer-left padder-left"
>
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.leave_defaults
</p>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"tab",
]
}
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step3"
/>
<ul
className="list-styled"
>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step3.mode"
/>
</li>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step3.script_path"
/>
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"save",
]
}
translationKey="onboarding.tutorial.with.jenkins.multi_branch_pipeline.step4"
/>
</li>
</ol>
<Button
onClick={[MockFunction]}
>
continue
</Button>
</div>
`;

exports[`should render correctly: content for github 1`] = `
<div
className="boxed-group-inner"

+ 62
- 0
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStep-test.tsx.snap Bestand weergeven

@@ -105,6 +105,68 @@ exports[`it should render correctly for bitbucket: wrapper 1`] = `
/>
`;

exports[`it should render correctly for bitbucketcloud: content 1`] = `
<div
className="boxed-group-inner"
>
<p
className="big-spacer-bottom"
>
<FormattedMessage
defaultMessage="onboarding.tutorial.with.jenkins.webhook.intro.sentence"
id="onboarding.tutorial.with.jenkins.webhook.intro.sentence"
values={
Object {
"link": <ButtonLink
onClick={[MockFunction]}
>
onboarding.tutorial.with.jenkins.webhook.intro.link
</ButtonLink>,
}
}
/>
</p>
<ol
className="list-styled"
>
<WebhookStepBitbucket
almBinding={
Object {
"alm": "github",
"key": "key",
}
}
branchesEnabled={true}
projectBinding={
Object {
"alm": "bitbucketcloud",
"key": "foo",
"monorepo": true,
"repository": "PROJECT_KEY",
"slug": "repo-slug",
}
}
/>
</ol>
<Button
onClick={[MockFunction]}
>
continue
</Button>
</div>
`;

exports[`it should render correctly for bitbucketcloud: wrapper 1`] = `
<Step
finished={false}
onOpen={[MockFunction]}
open={false}
renderForm={[Function]}
stepNumber={2}
stepTitle="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.title"
/>
`;

exports[`it should render correctly for github: content 1`] = `
<div
className="boxed-group-inner"

+ 229
- 3
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepBitbucket-test.tsx.snap Bestand weergeven

@@ -1,6 +1,232 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly 1`] = `
exports[`should render correctly for bitbucket cloud 1`] = `
<Fragment>
<li>
<FormattedMessage
defaultMessage="onboarding.tutorial.with.jenkins.webhook.step1.sentence"
id="onboarding.tutorial.with.jenkins.webhook.step1.sentence"
values={
Object {
"link": <a
href="http://bbs.enterprise.comPROJECT_KEY/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin"
rel="noopener noreferrer"
target="_blank"
>
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step1.link
</a>,
}
}
/>
<ul
className="list-styled"
>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.step1.name"
/>
</li>
<li
className="abs-width-600"
>
<p>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.url"
/>
</p>
<CodeSnippet
isOneLine={true}
snippet="***JENKINS_SERVER_URL***/bitbucket-scmsource-hook/notify"
/>
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"triggers",
"option",
]
}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2"
/>
<ul
className="list-styled"
>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.repo"
/>
</li>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.pr"
/>
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"save",
]
}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step3"
/>
</li>
</Fragment>
`;

exports[`should render correctly for bitbucket cloud: with branches disabled 1`] = `
<Fragment>
<li>
<FormattedMessage
defaultMessage="onboarding.tutorial.with.jenkins.webhook.step1.sentence"
id="onboarding.tutorial.with.jenkins.webhook.step1.sentence"
values={
Object {
"link": <a
href="http://bbs.enterprise.comPROJECT_KEY/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin"
rel="noopener noreferrer"
target="_blank"
>
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step1.link
</a>,
}
}
/>
<ul
className="list-styled"
>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.step1.name"
/>
</li>
<li
className="abs-width-600"
>
<p>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.url"
/>
</p>
<CodeSnippet
isOneLine={true}
snippet="***JENKINS_SERVER_URL***/job/***JENKINS_JOB_NAME***/build?token=***JENKINS_BUILD_TRIGGER_TOKEN***"
/>
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"triggers",
"option",
]
}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2"
/>
<ul
className="list-styled"
>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.repo"
/>
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"save",
]
}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step3"
/>
</li>
</Fragment>
`;

exports[`should render correctly for bitbucket cloud: with no alm binding 1`] = `
<Fragment>
<li>
<FormattedMessage
defaultMessage="onboarding.tutorial.with.jenkins.webhook.step1.sentence"
id="onboarding.tutorial.with.jenkins.webhook.step1.sentence"
values={
Object {
"link": "onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step1.link",
}
}
/>
<ul
className="list-styled"
>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.step1.name"
/>
</li>
<li
className="abs-width-600"
>
<p>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.url"
/>
</p>
<CodeSnippet
isOneLine={true}
snippet="***JENKINS_SERVER_URL***/bitbucket-scmsource-hook/notify"
/>
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"triggers",
"option",
]
}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2"
/>
<ul
className="list-styled"
>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.repo"
/>
</li>
<li>
<LabelActionPair
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.pr"
/>
</li>
</ul>
</li>
<li>
<SentenceWithHighlights
highlightKeys={
Array [
"save",
]
}
translationKey="onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step3"
/>
</li>
</Fragment>
`;

exports[`should render correctly for bitbucket server 1`] = `
<Fragment>
<li>
<FormattedMessage
@@ -83,7 +309,7 @@ exports[`should render correctly 1`] = `
</Fragment>
`;

exports[`should render correctly: with branches disabled 1`] = `
exports[`should render correctly for bitbucket server: with branches disabled 1`] = `
<Fragment>
<li>
<FormattedMessage
@@ -156,7 +382,7 @@ exports[`should render correctly: with branches disabled 1`] = `
</Fragment>
`;

exports[`should render correctly: with no alm binding 1`] = `
exports[`should render correctly for bitbucket server: with no alm binding 1`] = `
<Fragment>
<li>
<FormattedMessage

+ 14
- 0
server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts Bestand weergeven

@@ -30,6 +30,7 @@ import {
ProjectAlmBindingResponse,
ProjectAzureBindingResponse,
ProjectBitbucketBindingResponse,
ProjectBitbucketCloudBindingResponse,
ProjectGitHubBindingResponse,
ProjectGitLabBindingResponse
} from '../../types/alm-settings';
@@ -135,6 +136,19 @@ export function mockProjectBitbucketBindingResponse(
};
}

export function mockProjectBitbucketCloudBindingResponse(
overrides: Partial<ProjectBitbucketCloudBindingResponse> = {}
): ProjectBitbucketCloudBindingResponse {
return {
alm: AlmKeys.BitbucketCloud,
key: 'foo',
repository: 'PROJECT_KEY',
slug: 'repo-slug',
monorepo: true,
...overrides
};
}

export function mockProjectGithubBindingResponse(
overrides: Partial<ProjectGitHubBindingResponse> = {}
): ProjectGitHubBindingResponse {

+ 11
- 0
server/sonar-web/src/main/js/types/alm-settings.ts Bestand weergeven

@@ -81,6 +81,11 @@ export interface ProjectBitbucketBindingResponse extends ProjectAlmBindingRespon
slug: string;
}

export interface ProjectBitbucketCloudBindingResponse extends ProjectAlmBindingResponse {
alm: AlmKeys.BitbucketCloud;
repository: string;
}

export interface ProjectGitHubBindingResponse extends ProjectAlmBindingResponse {
alm: AlmKeys.GitHub;
repository: string;
@@ -154,6 +159,12 @@ export function isProjectBitbucketBindingResponse(
return binding.alm === AlmKeys.BitbucketServer;
}

export function isProjectBitbucketCloudBindingResponse(
binding: ProjectAlmBindingResponse
): binding is ProjectBitbucketBindingResponse {
return binding.alm === AlmKeys.BitbucketCloud;
}

export function isProjectGitHubBindingResponse(
binding: ProjectAlmBindingResponse
): binding is ProjectGitHubBindingResponse {

+ 26
- 0
sonar-core/src/main/resources/org/sonar/l10n/core.properties Bestand weergeven

@@ -3492,6 +3492,7 @@ onboarding.tutorial.with.jenkins.prereqs.title=Prerequisites
onboarding.tutorial.with.jenkins.prereqs.intro.sentence=To run your project analyses with Jenkins, the following plugins {must_have}
onboarding.tutorial.with.jenkins.prereqs.intro.sentence.must_have=must be installed and configured:
onboarding.tutorial.with.jenkins.prereqs.plugins.branch_source.bitbucket=Bitbucket Branch Source plugin for Jenkins - version 2.7 or later
onboarding.tutorial.with.jenkins.prereqs.plugins.branch_source.bitbucketcloud=Bitbucket Branch Source plugin for Jenkins - version 2.7 or later
onboarding.tutorial.with.jenkins.prereqs.plugins.branch_source.github=GitHub Branch Source plugin for Jenkins - version 2.7.1 or later
onboarding.tutorial.with.jenkins.prereqs.plugins.branch_source.gitlab=GitLab Branch Source plugin for Jenkins - version 1.5.3 or later
onboarding.tutorial.with.jenkins.prereqs.plugins.gitlab_plugin=GitLab plugin for Jenkins - version 1.5.13 or later
@@ -3519,6 +3520,18 @@ onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucket.owner.act
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucket.repo.label=Repository
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucket.repo.action=select the repository you want to analyze.

onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.sentence=Under {tab}, add a {source} source and enter the following information:
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.sentence.tab=Branch Sources
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.sentence.source=Bitbucket
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.server.label=Server
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.server.action=Make sure that Bitbucket Cloud is selected.
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.creds.label=Credentials
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.creds.action=select the Bitbucket Cloud credentials.
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.owner.label=Owner
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.owner.action=enter your workspace ID
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.repo.label=Repository
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.repo.action=select the repository you want to analyze.

onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.github.sentence=Under {tab}, add a {source} source and enter the following information:
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.github.sentence.tab=Branch Sources
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.github.sentence.source=GitHub
@@ -3539,6 +3552,8 @@ onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.gitlab.repo.action=

onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucket.behaviour.label=Behavior
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucket.behaviour.action=make sure "Exclude branches that are also filed as PRs" is selected.
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.behaviour.label=Behavior
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.bitbucketcloud.behaviour.action=make sure "Exclude branches that are also filed as PRs" is selected.

onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.github.behaviour.label=Behavior
onboarding.tutorial.with.jenkins.multi_branch_pipeline.step2.github.behaviour.action=make sure "Exclude branches that are also filed as PRs" is selected.
@@ -3595,12 +3610,14 @@ onboarding.tutorial.with.jenkins.pipeline.step4.sentence.save=Save


onboarding.tutorial.with.jenkins.webhook.bitbucket.title=Create a Bitbucket Server Webhook
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.title=Create a Bitbucket Cloud Webhook
onboarding.tutorial.with.jenkins.webhook.github.title=Create a GitHub Webhook
onboarding.tutorial.with.jenkins.webhook.gitlab.title=Create a GitLab Webhook
onboarding.tutorial.with.jenkins.webhook.intro.sentence=Create a Webhook in your repository to trigger the Jenkins job on push. Already have a Webhook configured? {link}
onboarding.tutorial.with.jenkins.webhook.intro.link=Skip this step.
onboarding.tutorial.with.jenkins.webhook.step1.sentence=Go to the {link} and enter the following information:
onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.link=Bitbucket Server Webhook creation page for your repository
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step1.link=Bitbucket Server Webhook creation page for your repository
onboarding.tutorial.with.jenkins.webhook.github.step1.link=GitHub Webhook creation page for your repository
onboarding.tutorial.with.jenkins.webhook.gitlab.step1.link=GitLab Webhook creation page for your repository
onboarding.tutorial.with.jenkins.webhook.step1.name.label=Name
@@ -3618,6 +3635,9 @@ onboarding.tutorial.with.jenkins.webhook.gitlab.step1.secret_token.label=Secret
onboarding.tutorial.with.jenkins.webhook.gitlab.step1.secret_token.action=Enter the generated token you wrote down in the previous step.
onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.sentence=Under {events}, make sure the following options are checked:
onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.sentence.events=Events
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.sentence=Under {triggers}, select {option} and make sure the following options are checked:
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.sentence.triggers=Triggers
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.sentence.option=Choose from a full list of triggers
onboarding.tutorial.with.jenkins.webhook.github.step2.sentence=Under {events} select {option} and check the following:
onboarding.tutorial.with.jenkins.webhook.github.step2.sentence.events=Which events would you like to trigger this webhook?
onboarding.tutorial.with.jenkins.webhook.github.step2.sentence.option=Let me select individual events
@@ -3627,12 +3647,18 @@ onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.repo.label=Repository
onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.repo.action=Push
onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.pr.label=Pull Request
onboarding.tutorial.with.jenkins.webhook.bitbucket.step2.pr.action=Opened
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.repo.label=Repository
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.repo.action=Push
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.pr.label=Pull Request
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step2.pr.action=Created
onboarding.tutorial.with.jenkins.webhook.github.step2.repo=Pushes
onboarding.tutorial.with.jenkins.webhook.github.step2.pr=Pull Requests
onboarding.tutorial.with.jenkins.webhook.gitlab.step2.repo=Push events
onboarding.tutorial.with.jenkins.webhook.gitlab.step2.mr=Merge request events
onboarding.tutorial.with.jenkins.webhook.step3.sentence=Click {create}.
onboarding.tutorial.with.jenkins.webhook.step3.sentence.create=Create
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step3.sentence=Click {save}.
onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step3.sentence.create=Save
onboarding.tutorial.with.jenkins.webhook.gitlab.step3.sentence=Click {add_webhook}.
onboarding.tutorial.with.jenkins.webhook.gitlab.step3.sentence.add_webhook=Add webhook
onboarding.tutorial.with.jenkins.jenkinsfile.title=Create a Jenkinsfile

Laden…
Annuleren
Opslaan