]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14353 GitlabCI tutorial for CE
authorJeremy Davis <jeremy.davis@sonarsource.com>
Tue, 26 Jan 2021 17:42:02 +0000 (18:42 +0100)
committersonartech <sonartech@sonarsource.com>
Thu, 4 Feb 2021 20:07:06 +0000 (20:07 +0000)
17 files changed:
server/sonar-web/src/main/js/components/tutorials/gitlabci/YmlFileStep.tsx
server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/YmlFileStep-test.tsx
server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/__snapshots__/GitLabCITutorial-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/__snapshots__/YmlFileStep-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandGradle.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandMaven.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandOther.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandGradle-test.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandMaven-test.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandOther-test.tsx [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommand-test.tsx.snap [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandGradle-test.tsx.snap [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandMaven-test.tsx.snap [deleted file]
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandOther-test.tsx.snap [deleted file]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 1dec8870dc10203ad3bc7c0d473038de15ab5496..cb4126ee72e7f91137ab855fea7cc3e2b55cb74b 100644 (file)
@@ -22,18 +22,18 @@ import { FormattedMessage } from 'react-intl';
 import { Link } from 'react-router';
 import { ClipboardIconButton } from 'sonar-ui-common/components/controls/clipboard';
 import { translate } from 'sonar-ui-common/helpers/l10n';
+import { withAppState } from '../../hoc/withAppState';
 import Step from '../components/Step';
-import PipeCommandGradle from './commands/PipeCommandGradle';
-import PipeCommandMaven from './commands/PipeCommandMaven';
-import PipeCommandOther from './commands/PipeCommandOther';
+import PipeCommand from './commands/PipeCommand';
 import { BuildTools } from './types';
 
 export interface YmlFileStepProps {
+  appState: T.AppState;
   buildTool?: BuildTools;
   open: boolean;
 }
 
-export default function YmlFileStep({ buildTool, open }: YmlFileStepProps) {
+export function YmlFileStep({ appState: { branchesEnabled }, buildTool, open }: YmlFileStepProps) {
   const renderForm = () => (
     <div className="boxed-group-inner">
       <div className="flex-columns">
@@ -61,13 +61,13 @@ export default function YmlFileStep({ buildTool, open }: YmlFileStepProps) {
               </div>
 
               <div className="big-spacer-bottom">
-                {buildTool === BuildTools.Maven && <PipeCommandMaven />}
-                {buildTool === BuildTools.Gradle && <PipeCommandGradle />}
-                {buildTool === BuildTools.Other && <PipeCommandOther />}
+                <PipeCommand buildTool={buildTool} branchesEnabled={branchesEnabled} />
               </div>
 
               <p className="little-spacer-bottom">
-                {translate('onboarding.tutorial.with.gitlab_ci.yml.baseconfig')}
+                {branchesEnabled
+                  ? translate('onboarding.tutorial.with.gitlab_ci.yml.baseconfig')
+                  : translate('onboarding.tutorial.with.gitlab_ci.yml.baseconfig.no_branches')}
               </p>
 
               <p className="huge-spacer-bottom">
@@ -134,3 +134,5 @@ export default function YmlFileStep({ buildTool, open }: YmlFileStepProps) {
     />
   );
 }
+
+export default withAppState(YmlFileStep);
index afa0332d886a347dadf858fd3459291131dc57bb..6d24ad7873eb1f93680e3f4e44eb4d275d4d70ae 100644 (file)
  */
 import { shallow } from 'enzyme';
 import * as React from 'react';
+import { mockAppState } from '../../../../helpers/testMocks';
 import { renderStepContent } from '../../jenkins/test-utils';
 import { BuildTools } from '../types';
-import YmlFileStep, { YmlFileStepProps } from '../YmlFileStep';
+import { YmlFileStep, YmlFileStepProps } from '../YmlFileStep';
 
 it('should render correctly', () => {
   const wrapper = shallowRender();
@@ -37,5 +38,7 @@ it.each([[BuildTools.Maven], [BuildTools.Gradle], [BuildTools.Other]])(
 );
 
 function shallowRender(props: Partial<YmlFileStepProps> = {}) {
-  return shallow<YmlFileStepProps>(<YmlFileStep open={true} {...props} />);
+  return shallow<YmlFileStepProps>(
+    <YmlFileStep appState={mockAppState({ branchesEnabled: true })} open={true} {...props} />
+  );
 }
index 2f3e5aa150aa4f9f992f82fbae419e80ab4263cd..00c4ef25f2c15df57c91b84a63d5bc0a3ffe87c3 100644 (file)
@@ -77,7 +77,7 @@ exports[`should render correctly 1`] = `
     onOpen={[Function]}
     open={false}
   />
-  <YmlFileStep
+  <Connect(withAppState(YmlFileStep))
     open={false}
   />
 </Fragment>
index 95bf2abb6e3f8f74cfb7067b3edfc7e5e036ad37..2fed2d0975bb347ba8079c31f69b892f23962eae 100644 (file)
@@ -37,7 +37,10 @@ exports[`should render correctly for build tool gradle 1`] = `
         <div
           className="big-spacer-bottom"
         >
-          <PipeCommandGradle />
+          <PipeCommand
+            branchesEnabled={true}
+            buildTool="gradle"
+          />
         </div>
         <p
           className="little-spacer-bottom"
@@ -145,7 +148,10 @@ exports[`should render correctly for build tool maven 1`] = `
         <div
           className="big-spacer-bottom"
         >
-          <PipeCommandMaven />
+          <PipeCommand
+            branchesEnabled={true}
+            buildTool="maven"
+          />
         </div>
         <p
           className="little-spacer-bottom"
@@ -253,7 +259,10 @@ exports[`should render correctly for build tool other 1`] = `
         <div
           className="big-spacer-bottom"
         >
-          <PipeCommandOther />
+          <PipeCommand
+            branchesEnabled={true}
+            buildTool="other"
+          />
         </div>
         <p
           className="little-spacer-bottom"
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx
new file mode 100644 (file)
index 0000000..e3b1466
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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 { BuildTools } from '../types';
+
+export interface PipeCommandProps {
+  branchesEnabled?: boolean;
+  buildTool: BuildTools;
+}
+
+const BUILD_TOOL_SPECIFIC = {
+  [BuildTools.Gradle]: { image: 'gradle:jre11-slim', script: 'gradle sonarqube' },
+  [BuildTools.Maven]: {
+    image: 'maven:3.6.3-jdk-11',
+    script: `
+    - mvn verify sonar:sonar`
+  },
+  [BuildTools.Other]: {
+    image: `
+    name: sonarsource/sonar-scanner-cli:latest
+    entrypoint: [""]`,
+    script: `
+    - sonar-scanner`
+  }
+};
+
+export default function PipeCommand({ branchesEnabled, buildTool }: PipeCommandProps) {
+  const onlyBlock = branchesEnabled
+    ? `- merge_requests
+    - master
+    - develop`
+    : '- master # or the name of your main branch';
+
+  const { image, script } = BUILD_TOOL_SPECIFIC[buildTool];
+
+  const command = `sonarqube-check:
+  image: ${image}
+  variables:
+    SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
+    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
+  cache:
+    key: "\${CI_JOB_NAME}"
+    paths:
+      - .sonar/cache
+  script: ${script}
+  allow_failure: true
+  only:
+    ${onlyBlock}
+`;
+
+  return <CodeSnippet snippet={command} />;
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandGradle.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandGradle.tsx
deleted file mode 100644 (file)
index 6454875..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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';
-
-export default function PipeCommandGradle() {
-  const command = `sonarqube-check:
-  image: gradle:jre11-slim
-  variables:
-    SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
-    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
-  cache:
-    key: "\${CI_JOB_NAME}"
-    paths:
-      - .sonar/cache
-  script: gradle sonarqube
-  allow_failure: true
-  only:
-    - merge_requests
-    - master
-    - develop
-`;
-
-  return <CodeSnippet snippet={command} />;
-}
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandMaven.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandMaven.tsx
deleted file mode 100644 (file)
index 875a71c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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';
-
-export default function PipeCommandMaven() {
-  const command = `sonarqube-check:
-  image: maven:3.6.3-jdk-11
-  variables:
-    SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
-    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
-  cache:
-    key: "\${CI_JOB_NAME}"
-    paths:
-      - .sonar/cache
-  script:
-    - mvn verify sonar:sonar
-  allow_failure: true
-  only:
-    - merge_requests
-    - master
-    - develop
-`;
-
-  return <CodeSnippet snippet={command} />;
-}
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandOther.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommandOther.tsx
deleted file mode 100644 (file)
index 66b8954..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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';
-
-export default function PipeCommandOther() {
-  const command = `sonarqube-check:
-  image:
-    name: sonarsource/sonar-scanner-cli:latest
-    entrypoint: [""]
-  variables:
-    SONAR_USER_HOME: "\${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
-    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
-  cache:
-    key: "\${CI_JOB_NAME}"
-    paths:
-      - .sonar/cache
-  script:
-    - sonar-scanner
-  allow_failure: true
-  only:
-    - merge_requests
-    - master
-    - develop
-`;
-
-  return <CodeSnippet snippet={command} />;
-}
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx
new file mode 100644 (file)
index 0000000..8e2c936
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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 { BuildTools } from '../../types';
+import PipeCommand from '../PipeCommand';
+
+it.each([[BuildTools.Gradle], [BuildTools.Maven], [BuildTools.Other]])(
+  'should render correctly for %s',
+  buildTool => {
+    expect(shallow(<PipeCommand buildTool={buildTool} branchesEnabled={true} />)).toMatchSnapshot(
+      'branches enabled'
+    );
+    expect(shallow(<PipeCommand buildTool={buildTool} branchesEnabled={true} />)).toMatchSnapshot(
+      'branches not enabled'
+    );
+  }
+);
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandGradle-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandGradle-test.tsx
deleted file mode 100644 (file)
index f259f1a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 PipeCommandGradle from '../PipeCommandGradle';
-
-it('should render correctly', () => {
-  expect(shallow(<PipeCommandGradle />)).toMatchSnapshot();
-});
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandMaven-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandMaven-test.tsx
deleted file mode 100644 (file)
index 2e5c109..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 PipeCommandMaven from '../PipeCommandMaven';
-
-it('should render correctly', () => {
-  expect(shallow(<PipeCommandMaven />)).toMatchSnapshot();
-});
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandOther-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommandOther-test.tsx
deleted file mode 100644 (file)
index d1ad81b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 PipeCommandOther from '../PipeCommandOther';
-
-it('should render correctly', () => {
-  expect(shallow(<PipeCommandOther />)).toMatchSnapshot();
-});
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommand-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommand-test.tsx.snap
new file mode 100644 (file)
index 0000000..019eef7
--- /dev/null
@@ -0,0 +1,135 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly for gradle: branches enabled 1`] = `
+<CodeSnippet
+  snippet="sonarqube-check:
+  image: gradle:jre11-slim
+  variables:
+    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
+    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
+  cache:
+    key: \\"\${CI_JOB_NAME}\\"
+    paths:
+      - .sonar/cache
+  script: gradle sonarqube
+  allow_failure: true
+  only:
+    - merge_requests
+    - master
+    - develop
+"
+/>
+`;
+
+exports[`should render correctly for gradle: branches not enabled 1`] = `
+<CodeSnippet
+  snippet="sonarqube-check:
+  image: gradle:jre11-slim
+  variables:
+    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
+    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
+  cache:
+    key: \\"\${CI_JOB_NAME}\\"
+    paths:
+      - .sonar/cache
+  script: gradle sonarqube
+  allow_failure: true
+  only:
+    - merge_requests
+    - master
+    - develop
+"
+/>
+`;
+
+exports[`should render correctly for maven: branches enabled 1`] = `
+<CodeSnippet
+  snippet="sonarqube-check:
+  image: maven:3.6.3-jdk-11
+  variables:
+    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
+    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
+  cache:
+    key: \\"\${CI_JOB_NAME}\\"
+    paths:
+      - .sonar/cache
+  script: 
+    - mvn verify sonar:sonar
+  allow_failure: true
+  only:
+    - merge_requests
+    - master
+    - develop
+"
+/>
+`;
+
+exports[`should render correctly for maven: branches not enabled 1`] = `
+<CodeSnippet
+  snippet="sonarqube-check:
+  image: maven:3.6.3-jdk-11
+  variables:
+    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
+    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
+  cache:
+    key: \\"\${CI_JOB_NAME}\\"
+    paths:
+      - .sonar/cache
+  script: 
+    - mvn verify sonar:sonar
+  allow_failure: true
+  only:
+    - merge_requests
+    - master
+    - develop
+"
+/>
+`;
+
+exports[`should render correctly for other: branches enabled 1`] = `
+<CodeSnippet
+  snippet="sonarqube-check:
+  image: 
+    name: sonarsource/sonar-scanner-cli:latest
+    entrypoint: [\\"\\"]
+  variables:
+    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
+    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
+  cache:
+    key: \\"\${CI_JOB_NAME}\\"
+    paths:
+      - .sonar/cache
+  script: 
+    - sonar-scanner
+  allow_failure: true
+  only:
+    - merge_requests
+    - master
+    - develop
+"
+/>
+`;
+
+exports[`should render correctly for other: branches not enabled 1`] = `
+<CodeSnippet
+  snippet="sonarqube-check:
+  image: 
+    name: sonarsource/sonar-scanner-cli:latest
+    entrypoint: [\\"\\"]
+  variables:
+    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
+    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
+  cache:
+    key: \\"\${CI_JOB_NAME}\\"
+    paths:
+      - .sonar/cache
+  script: 
+    - sonar-scanner
+  allow_failure: true
+  only:
+    - merge_requests
+    - master
+    - develop
+"
+/>
+`;
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandGradle-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandGradle-test.tsx.snap
deleted file mode 100644 (file)
index 61f4c68..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<CodeSnippet
-  snippet="sonarqube-check:
-  image: gradle:jre11-slim
-  variables:
-    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
-    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
-  cache:
-    key: \\"\${CI_JOB_NAME}\\"
-    paths:
-      - .sonar/cache
-  script: gradle sonarqube
-  allow_failure: true
-  only:
-    - merge_requests
-    - master
-    - develop
-"
-/>
-`;
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandMaven-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandMaven-test.tsx.snap
deleted file mode 100644 (file)
index 0b84368..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<CodeSnippet
-  snippet="sonarqube-check:
-  image: maven:3.6.3-jdk-11
-  variables:
-    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
-    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
-  cache:
-    key: \\"\${CI_JOB_NAME}\\"
-    paths:
-      - .sonar/cache
-  script:
-    - mvn verify sonar:sonar
-  allow_failure: true
-  only:
-    - merge_requests
-    - master
-    - develop
-"
-/>
-`;
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandOther-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/__snapshots__/PipeCommandOther-test.tsx.snap
deleted file mode 100644 (file)
index 74e84b8..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<CodeSnippet
-  snippet="sonarqube-check:
-  image:
-    name: sonarsource/sonar-scanner-cli:latest
-    entrypoint: [\\"\\"]
-  variables:
-    SONAR_USER_HOME: \\"\${CI_PROJECT_DIR}/.sonar\\"  # Defines the location of the analysis task cache
-    GIT_DEPTH: \\"0\\"  # Tells git to fetch all the branches of the project, required by the analysis task
-  cache:
-    key: \\"\${CI_JOB_NAME}\\"
-    paths:
-      - .sonar/cache
-  script:
-    - sonar-scanner
-  allow_failure: true
-  only:
-    - merge_requests
-    - master
-    - develop
-"
-/>
-`;
index 50ef223c1433111dae8016c9fe17346bc41408f0..680894af399280163959fe0de19c427ebada41d8 100644 (file)
@@ -3357,7 +3357,8 @@ onboarding.tutorial.with.gitlab_ci.env_variables.section2.step4=Leave the "Mask
 onboarding.tutorial.with.gitlab_ci.yml.title=Create or update the configuration file
 onboarding.tutorial.with.gitlab_ci.yml.description=Create or update your {filename} file with the following content.
 onboarding.tutorial.with.gitlab_ci.yml.filename=.gitlab-ci.yml
-onboarding.tutorial.with.gitlab_ci.yml.baseconfig=Note that this is a minimal base configuration to run a SonarQube analysis on your master branch and merge requests.
+onboarding.tutorial.with.gitlab_ci.yml.baseconfig=Note that this is a minimal base configuration to run a SonarQube analysis on your main branch and merge requests.
+onboarding.tutorial.with.gitlab_ci.yml.baseconfig.no_branches=Note that this is a minimal base configuration to run a SonarQube analysis on your main branch.
 onboarding.tutorial.with.gitlab_ci.yml.existing=If you already have a pipeline configured and running, you might want to add the example from this step to your existing yml file.
 onboarding.tutorial.with.gitlab_ci.yml.done=Is it done?
 onboarding.tutorial.with.gitlab_ci.yml.done.description=You should see the page refresh itself in a few moments with your analysis results if the {link}.