Remove MeterSphere Doc

Signed-off-by: Felixnoo <felixliu@yunify.com>
This commit is contained in:
Felixnoo 2021-05-31 09:29:37 +08:00
parent 4076cb8810
commit a4d477b4a7
74 changed files with 0 additions and 322 deletions

View File

@ -1,161 +0,0 @@
---
title: "Integrate MeterSphere into Pipelines"
keywords: 'Kubernetes, Docker, DevOps, Jenkins, MeterSphere'
description: 'Integrate MeterSphere into your pipelines for continuous testing.'
linkTitle: "Integrate MeterSphere into Pipelines"
weight: 11330
---
This tutorial demonstrates how to integrate MeterSphere into KubeSphere pipelines.
## Prerequisites
- You need to enable [the KubeSphere DevOps System](../../../pluggable-components/devops/).
- You need to [deploy MeterSphere on KubeSphere](../../../application-store/external-apps/deploy-metersphere/).
- You need to create a workspace, a DevOps project, and an account (`project-regular`). This account needs to be invited to the DevOps project with the `operator` role. If they are not ready, see [Create Workspaces, Projects, Accounts and Roles](../../../quick-start/create-workspace-and-project/).
## Hands-on Lab
### Step 1: Create API Keys on MeterSphere
1. Log in to the MeterSphere console. Go to **API Keys** under **Personal Info** and click **Create** to create API Keys.
![create-api-keys](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/create-api-keys.PNG)
2. You can view the API Keys after they are created. Copy the **Access Key**.
![api-key-created](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/api-key-created.PNG)
3. Click **Show** under **Secret Key** to copy the Secret Key.
![click-show](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-show.PNG)
![copy-secret-key](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/copy-secret-key.PNG)
### Step 2: Install MeterSphere plugin on Jenkins
1. Log in to the Jenkins console and click **Manage Jenkins**. For more information about how to log in to the Jenkins console, refer to [Integrate SonarQube into Pipelines](../sonarqube/#step-5-add-the-sonarqube-server-to-jenkins).
![click-manage-jenkins](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-manage-jenkins.PNG)
2. On the **Manage Jenkins** page, scroll down to **Manage Plugins** and click it.
![click-manage-plugins](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-manage-plugins.PNG)
3. Go to the **Advanced** tab and scroll down to **Upload Plugin**. Click the button next to **Files** to upload [the HPI file of MeterSphere plugin](https://github.com/metersphere/jenkins-plugin/releases/download/v1.7.3/metersphere-jenkins-plugin-v1.7.3.hpi).
![choose-file](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/choose-file.PNG)
4. After you upload the HPI file, click **Upload** to continue.
![click-upload](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-upload.PNG)
5. You can see the installation status on the page and make sure you select **Restart Jenkins when installation is complete and no jobs are running**. After the installation succeeds, Jenkins will restart.
![installation-success](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/installation-success.PNG)
6. Once Jenkins finishes restarting, log in and go to **Manage Plugins** in **Manage Jenkins** again. On the **Installed** tab, you can find the MeterSphere plugin just installed.
![installed-tab](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/installed-tab.PNG)
![metersphere-in-list](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/metersphere-in-list.PNG)
### Step 3: Generate a pipeline snippet
1. Click **New Item** to create an item.
![click-new-item](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-new-item.PNG)
2. Set `metersphere-test` for the item name and select **Pipeline**. Click **OK** to continue.
![set-item-info](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/set-item-info.PNG)
3. In this tutorial, click **Save** directly to use the default settings.
![click-save](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-save.PNG)
4. On the **Pipeline metersphere-test** page, click **Pipeline Syntax**.
![click-pipeline-syntax](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-pipeline-syntax.PNG)
5. Select **metersphere:MeterSphere** from the drop-down list of **Sample Step** under **Steps**.
![select-metersphere](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/select-metersphere.PNG)
6. Input the MeterSphere API Keys created in the above step and the API Endpoint `http://NodeIP:NodePort`. You can set the rest values from the drop-down lists and then click **Generate Pipeline Script**.
![input-values](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/input-values.PNG)
{{< notice note >}}
This tutorial uses the workspace `demo-workspace` and the project `demo` from MeterSphere for demonstration purposes. You need to create workspaces and projects, and configure test cases on MeterSphere first, or there will not be available items from the drop-down lists shown in the above image. For more information about how to use MeterSphere, refer to [MeterSphere GitHub website](https://github.com/metersphere/metersphere/blob/master/README-EN.md).
{{</ notice >}}
7. You will see the following output:
![snippet-output](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/snippet-output.PNG)
### Step 4: Create a pipeline
1. Log in to the web console of KubeSphere as `project-regular`. In your DevOps project, go to **Pipelines** and then click **Create**.
![create-pipeline](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/create-pipeline.PNG)
2. Set `metersphere-pipeline` for **Name** and click **Create** on the **Advanced Settings** page to use the default configurations.
![set-pipeline-name](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/set-pipeline-name.PNG)
![click-create-pipeline](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-create-pipeline.PNG)
3. Click the pipeline in the list to go to its detail page and then click **Edit Jenkinsfile**.
![click-pilepine-item](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/click-pilepine-item.PNG)
![edit-jenkinsfile](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/edit-jenkinsfile.PNG)
4. In the dialog that appears, input the following pipeline script based on the snippet generated by Jenkins in the previous step, and then click **OK**.
```
node('base') {
stage('stage-zewwa') {
meterSphere method: 'single',
msAccessKey: 'O4baJHYpybhPizFS',
msEndpoint: 'http://103.61.37.135:31397/',
msSecretKey: 'tIKidlPrpZFJgGl9',
projectId: 'e72714e2-dfc5-4370-a9bc-f17e596caf66',
result: 'jenkins',
testCaseId: '2fc3210b-6c99-4633-9701-1a8941640018',
testPlanId: '',
workspaceId: 'f9dbbadb-0d0c-4d2e-bf6d-0e996d92899d'
}
}
```
![pipeline-script](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/pipeline-script.PNG)
{{< notice note >}}
Make sure you change the values of the following fields to the values generated on your Jenkins console: `msAccessKey`, `msSecretKey`, `msEndpoint`, `projectId`, `testCaseId` and `workspaceId`.
{{</ notice >}}
5. Click **Run** to run the pipeline.
![run-pipeline](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/run-pipeline.PNG)
6. Wait for a while and you can see the pipeline reaches the status of **Success** under the **Activity** tab. Click it to view its details.
![pipeline-success](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/pipeline-success.PNG)
7. On the detail page, you can click **Show Logs** in the upper right corner to view the logs.
![show-logs](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/show-logs.PNG)
![view-logs](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/view-logs.PNG)
8. You can view the test report on the console of MeterSphere and click it to view its details.
![test-report](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/test-report.PNG)
![test-report-detail](/images/docs/devops-user-guide/tool-integration/integrate-metersphere/test-report-detail.PNG)

View File

@ -1,161 +0,0 @@
---
title: "将 MeterSphere 集成到流水线"
keywords: 'Kubernetes, Docker, DevOps, Jenkins, MeterSphere'
description: '将 MeterSphere 集成到流水线中进行持续测试。'
linkTitle: "将 MeterSphere 集成到流水线"
weight: 11330
---
本教程演示如何将 MeterSphere 集成到流水线。
## 准备工作
- 您需要启用 [KubeSphere DevOps 系统](../../../pluggable-components/devops/)。
- 您需要[在 KubeSphere 上部署 MeterSphere](../../../application-store/external-apps/deploy-metersphere/)。
- 您需要创建一个企业空间、一个 DevOps 工程和一个帐户 (`project-regular`)。需要邀请该帐户至 DevOps 工程并赋予 `operator` 角色。如果尚未创建,请参见[创建企业空间、项目、帐户和角色](http://localhost:1313/zh/docs/quick-start/create-workspace-and-project/)。
## 动手实验
### 步骤 1在 MeterSphere 上创建 API Keys
1. 登录 MeterSphere 控制台。访问**个人信息**下的 **API Keys**,点击**新建**来创建 API Keys。
![create-api-keys](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/create-api-keys.png)
2. API Keys 创建好之后,您可以进行查看。复制 **Access Key**
![api-key-created](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/api-key-created.png)
3. 点击 **Secret Key** 下的**显示**并复制 Secret Key。
![click-show](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-show.png)
![copy-secret-key](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/copy-secret-key.png)
### 步骤 2在 Jenkins 上安装 MeterSphere 插件
1. 登录 Jenkins 控制台,点击 **Manage Jenkins**。有关如何登录 Jenkins 控制台的更多信息,请参考[将 SonarQube 集成到流水线](../sonarqube/#step-5-add-the-sonarqube-server-to-jenkins)。
![click-manage-jenkins](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-manage-jenkins.PNG)
2. 在 **Manage Jenkins** 页面,下滑至 **Manage Plugins** 并点击。
![click-manage-plugins](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-manage-plugins.PNG)
3. 访问**高级**选项卡,下滑至**上传插件**。点击**文件**旁边的按钮上传 [MeterSphere 插件的 HPI 文件](https://github.com/metersphere/jenkins-plugin/releases/download/v1.7.3/metersphere-jenkins-plugin-v1.7.3.hpi)。
![choose-file](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/choose-file.PNG)
4. 上传 HPI 文件之后,点击**上传**以继续。
![click-upload](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-upload.PNG)
5. 您可以在页面上看到安装状态,请确保选择**安装完成后重启 Jenkins空闲时**。安装成功后Jenkins 会重启。
![installation-success](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/installation-success.PNG)
6. 待 Jenkins 完成重启,请登录并再次访问 **Manage Jenkins** 中的 **Manage Plugins**。在**已安装**选项卡,可以看到已安装 MeterSphere 插件。
![installed-tab](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/installed-tab.PNG)
![metersphere-in-list](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/metersphere-in-list.PNG)
### 步骤 3生成流水线代码段
1. 点击**新建Item** 创建条目。
![click-new-item](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-new-item.PNG)
2. 将条目名称设为 `metersphere-test`,选择**流水线**。点击**确定**继续。
![set-item-info](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/set-item-info.PNG)
3. 在本教程中,直接点击**保存**使用默认设置。
![click-save](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-save.PNG)
4. 在 **Pipeline metersphere-test** 页面,点击**流水线语法**。
![click-pipeline-syntax](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-pipeline-syntax.PNG)
5. 在**步骤**下,选择**范例步骤**下拉菜单中的 **meterSphere: MeterSphere**
![select-metersphere](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/select-metersphere.PNG)
6. 输入上述步骤中创建的 MeterSphere API Keys 以及 API Endpoint `http://NodeIP:NodePort`。您可以在下拉菜单中设置其他的值,然后点击**生成流水线脚本**。
![input-values](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/input-values.PNG)
{{< notice note >}}
本教程使用 MeterSphere 的 `demo-workspace` 工作空间和 `demo` 项目进行演示。您首先需要创建工作空间和项目,并在 MeterSphere 上配置测试用例,否则上图所示的下拉列表里将没有可选的条目。有关如何使用 MeterSphere 的更多信息,请参考 [MeterSphere GitHub 网站](https://github.com/metersphere/metersphere/blob/master/README-EN.md)。
{{</ notice >}}
7. 您将看到以下输出:
![snippet-output](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/snippet-output.PNG)
### 步骤 4创建流水线
1. 以 `project-regular` 身份登录 KubeSphere 的 Web 控制台。在 DevOps 工程中,访问**流水线**,然后点击**创建**。
![create-pipeline](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/create-pipeline.png)
2. 将**名称**设置为 `metersphere-pipeline`,点击**下一步**。在**高级设置**页面,点击**创建**使用默认配置。
![set-pipeline-name](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/set-pipeline-name.png)
![click-create-pipeline](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-create-pipeline.png)
3. 点击列表中的流水线访问其详情页,然后点击**编辑 Jenkinsfile**。
![click-pilepine-item](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/click-pilepine-item.png)
![edit-jenkinsfile](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/edit-jenkinsfile.png)
4. 在出现的对话框中,根据之前的步骤中 Jenkins 生成的代码段输入以下流水线代码,然后点击**确定**。
```
node('base') {
stage('stage-zewwa') {
meterSphere method: 'single',
msAccessKey: 'O4baJHYpybhPizFS',
msEndpoint: 'http://103.61.37.135:31397/',
msSecretKey: 'tIKidlPrpZFJgGl9',
projectId: 'e72714e2-dfc5-4370-a9bc-f17e596caf66',
result: 'jenkins',
testCaseId: '2fc3210b-6c99-4633-9701-1a8941640018',
testPlanId: '',
workspaceId: 'f9dbbadb-0d0c-4d2e-bf6d-0e996d92899d'
}
}
```
![pipeline-script](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/pipeline-script.png)
{{< notice note >}}
请确保将以下字段的值更改为您在 Jenkins 控制台上生成的值: `msAccessKey`、`msSecretKey`、`msEndpoint`、`projectId`、`testCaseId` 和 `workspaceId`
{{</ notice >}}
5. 点击**运行**来运行流水线。
![run-pipeline](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/run-pipeline.png)
6. 稍等片刻,您可以在**活动**选项卡下看到流水线的状态变为**成功**。点击该流水线查看其详情。
![pipeline-success](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/pipeline-success.PNG)
7. 在详情页,您可以点击右上角的**显示日志**来查看日志。
![show-logs](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/show-logs.PNG)
![view-logs](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/view-logs.PNG)
8. 您可以在 MeterSphere 的控制台上查看测试报告,点击测试报告可查看其详情。
![test-report](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/test-report.PNG)
![test-report-detail](/images/docs/zh-cn/devops-user-guide/tool-integration/integrate-metersphere/test-report-detail.PNG)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB