name="buildtool" | name="buildtool" | ||||
onCheck={value => setBuildTool(value as BuildToolsWithoutCFamily)} | onCheck={value => setBuildTool(value as BuildToolsWithoutCFamily)} | ||||
optionLabelKey="onboarding.build" | optionLabelKey="onboarding.build" | ||||
options={Object.values(BuildTools)} | |||||
options={Object.keys(BUILDTOOL_COMPONENT_MAP)} | |||||
/> | /> | ||||
</li> | </li> | ||||
{buildTool !== undefined && | {buildTool !== undefined && |
Array [ | Array [ | ||||
"maven", | "maven", | ||||
"gradle", | "gradle", | ||||
"cfamily", | |||||
"dotnet", | "dotnet", | ||||
"other", | "other", | ||||
] | ] | ||||
Array [ | Array [ | ||||
"maven", | "maven", | ||||
"gradle", | "gradle", | ||||
"cfamily", | |||||
"dotnet", | "dotnet", | ||||
"other", | "other", | ||||
] | ] | ||||
Array [ | Array [ | ||||
"maven", | "maven", | ||||
"gradle", | "gradle", | ||||
"cfamily", | |||||
"dotnet", | "dotnet", | ||||
"other", | "other", | ||||
] | ] | ||||
Array [ | Array [ | ||||
"maven", | "maven", | ||||
"gradle", | "gradle", | ||||
"cfamily", | |||||
"dotnet", | "dotnet", | ||||
"other", | "other", | ||||
] | ] | ||||
Array [ | Array [ | ||||
"maven", | "maven", | ||||
"gradle", | "gradle", | ||||
"cfamily", | |||||
"dotnet", | "dotnet", | ||||
"other", | "other", | ||||
] | ] | ||||
Array [ | Array [ | ||||
"maven", | "maven", | ||||
"gradle", | "gradle", | ||||
"cfamily", | |||||
"dotnet", | "dotnet", | ||||
"other", | "other", | ||||
] | ] |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
*/ | */ | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import HelpTooltip from 'sonar-ui-common/components/controls/HelpTooltip'; | |||||
import { Alert } from 'sonar-ui-common/components/ui/Alert'; | |||||
import CodeSnippet from '../../../common/CodeSnippet'; | |||||
import SentenceWithFilename from '../../components/SentenceWithFilename'; | |||||
import SentenceWithHighlights from '../../components/SentenceWithHighlights'; | |||||
import { translate } from 'sonar-ui-common/helpers/l10n'; | |||||
import RenderOptions from '../../components/RenderOptions'; | |||||
import { OSs } from '../../types'; | |||||
import DotNetCore from './DotNetCore'; | |||||
import DotNetFramework from './DotNetFramework'; | |||||
export interface DotNetProps { | export interface DotNetProps { | ||||
component: T.Component; | component: T.Component; | ||||
} | } | ||||
const jenkinsfileSnippet = (key: string) => `node { | |||||
stage('SCM') { | |||||
checkout scm | |||||
} | |||||
stage('SonarQube Analysis') { | |||||
def msbuildHome = tool 'Default MSBuild' | |||||
def scannerHome = tool 'SonarScanner for MSBuild' | |||||
withSonarQubeEnv() { | |||||
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\"" | |||||
bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild" | |||||
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end" | |||||
} | |||||
} | |||||
export interface DotNetCoreFrameworkProps { | |||||
component: T.Component; | |||||
os: OSDotNet; | |||||
} | } | ||||
`; | |||||
export type OSDotNet = OSs.Linux | OSs.Windows; | |||||
const DotNetFlavor = { win_core: DotNetCore, win_msbuild: DotNetFramework, linux_core: DotNetCore }; | |||||
const DotOS: { [key in keyof typeof DotNetFlavor]: OSDotNet } = { | |||||
win_core: OSs.Windows, | |||||
win_msbuild: OSs.Windows, | |||||
linux_core: OSs.Linux | |||||
}; | |||||
export default function DotNet({ component }: DotNetProps) { | export default function DotNet({ component }: DotNetProps) { | ||||
const [flavorComponent, setFlavorComponet] = React.useState<keyof typeof DotNetFlavor>(); | |||||
const DotNetTutorial = flavorComponent && DotNetFlavor[flavorComponent]; | |||||
return ( | return ( | ||||
<li className="abs-width-600"> | |||||
<SentenceWithFilename | |||||
filename="Jenkinsfile" | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step" | |||||
/> | |||||
<Alert className="spacer-top" variant="info"> | |||||
<p className="text-middle"> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['default_msbuild', 'default_scanner', 'in_jenkins']} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace" | |||||
/> | |||||
<HelpTooltip | |||||
className="little-spacer-left" | |||||
overlay={ | |||||
<> | |||||
<p className="spacer-bottom"> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['path']} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1" | |||||
/> | |||||
</p> | |||||
<p className="spacer-bottom"> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['path', 'name']} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2" | |||||
/> | |||||
</p> | |||||
<p> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['path', 'name']} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3" | |||||
/> | |||||
</p> | |||||
</> | |||||
} | |||||
/> | |||||
</p> | |||||
</Alert> | |||||
<CodeSnippet snippet={jenkinsfileSnippet(component.key)} /> | |||||
</li> | |||||
<> | |||||
<li> | |||||
{translate('onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent')} | |||||
<RenderOptions | |||||
checked={flavorComponent} | |||||
name="flavorComponent" | |||||
optionLabelKey="onboarding.build.dotnet" | |||||
onCheck={value => setFlavorComponet(value as keyof typeof DotNetFlavor)} | |||||
options={Object.keys(DotNetFlavor)} | |||||
/> | |||||
</li> | |||||
{DotNetTutorial && flavorComponent && ( | |||||
<DotNetTutorial component={component} os={DotOS[flavorComponent]} /> | |||||
)} | |||||
</> | |||||
); | ); | ||||
} | } |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import * as React from 'react'; | |||||
import CodeSnippet from '../../../common/CodeSnippet'; | |||||
import SentenceWithFilename from '../../components/SentenceWithFilename'; | |||||
import { OSs } from '../../types'; | |||||
import { DotNetCoreFrameworkProps, OSDotNet } from './DotNet'; | |||||
import DotNetPrereqsScanner from './DotNetPrereqsScanner'; | |||||
const OSS_DEP: { [key in OSDotNet]: { shell: string; pathSeparator: string } } = { | |||||
[OSs.Linux]: { shell: 'sh', pathSeparator: '/' }, | |||||
[OSs.Windows]: { shell: 'bat', pathSeparator: '\\\\' } | |||||
}; | |||||
const jenkinsfileSnippet = (key: string, shell: OSDotNet) => `node { | |||||
stage('SCM') { | |||||
checkout scm | |||||
} | |||||
stage('SonarQube Analysis') { | |||||
def scannerHome = tool 'SonarScanner for MSBuild' | |||||
withSonarQubeEnv() { | |||||
${OSS_DEP[shell].shell} "dotnet \${scannerHome}${OSS_DEP[shell].pathSeparator}SonarScanner.MSBuild.dll begin /k:\\"${key}\\"" | |||||
${OSS_DEP[shell].shell} "dotnet build" | |||||
${OSS_DEP[shell].shell} "dotnet \${scannerHome}${OSS_DEP[shell].pathSeparator}SonarScanner.MSBuild.dll end" | |||||
} | |||||
} | |||||
} | |||||
`; | |||||
export default function DotNetCore({ component, os }: DotNetCoreFrameworkProps) { | |||||
return ( | |||||
<> | |||||
<DotNetPrereqsScanner /> | |||||
<li className="abs-width-600"> | |||||
<SentenceWithFilename | |||||
filename="Jenkinsfile" | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step" | |||||
/> | |||||
<CodeSnippet snippet={jenkinsfileSnippet(component.key, os)} /> | |||||
</li> | |||||
</> | |||||
); | |||||
} |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import * as React from 'react'; | |||||
import CodeSnippet from '../../../common/CodeSnippet'; | |||||
import SentenceWithFilename from '../../components/SentenceWithFilename'; | |||||
import { DotNetCoreFrameworkProps } from './DotNet'; | |||||
import DotNetPrereqsMSBuild from './DotNetPrereqsMSBuild'; | |||||
import DotNetPrereqsScanner from './DotNetPrereqsScanner'; | |||||
const jenkinsfileSnippet = (key: string) => `node { | |||||
stage('SCM') { | |||||
checkout scm | |||||
} | |||||
stage('SonarQube Analysis') { | |||||
def msbuildHome = tool 'Default MSBuild' | |||||
def scannerHome = tool 'SonarScanner for MSBuild' | |||||
withSonarQubeEnv() { | |||||
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" begin /k:\\"${key}\\"" | |||||
bat "\\"\${msbuildHome}\\\\MSBuild.exe\\" /t:Rebuild" | |||||
bat "\\"\${scannerHome}\\\\SonarScanner.MSBuild.exe\\" end" | |||||
} | |||||
} | |||||
} | |||||
`; | |||||
export default function DotNetFramework({ component }: DotNetCoreFrameworkProps) { | |||||
return ( | |||||
<> | |||||
<DotNetPrereqsScanner /> | |||||
<DotNetPrereqsMSBuild /> | |||||
<li className="abs-width-600"> | |||||
<SentenceWithFilename | |||||
filename="Jenkinsfile" | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step" | |||||
/> | |||||
<CodeSnippet snippet={jenkinsfileSnippet(component.key)} /> | |||||
</li> | |||||
</> | |||||
); | |||||
} |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import * as React from 'react'; | |||||
import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; | |||||
import { Alert } from 'sonar-ui-common/components/ui/Alert'; | |||||
import { translate } from 'sonar-ui-common/helpers/l10n'; | |||||
import SentenceWithHighlights from '../../components/SentenceWithHighlights'; | |||||
export default function DotNetPrereqsMSBuild() { | |||||
return ( | |||||
<li className="abs-width-600"> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['default_msbuild']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title" | |||||
/> | |||||
<Alert className="spacer-top" variant="info"> | |||||
{translate('onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info')} | |||||
</Alert> | |||||
<ul className="list-styled"> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['msbuild']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['path']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['msbuild', 'add_msbuild', 'name', 'msbuild_plugin']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3" | |||||
/> | |||||
<code className="rule">Default MSBuild</code> | |||||
<ClipboardIconButton copyValue="Default MSBuild" /> | |||||
</li> | |||||
</ul> | |||||
</li> | |||||
); | |||||
} |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import * as React from 'react'; | |||||
import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard'; | |||||
import { Alert } from 'sonar-ui-common/components/ui/Alert'; | |||||
import { translate } from 'sonar-ui-common/helpers/l10n'; | |||||
import SentenceWithHighlights from '../../components/SentenceWithHighlights'; | |||||
export default function DotNetPrereqsScanner() { | |||||
return ( | |||||
<li className="abs-width-600"> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['default_scanner']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title" | |||||
/> | |||||
<Alert className="spacer-top" variant="info"> | |||||
{translate('onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info')} | |||||
</Alert> | |||||
<ul className="list-styled"> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['path']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['default_scanner', 'add_scanner_for_msbuild']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['name']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3" | |||||
/> | |||||
<code className="rule">SonarScanner for MSBuild</code> | |||||
<ClipboardIconButton copyValue="SonarScanner for MSBuild" /> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={['install_from']} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5" | |||||
/> | |||||
</li> | |||||
</ul> | |||||
</li> | |||||
); | |||||
} |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import { shallow } from 'enzyme'; | |||||
import * as React from 'react'; | |||||
import { mockComponent } from '../../../../../helpers/testMocks'; | |||||
import { OSs } from '../../../types'; | |||||
import { DotNetCoreFrameworkProps } from '../DotNet'; | |||||
import DotNetCore from '../DotNetCore'; | |||||
it('should render correctly', () => { | |||||
expect(shallowRender()).toMatchSnapshot('win'); | |||||
expect(shallowRender({ os: OSs.Linux })).toMatchSnapshot('linux'); | |||||
}); | |||||
function shallowRender(props: Partial<DotNetCoreFrameworkProps> = {}) { | |||||
return shallow<DotNetCoreFrameworkProps>( | |||||
<DotNetCore component={mockComponent()} os={OSs.Windows} {...props} /> | |||||
); | |||||
} |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import { shallow } from 'enzyme'; | |||||
import * as React from 'react'; | |||||
import { mockComponent } from '../../../../../helpers/testMocks'; | |||||
import { OSs } from '../../../types'; | |||||
import { DotNetCoreFrameworkProps } from '../DotNet'; | |||||
import DotNetFramework from '../DotNetFramework'; | |||||
it('should render correctly', () => { | |||||
expect(shallowRender()).toMatchSnapshot(); | |||||
}); | |||||
function shallowRender(props: Partial<DotNetCoreFrameworkProps> = {}) { | |||||
return shallow<DotNetCoreFrameworkProps>( | |||||
<DotNetFramework component={mockComponent()} os={OSs.Windows} {...props} /> | |||||
); | |||||
} |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import { shallow } from 'enzyme'; | |||||
import * as React from 'react'; | |||||
import DotNetPrereqsMSBuild from '../DotNetPrereqsMSBuild'; | |||||
it('should render correctly', () => { | |||||
expect(shallowRender()).toMatchSnapshot(); | |||||
}); | |||||
function shallowRender() { | |||||
return shallow(<DotNetPrereqsMSBuild />); | |||||
} |
/* | |||||
* SonarQube | |||||
* Copyright (C) 2009-2021 SonarSource SA | |||||
* mailto:info AT sonarsource DOT com | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU Lesser General Public | |||||
* License as published by the Free Software Foundation; either | |||||
* version 3 of the License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||||
* Lesser General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Lesser General Public License | |||||
* along with this program; if not, write to the Free Software Foundation, | |||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
*/ | |||||
import { shallow } from 'enzyme'; | |||||
import * as React from 'react'; | |||||
import DotNetPrereqsScanner from '../DotNetPrereqsScanner'; | |||||
it('should render correctly', () => { | |||||
expect(shallowRender()).toMatchSnapshot(); | |||||
}); | |||||
function shallowRender() { | |||||
return shallow(<DotNetPrereqsScanner />); | |||||
} |
// Jest Snapshot v1, https://goo.gl/fbAQLP | // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
exports[`should render correctly 1`] = ` | exports[`should render correctly 1`] = ` | ||||
<li | |||||
className="abs-width-600" | |||||
> | |||||
<SentenceWithFilename | |||||
filename="Jenkinsfile" | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step" | |||||
/> | |||||
<Alert | |||||
className="spacer-top" | |||||
variant="info" | |||||
> | |||||
<p | |||||
className="text-middle" | |||||
> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"default_msbuild", | |||||
"default_scanner", | |||||
"in_jenkins", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace" | |||||
/> | |||||
<HelpTooltip | |||||
className="little-spacer-left" | |||||
overlay={ | |||||
<React.Fragment> | |||||
<p | |||||
className="spacer-bottom" | |||||
> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"path", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1" | |||||
/> | |||||
</p> | |||||
<p | |||||
className="spacer-bottom" | |||||
> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"path", | |||||
"name", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2" | |||||
/> | |||||
</p> | |||||
<p> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"path", | |||||
"name", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3" | |||||
/> | |||||
</p> | |||||
</React.Fragment> | |||||
} | |||||
/> | |||||
</p> | |||||
</Alert> | |||||
<CodeSnippet | |||||
snippet="node { | |||||
stage('SCM') { | |||||
checkout scm | |||||
} | |||||
stage('SonarQube Analysis') { | |||||
def msbuildHome = tool 'Default MSBuild' | |||||
def scannerHome = tool 'SonarScanner for MSBuild' | |||||
withSonarQubeEnv() { | |||||
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" begin /k:\\\\\\"my-project\\\\\\"\\" | |||||
bat \\"\\\\\\"\${msbuildHome}\\\\\\\\MSBuild.exe\\\\\\" /t:Rebuild\\" | |||||
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" end\\" | |||||
} | |||||
} | |||||
} | |||||
" | |||||
/> | |||||
</li> | |||||
<Fragment> | |||||
<li> | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent | |||||
<RenderOptions | |||||
name="flavorComponent" | |||||
onCheck={[Function]} | |||||
optionLabelKey="onboarding.build.dotnet" | |||||
options={ | |||||
Array [ | |||||
"win_core", | |||||
"win_msbuild", | |||||
"linux_core", | |||||
] | |||||
} | |||||
/> | |||||
</li> | |||||
</Fragment> | |||||
`; | `; |
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||||
exports[`should render correctly: linux 1`] = ` | |||||
<Fragment> | |||||
<DotNetPrereqsScanner /> | |||||
<li | |||||
className="abs-width-600" | |||||
> | |||||
<SentenceWithFilename | |||||
filename="Jenkinsfile" | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step" | |||||
/> | |||||
<CodeSnippet | |||||
snippet="node { | |||||
stage('SCM') { | |||||
checkout scm | |||||
} | |||||
stage('SonarQube Analysis') { | |||||
def scannerHome = tool 'SonarScanner for MSBuild' | |||||
withSonarQubeEnv() { | |||||
sh \\"dotnet \${scannerHome}/SonarScanner.MSBuild.dll begin /k:\\\\\\"my-project\\\\\\"\\" | |||||
sh \\"dotnet build\\" | |||||
sh \\"dotnet \${scannerHome}/SonarScanner.MSBuild.dll end\\" | |||||
} | |||||
} | |||||
} | |||||
" | |||||
/> | |||||
</li> | |||||
</Fragment> | |||||
`; | |||||
exports[`should render correctly: win 1`] = ` | |||||
<Fragment> | |||||
<DotNetPrereqsScanner /> | |||||
<li | |||||
className="abs-width-600" | |||||
> | |||||
<SentenceWithFilename | |||||
filename="Jenkinsfile" | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step" | |||||
/> | |||||
<CodeSnippet | |||||
snippet="node { | |||||
stage('SCM') { | |||||
checkout scm | |||||
} | |||||
stage('SonarQube Analysis') { | |||||
def scannerHome = tool 'SonarScanner for MSBuild' | |||||
withSonarQubeEnv() { | |||||
bat \\"dotnet \${scannerHome}\\\\\\\\SonarScanner.MSBuild.dll begin /k:\\\\\\"my-project\\\\\\"\\" | |||||
bat \\"dotnet build\\" | |||||
bat \\"dotnet \${scannerHome}\\\\\\\\SonarScanner.MSBuild.dll end\\" | |||||
} | |||||
} | |||||
} | |||||
" | |||||
/> | |||||
</li> | |||||
</Fragment> | |||||
`; |
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||||
exports[`should render correctly 1`] = ` | |||||
<Fragment> | |||||
<DotNetPrereqsScanner /> | |||||
<DotNetPrereqsMSBuild /> | |||||
<li | |||||
className="abs-width-600" | |||||
> | |||||
<SentenceWithFilename | |||||
filename="Jenkinsfile" | |||||
translationKey="onboarding.tutorial.with.jenkins.jenkinsfile.jenkinsfile_step" | |||||
/> | |||||
<CodeSnippet | |||||
snippet="node { | |||||
stage('SCM') { | |||||
checkout scm | |||||
} | |||||
stage('SonarQube Analysis') { | |||||
def msbuildHome = tool 'Default MSBuild' | |||||
def scannerHome = tool 'SonarScanner for MSBuild' | |||||
withSonarQubeEnv() { | |||||
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" begin /k:\\\\\\"my-project\\\\\\"\\" | |||||
bat \\"\\\\\\"\${msbuildHome}\\\\\\\\MSBuild.exe\\\\\\" /t:Rebuild\\" | |||||
bat \\"\\\\\\"\${scannerHome}\\\\\\\\SonarScanner.MSBuild.exe\\\\\\" end\\" | |||||
} | |||||
} | |||||
} | |||||
" | |||||
/> | |||||
</li> | |||||
</Fragment> | |||||
`; |
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||||
exports[`should render correctly 1`] = ` | |||||
<li | |||||
className="abs-width-600" | |||||
> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"default_msbuild", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title" | |||||
/> | |||||
<Alert | |||||
className="spacer-top" | |||||
variant="info" | |||||
> | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info | |||||
</Alert> | |||||
<ul | |||||
className="list-styled" | |||||
> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"msbuild", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"path", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"msbuild", | |||||
"add_msbuild", | |||||
"name", | |||||
"msbuild_plugin", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3" | |||||
/> | |||||
<code | |||||
className="rule" | |||||
> | |||||
Default MSBuild | |||||
</code> | |||||
<ClipboardIconButton | |||||
copyValue="Default MSBuild" | |||||
/> | |||||
</li> | |||||
</ul> | |||||
</li> | |||||
`; |
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||||
exports[`should render correctly 1`] = ` | |||||
<li | |||||
className="abs-width-600" | |||||
> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"default_scanner", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title" | |||||
/> | |||||
<Alert | |||||
className="spacer-top" | |||||
variant="info" | |||||
> | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info | |||||
</Alert> | |||||
<ul | |||||
className="list-styled" | |||||
> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"path", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"default_scanner", | |||||
"add_scanner_for_msbuild", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"name", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3" | |||||
/> | |||||
<code | |||||
className="rule" | |||||
> | |||||
SonarScanner for MSBuild | |||||
</code> | |||||
<ClipboardIconButton | |||||
copyValue="SonarScanner for MSBuild" | |||||
/> | |||||
</li> | |||||
<li> | |||||
<SentenceWithHighlights | |||||
highlightKeys={ | |||||
Array [ | |||||
"install_from", | |||||
] | |||||
} | |||||
translationKey="onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5" | |||||
/> | |||||
</li> | |||||
</ul> | |||||
</li> | |||||
`; |
import Other, { OtherProps } from '../Other'; | import Other, { OtherProps } from '../Other'; | ||||
it('renders correctly', () => { | it('renders correctly', () => { | ||||
expect(shallowRender()).toMatchSnapshot('linux'); | |||||
expect(shallowRender({ os: OSs.Windows })).toMatchSnapshot('windows'); | |||||
expect(shallowRender({ os: OSs.MacOS })).toMatchSnapshot('macos'); | |||||
expect(shallowRender()).toMatchSnapshot(); | |||||
}); | }); | ||||
function shallowRender(props: Partial<OtherProps> = {}) { | function shallowRender(props: Partial<OtherProps> = {}) { |
// Jest Snapshot v1, https://goo.gl/fbAQLP | // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
exports[`renders correctly: linux 1`] = ` | |||||
exports[`renders correctly 1`] = ` | |||||
<div> | <div> | ||||
<SQScanner | <SQScanner | ||||
os="linux" | os="linux" | ||||
/> | /> | ||||
</div> | </div> | ||||
`; | `; | ||||
exports[`renders correctly: macos 1`] = ` | |||||
<div> | |||||
<SQScanner | |||||
os="mac" | |||||
/> | |||||
<ExecScanner | |||||
host="host" | |||||
os="mac" | |||||
projectKey="projectKey" | |||||
token="token" | |||||
/> | |||||
</div> | |||||
`; | |||||
exports[`renders correctly: windows 1`] = ` | |||||
<div> | |||||
<SQScanner | |||||
os="win" | |||||
/> | |||||
<ExecScanner | |||||
host="host" | |||||
os="win" | |||||
projectKey="projectKey" | |||||
token="token" | |||||
/> | |||||
</div> | |||||
`; |
onboarding.build.gradle=Gradle | onboarding.build.gradle=Gradle | ||||
onboarding.build.make=Make | onboarding.build.make=Make | ||||
onboarding.build.dotnet=.NET | onboarding.build.dotnet=.NET | ||||
onboarding.build.dotnet.win_core=Windows + .NET Core | |||||
onboarding.build.dotnet.win_msbuild=Windows + .NET Framework | |||||
onboarding.build.dotnet.linux_core=Linux + .NET Core | |||||
onboarding.build.cfamily=C,C++ or ObjC | onboarding.build.cfamily=C,C++ or ObjC | ||||
onboarding.build.other=Other (for JS, TS, Go, Python, PHP, ...) | onboarding.build.other=Other (for JS, TS, Go, Python, PHP, ...) | ||||
onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.path=Maven > Maven installations | onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.path=Maven > Maven installations | ||||
onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.name=Name | onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3.help2.sentence.name=Name | ||||
onboarding.tutorial.with.jenkins.jenkinsfile.gradle.step2.sentence=Add the following to your {file} file: | onboarding.tutorial.with.jenkins.jenkinsfile.gradle.step2.sentence=Add the following to your {file} file: | ||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence=Make sure to replace {default_msbuild} and {default_scanner} with the names you gave to your MSBuild and SonarScanner for MSBuild tools {in_jenkins}. | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_msbuild=Default MSBuild | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.default_scanner=SonarScanner for MSBuild | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.replace.sentence.in_jenkins=in Jenkins | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence=To get the name of these tools in Jenkins, navigate to {path}. | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help1.sentence.path=Manage Jenkins > Global Tool Configuration | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence=For your MSBuild tool, the name is located under the {path} section, in the {name} field. | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.path=MSBuild > MSBuild installations | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help2.sentence.name=Name | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence=For your SonarScanner for MSBuild tool, the name is located under the {path} section, in the {name} field. | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.path=SonarScanner for MSBuild > SonarScanner for MSBuild installations | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.step2.help3.sentence.name=Name | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent=Choose your build agent. | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title.sentence=Prerequisite: Add a {default_msbuild} tool | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.title.sentence.default_msbuild=MSBuild | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.info=This step need to be done only once per jenkins instance. | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1.sentence=In Jenkins, make sure to have the {msbuild} installed. | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step1.sentence.msbuild=MSBuild Plugin | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2.sentence=Navigate to {path}. | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step2.sentence.path=Manage Jenkins > Global Tool Configuration | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence=Under {msbuild} click on {add_msbuild} and give a {name} that will be used in the last step. Refer to the {msbuild_plugin} documentation on how to install the tool: | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.msbuild=MSBuild | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.msbuild_plugin=MSBuild Plugin | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.add_msbuild=Add MSBuild | |||||
onboarding.tutorial.with.jenkins.dotnet.msbuild.prereqs.step3.sentence.name=Name | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title.sentence=Prerequisite: Add a {default_scanner} tool | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.title.sentence.default_scanner=SonarScanner for MSBuild | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.info=This step needs to be done only once per jenkins instance or if you need different scanner versions. | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1.sentence=In Jenkins, navigate to {path}. | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step1.sentence.path=Manage Jenkins > Global Tool Configuration | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence=Under {default_scanner} click on {add_scanner_for_msbuild} | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence.default_scanner=SonarScanner for MSBuild | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step2.sentence.add_scanner_for_msbuild=Add SonarScanner for MSBuild | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3.sentence=Choose a {name} that will be used in the last step: | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step3.sentence.name=Name | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step4.sentence=Check {install_auto} | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step4.sentence.install_auto=Install automatically | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence=Under {install_from} select the corresponding .NET Core scanner required for you project. | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence.install_from=Install from GitHub | |||||
onboarding.tutorial.with.jenkins.dotnet.scanner.prereqs.step5.sentence.install_auto=Install automatically | |||||
onboarding.tutorial.with.jenkins.jenkinsfile.other.step2.sentence=Create a {file} file in your repository and paste the following code: | onboarding.tutorial.with.jenkins.jenkinsfile.other.step2.sentence=Create a {file} file in your repository and paste the following code: | ||||
onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence=Make sure to replace {default} with the name you gave to your SonarQube Scanner tool {in_jenkins}. | onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence=Make sure to replace {default} with the name you gave to your SonarQube Scanner tool {in_jenkins}. | ||||
onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence.default=SonarScanner | onboarding.tutorial.with.jenkins.jenkinsfile.other.step3.replace.sentence.default=SonarScanner |