Merge pull request #1641 from Felixnoo/remove-metersphere-3.0
Remove MeterSphere Doc in 3.0
|
|
@ -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.
|
||||
|
||||

|
||||
|
||||
2. You can view the API Keys after they are created. Copy the **Access Key**.
|
||||
|
||||

|
||||
|
||||
3. Click **Show** under **Secret Key** to copy the Secret Key.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### 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).
|
||||
|
||||

|
||||
|
||||
2. On the **Manage Jenkins** page, scroll down to **Manage Plugins** and click it.
|
||||
|
||||

|
||||
|
||||
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).
|
||||
|
||||

|
||||
|
||||
4. After you upload the HPI file, click **Upload** to continue.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### Step 3: Generate a pipeline snippet
|
||||
|
||||
1. Click **New Item** to create an item.
|
||||
|
||||

|
||||
|
||||
2. Set `metersphere-test` for the item name and select **Pipeline**. Click **OK** to continue.
|
||||
|
||||

|
||||
|
||||
3. In this tutorial, click **Save** directly to use the default settings.
|
||||
|
||||

|
||||
|
||||
4. On the **Pipeline metersphere-test** page, click **Pipeline Syntax**.
|
||||
|
||||

|
||||
|
||||
5. Select **metersphere:MeterSphere** from the drop-down list of **Sample Step** under **Steps**.
|
||||
|
||||

|
||||
|
||||
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**.
|
||||
|
||||

|
||||
|
||||
{{< 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:
|
||||
|
||||

|
||||
|
||||
### 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**.
|
||||
|
||||

|
||||
|
||||
2. Set `metersphere-pipeline` for **Name** and click **Create** on the **Advanced Settings** page to use the default configurations.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
3. Click the pipeline in the list to go to its detail page and then click **Edit Jenkinsfile**.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
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'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
{{< 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.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
7. On the detail page, you can click **Show Logs** in the upper right corner to view the logs.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
8. You can view the test report on the console of MeterSphere and click it to view its details.
|
||||
|
||||

|
||||
|
||||

|
||||
|
|
@ -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。
|
||||
|
||||

|
||||
|
||||
2. API Keys 创建好之后,您可以进行查看。复制 **Access Key**。
|
||||
|
||||

|
||||
|
||||
3. 点击 **Secret Key** 下的**显示**并复制 Secret Key。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### 步骤 2:在 Jenkins 上安装 MeterSphere 插件
|
||||
|
||||
1. 登录 Jenkins 控制台,点击 **Manage Jenkins**。有关如何登录 Jenkins 控制台的更多信息,请参考[将 SonarQube 集成到流水线](../sonarqube/#step-5-add-the-sonarqube-server-to-jenkins)。
|
||||
|
||||

|
||||
|
||||
2. 在 **Manage Jenkins** 页面,下滑至 **Manage Plugins** 并点击。
|
||||
|
||||

|
||||
|
||||
3. 访问**高级**选项卡,下滑至**上传插件**。点击**文件**旁边的按钮上传 [MeterSphere 插件的 HPI 文件](https://github.com/metersphere/jenkins-plugin/releases/download/v1.7.3/metersphere-jenkins-plugin-v1.7.3.hpi)。
|
||||
|
||||

|
||||
|
||||
4. 上传 HPI 文件之后,点击**上传**以继续。
|
||||
|
||||

|
||||
|
||||
5. 您可以在页面上看到安装状态,请确保选择**安装完成后重启 Jenkins(空闲时)**。安装成功后,Jenkins 会重启。
|
||||
|
||||

|
||||
|
||||
6. 待 Jenkins 完成重启,请登录并再次访问 **Manage Jenkins** 中的 **Manage Plugins**。在**已安装**选项卡,可以看到已安装 MeterSphere 插件。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### 步骤 3:生成流水线代码段
|
||||
|
||||
1. 点击**新建Item** 创建条目。
|
||||
|
||||

|
||||
|
||||
2. 将条目名称设为 `metersphere-test`,选择**流水线**。点击**确定**继续。
|
||||
|
||||

|
||||
|
||||
3. 在本教程中,直接点击**保存**使用默认设置。
|
||||
|
||||

|
||||
|
||||
4. 在 **Pipeline metersphere-test** 页面,点击**流水线语法**。
|
||||
|
||||

|
||||
|
||||
5. 在**步骤**下,选择**范例步骤**下拉菜单中的 **meterSphere: MeterSphere**。
|
||||
|
||||

|
||||
|
||||
6. 输入上述步骤中创建的 MeterSphere API Keys 以及 API Endpoint `http://NodeIP:NodePort`。您可以在下拉菜单中设置其他的值,然后点击**生成流水线脚本**。
|
||||
|
||||

|
||||
|
||||
{{< notice note >}}
|
||||
|
||||
本教程使用 MeterSphere 的 `demo-workspace` 工作空间和 `demo` 项目进行演示。您首先需要创建工作空间和项目,并在 MeterSphere 上配置测试用例,否则上图所示的下拉列表里将没有可选的条目。有关如何使用 MeterSphere 的更多信息,请参考 [MeterSphere GitHub 网站](https://github.com/metersphere/metersphere/blob/master/README-EN.md)。
|
||||
|
||||
{{</ notice >}}
|
||||
|
||||
7. 您将看到以下输出:
|
||||
|
||||

|
||||
|
||||
### 步骤 4:创建流水线
|
||||
|
||||
1. 以 `project-regular` 身份登录 KubeSphere 的 Web 控制台。在 DevOps 工程中,访问**流水线**,然后点击**创建**。
|
||||
|
||||

|
||||
|
||||
2. 将**名称**设置为 `metersphere-pipeline`,点击**下一步**。在**高级设置**页面,点击**创建**使用默认配置。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
3. 点击列表中的流水线访问其详情页,然后点击**编辑 Jenkinsfile**。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
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'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
{{< notice note >}}
|
||||
|
||||
请确保将以下字段的值更改为您在 Jenkins 控制台上生成的值: `msAccessKey`、`msSecretKey`、`msEndpoint`、`projectId`、`testCaseId` 和 `workspaceId`。
|
||||
|
||||
{{</ notice >}}
|
||||
|
||||
5. 点击**运行**来运行流水线。
|
||||
|
||||

|
||||
|
||||
6. 稍等片刻,您可以在**活动**选项卡下看到流水线的状态变为**成功**。点击该流水线查看其详情。
|
||||
|
||||

|
||||
|
||||
7. 在详情页,您可以点击右上角的**显示日志**来查看日志。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
8. 您可以在 MeterSphere 的控制台上查看测试报告,点击测试报告可查看其详情。
|
||||
|
||||

|
||||
|
||||

|
||||
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 173 KiB |
|
Before Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 259 KiB |
|
Before Width: | Height: | Size: 271 KiB |
|
Before Width: | Height: | Size: 309 KiB |
|
Before Width: | Height: | Size: 268 KiB |
|
Before Width: | Height: | Size: 207 KiB |
|
Before Width: | Height: | Size: 248 KiB |
|
Before Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 215 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 341 KiB |
|
Before Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 221 KiB |
|
Before Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 119 KiB |