Merge pull request #3198 from zhuxiujuan28/new

【documentation】update devops docs
This commit is contained in:
KubeSphere CI Bot 2024-10-17 17:18:41 +08:00 committed by GitHub
commit c501f876a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 200 additions and 112 deletions

View File

@ -26,4 +26,9 @@ helm upgrade --install -n kubesphere-system --create-namespace ks-core https://c
- Fix white screen pages of some extensions.
- Fix problem of residual resources when uninstalling ks-core.
- Fix installation failure in K8s 1.19 environments.
- Fix installation failure in K8s 1.19 environments.
### Known issues
- The image builder (S2I, B2I) feature in DevOps is not available in this release.

View File

@ -298,12 +298,12 @@ weight: 01
// |ServiceMesh
// |1.0.x
// |1.22~1.25
// |1.22~1.28
// |amd64、arm64
// |KubeEdge
// |1.13.1
// |1.21-1.23
// |1.21-1.28
// |amd64、arm64
// |RadonDB DMP

View File

@ -1,7 +1,7 @@
---
title: "删除 DevOps 项目"
keywords: "Kuberentes, {ks_product}, 企业空间管理, DevOps 项目, 删除 DevOps 项目"
description: "介绍如何编辑删除 DevOps 项目。"
description: "介绍如何删除 DevOps 项目。"
weight: 04
---

View File

@ -23,7 +23,7 @@ endif::[]
== 创建 DevOps 项目
. 以 **project-admin** 用户登录{ks_product_both} Web 控制台,进入一个企业空间。
. 以 **project-admin** 用户登录{ks_product_left} Web 控制台,进入一个企业空间。
. 点击 **DevOps 项目**,然后点击**创建**。

View File

@ -64,7 +64,7 @@ DevOps 中的图形编辑面板包含用于 Jenkins link:https://www.jenkins.io/
|说明
|
如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
@ -82,7 +82,7 @@ DevOps 中的图形编辑面板包含用于 Jenkins link:https://www.jenkins.io/
|===
--
. 再为 SonarQube 创建一个凭证 (**sonar-token**),用于上述的阶段 3代码分析。凭证类型选择**访问令牌**,在**令牌**字段输入 SonarQube 令牌请参阅link:../../../04-how-to-integrate/01-sonarqube/[为新项目创建 SonarQube 令牌 (Token)]。点击**确定**完成操作。
. 再为 SonarQube 创建一个凭证 (**sonar-token**),用于上述的阶段 3代码分析。凭证类型选择**访问令牌**,在**令牌**字段输入 SonarQube 令牌请参阅link:../../../04-how-to-integrate/01-sonarqube/#_为新项目创建_sonarqube_token[为新项目创建 SonarQube Token]。点击**确定**完成操作。
. 创建完成后,您将在凭证页面看到已创建的凭证。
@ -251,7 +251,7 @@ image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-gr
+
image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/nested_step.png[,100%]
. 点击 **Sonarqube 配置**,在弹出的对话框中保持默认名称 **sonar** 不变,点击**确定**保存操作。
. 点击 **Sonarqube 配置**,在弹出的对话框中输入名称 **sonar**,点击**确定**保存操作。
+
image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/sonar_env.png[,100%]
@ -274,7 +274,7 @@ image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-gr
+
image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/timeout_set.png[,100%]
. 点击**超时**步骤下的**添加嵌套步骤**,选择**代码质量检查 (SonarQube)**。在弹出的对话框中选择**检查通过后开始后续任务**。点击**确定**保存操作。
. 点击**超时**步骤下的**添加嵌套步骤**,选择**代码质量检查 (SonarQube)**。在弹出的对话框中勾选**如果质量阈值状态不是绿色,则中止流水线**。点击**确定**保存操作。
+
image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/waitforqualitygate_set.png[,100%]
+

View File

@ -65,7 +65,7 @@ Jenkinsfile in SCM 需要源代码管理 (SCM) 中有内置 Jenkinsfile换句
== 步骤 1创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在 **DevOps 项目设置**下的**凭证**页面创建以下凭证。有关如何创建凭证的更多信息请参阅link:../../05-devops-settings/01-credential-management/[凭证管理]。
+
@ -76,7 +76,7 @@ Jenkinsfile in SCM 需要源代码管理 (SCM) 中有内置 Jenkinsfile换句
|说明
|
如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
[%header,cols="1a,2a,2a"]
@ -97,7 +97,7 @@ Jenkinsfile in SCM 需要源代码管理 (SCM) 中有内置 Jenkinsfile换句
|===
--
. 再为 SonarQube 创建一个凭证 (**sonar-token**),用于上述的阶段 3代码分析。凭证类型选择**访问令牌**,在**令牌**字段输入 SonarQube 令牌请参阅link:../../../04-how-to-integrate/01-sonarqube/[为新项目创建 SonarQube 令牌 (Token)]。点击**确定**完成操作。
. 再为 SonarQube 创建一个凭证 (**sonar-token**),用于上述的阶段 3代码分析。凭证类型选择**访问令牌**,在**令牌**字段输入 SonarQube 令牌请参阅link:../../../04-how-to-integrate/01-sonarqube/#_为新项目创建_sonarqube_token[为新项目创建 SonarQube Token]。点击**确定**完成操作。
. 还需要创建具有如下图所示权限的 GitHub 个人访问令牌 (PAT),然后在 DevOps 项目中,使用生成的令牌创建用于 GitHub 认证的账户凭证(例如,**github-token**)。
+
@ -210,7 +210,7 @@ Jenkinsfile 中 **mvn** 命令的参数 **-o** 表示开启离线模式。本教
== 步骤 3创建流水线
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。
@ -358,7 +358,7 @@ input(id: 'release-image-with-tag', message: 'release image with tag?', submitte
----
--
. 以具有流水线审核权限的用户登录{ks_product_both} Web 控制台,点击**企业空间管理**并进入您的 DevOps 项目,点击流水线名称进入详情页。在**运行记录**页签下,点击要审核的记录,点击**继续**以批准流水线。
. 以具有流水线审核权限的用户登录{ks_product_left} Web 控制台,点击**企业空间管理**并进入您的 DevOps 项目,点击流水线名称进入详情页。在**运行记录**页签下,点击要审核的记录,点击**继续**以批准流水线。
//note
[.admon.note,cols="a"]
@ -416,7 +416,7 @@ input(id: 'release-image-with-tag', message: 'release image with tag?', submitte
// == 步骤 7访问示例服务
// . 以 **platform-admin** 用户登录{ks_product_both} Web 控制台。
// . 以 **platform-admin** 用户登录{ks_product_left} Web 控制台。
// . 进入 **kubesphere-sample-dev** 项目,在**应用负载**下的**服务**中点击 **ks-sample-dev**。在详情页获取 Endpoint 用于访问该服务。

View File

@ -34,7 +34,7 @@ CI & CD 流水线模板包含六个阶段。有关每个阶段的更多信息,
下面以 Node.js 为例演示如何使用内置流水线模板。使用 Maven 以及 Golang 流水线模板的操作基本相同。
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。

View File

@ -21,7 +21,7 @@ link:https://gitlab.com/users/sign_in[GitLab] 是一款基于 web 的 Git 仓库
== 步骤 1创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在 **DevOps 项目设置**下的**凭证**中创建以下凭证。有关如何创建凭证的更多信息请参阅link:../../05-devops-settings/01-credential-management/[凭证管理]。
+
@ -32,7 +32,7 @@ link:https://gitlab.com/users/sign_in[GitLab] 是一款基于 web 的 Git 仓库
|说明
|
如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,则可能会因为无法识别而在流水线运行时导致错误。在此情况下,您需要先在第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,则可能会因为无法识别而在流水线运行时导致错误。在此情况下,您需要先在第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
@ -108,7 +108,7 @@ link:https://gitlab.com/users/sign_in[GitLab] 是一款基于 web 的 Git 仓库
== 步骤 3创建流水线
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。

View File

@ -23,7 +23,7 @@ weight: 06
=== 获取 webhook URL
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。
@ -66,7 +66,7 @@ weight: 06
== 检查流水线状态
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

View File

@ -0,0 +1,88 @@
---
title: "登录 Jenkins 仪表板"
keywords: "Kubernetes, {ks_product}, DevOps 项目, 使用 DevOps, 访问 Jenkins"
description: "介绍如何登录 Jenkins 仪表板。"
weight: 07
---
安装 DevOps 时,默认情况下也会安装 Jenkins 仪表板。但需按照以下步骤配置后,才能访问 Jenkins 仪表板。
== 前提条件
{ks_product_right}平台需要安装并启用 **DevOps** 扩展组件。
== 操作步骤
. 在集群节点上执行以下命令获取 Jenkins 的地址。
+
--
// Bash
[,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services devops-jenkins)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
----
您将获得如下输出:
[,bash]
----
http://10.77.1.201:30180
----
--
. 检查 DevOps 扩展组件配置中的 `jenkins.securityRealm.openIdConnect.kubesphereCoreApi` 和 `jenkins.securityRealm.openIdConnect.jenkinsURL` ,确保已经分别修改为 kubesphere-console 和 devops-jenkins 服务实际可访问的地址。如果不是,请修改并等待组件更新完成。
+
[,yaml]
----
jenkins:
securityRealm:
openIdConnect:
# The kubesphere-core api used for jenkins OIDC
# If you want to access to jenkinsWebUI, the kubesphereCoreApi must be specified and browser-accessible
# Modifying this configuration will take effect only during installation
# If you wish for changes to take effect after installation, you need to update the jenkins-casc-config ConfigMap, copy the securityRealm configuration from jenkins.yaml to jenkins_user.yaml, save, and wait for approximately 70 seconds for the changes to take effect.
kubesphereCoreApi: "http://192.168.1.1:30880"
# The jenkins web URL used for OIDC redirect
jenkinsURL: "http://192.168.1.1:30180"
----
. 检查配置字典 `jenkins-casc-config` 中 `jenkins_user.yaml` 下 `securityRealm.oic` 的所有地址,确保与 `jenkins.yaml` 下 `securityRealm.oic` 中的一样,都改为 kubesphere-console 实际可访问的地址。如果不一样,请修改并等待其生效。
+
[,yaml]
----
securityRealm:
oic:
clientId: "jenkins"
clientSecret: "jenkins"
tokenServerUrl: "http://192.168.1.1:30880/oauth/token"
authorizationServerUrl: "http://192.168.1.1:30880/oauth/authorize"
userInfoServerUrl: "http://192.168.1.1:30880/oauth/userinfo"
endSessionEndpoint: "http://192.168.1.1:30880/oauth/logout"
logoutFromOpenidProvider: true
scopes: openid profile email
fullNameFieldName: url
userNameField: preferred_username
----
. 检查配置字典 `kubesphere-config` 中的 `authentication.issuer.url`,确保已经修改为 kubesphere-console 实际可访问的地址。如果不是,请修改并重启 Deployment ks-apiserver 使其生效。
+
--
[,yaml]
----
authentication:
issuer:
url: "http://192.168.1.1:30880"
----
[source,bash]
----
kubectl -n kubesphere-system rollout restart deploy ks-apiserver
----
--
. 使用地址 http://NodeIP:30180 访问 Jenkins 仪表板。
+
Jenkins 配置有{ks_product_left} LDAP这意味着您可以直接使用{ks_product_both}账户(例如 `admin/P@88w0rd`)登录 Jenkins。

View File

@ -21,9 +21,9 @@ weight: 08
* 已有一个可用 Jenkins 共享库。本教程以 link:https://github.com/devops-ws/jenkins-shared-library[GitHub 仓库]中的 Jenkins 共享库为例。
== 步骤 1在 Jenkins 仪表配置共享库
== 步骤 1在 Jenkins 仪表配置共享库
. link:../../../04-how-to-integrate/01-sonarqube/[登录 Jenkins 仪表板]并点击左侧导航栏中的**系统管理**。
. link:../07-access-jenkins-console[登录 Jenkins 仪表板]并点击左侧导航栏中的**系统管理**。
. 向下滚动并点击**系统配置**。
@ -58,7 +58,7 @@ weight: 08
=== 创建流水线
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。

View File

@ -20,7 +20,7 @@ weight: 03
== 导入代码仓库
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

View File

@ -18,7 +18,7 @@ weight: 04
== 操作步骤
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

View File

@ -32,7 +32,7 @@ weight: 01
== 创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。
@ -78,7 +78,7 @@ weight: 01
|
* 自 2021 年 8 月起GitHub 要求使用基于令牌的身份验证,此处需要输入令牌,而非 GitHub 密码。有关如何生成令牌请参阅link:https://docs.github.com/cn/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token[创建个人访问令牌]。
* 如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,您需要先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
* 如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,您需要先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
--

View File

@ -46,7 +46,7 @@ weight: 02
== 创建 DevOps 项目角色
. 以 **devops-admin** 用户登录 {ks_product_both} Web 控制台。
. 以 **devops-admin** 用户登录{ks_product_left} Web 控制台。
. 前往 **DevOps 项目**页面点击一个 DevOps 项目(例如 **demo-devops**)。
+

View File

@ -20,7 +20,7 @@ weight: 03
== 操作步骤
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

View File

@ -6,9 +6,9 @@ weight: 01
---
link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续检测工具可用于代码库的静态和动态分析。SonarQube 集成到{ks_product_both}流水线后,如果在运行的流水线中检测到问题,将会在仪表板上直接显示常见代码问题。
link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续检测工具可用于代码库的静态和动态分析。SonarQube 集成到{ks_product_both}流水线后,如果在运行的流水线中检测到问题,将会在仪表板上直接显示常见代码问题,例如 Bug 和漏洞
本文档演示如何将 SonarQube 集成到流水线中。在link:../../03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile/[使用 Jenkinsfile 创建流水线]之前,请先阅读本节内容
本文档演示如何将 SonarQube 集成到流水线中。在link:../../03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile/[使用 Jenkinsfile 创建流水线]之前,请先参考以下步骤
== 前提条件
@ -18,7 +18,7 @@ link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续
== 安装 SonarQube 服务器
要将 SonarQube 集成到您的流水线,必须先安装 SonarQube 服务器。
要将 SonarQube 集成到您的流水线,必须先在集群节点上安装 SonarQube 服务器。
. 安装 Helm以便使用该工具安装 SonarQube。例如运行以下命令安装 Helm 3
+
@ -26,7 +26,7 @@ link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续
// Bash
[,bash]
----
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3|bash
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
----
查看 Helm 版本。
@ -82,9 +82,7 @@ kubesphere-devops-system --create-namespace --set service.type=NodePort
[,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services sonarqube-sonarqube)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
----
--
@ -110,7 +108,12 @@ http://10.77.1.201:31377
// Bash
[,bash]
----
kubectl get pod -n kubesphere-devops-system
$ kubectl get pod -n kubesphere-devops-system
NAME READY STATUS RESTARTS AGE
devops-jenkins-68b8949bb-7zwg4 1/1 Running 0 84m
s2ioperator-0 1/1 Running 1 84m
sonarqube-postgresql-0 1/1 Running 0 5m31s
sonarqube-sonarqube-bb595d88b-97594 1/1 Running 2 5m31s
----
--
@ -133,12 +136,18 @@ kubectl get pod -n kubesphere-devops-system
=== 步骤 2创建 SonarQube 管理员令牌 (Token)
. 点击右上角字母 **A**,然后从菜单中选择 **My Account** 以转到 **Profile** 页面。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-config-1.png[]
. 点击 **Security** 并输入令牌名称,例如 **kubesphere**。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-config-2.png[]
. 点击 **Generate** 并复制此令牌。
+
--
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-config-3.png[]
//note
[.admon.note,cols="a"]
|===
@ -155,15 +164,11 @@ kubectl get pod -n kubesphere-devops-system
+
--
// Bash
[,bash]
[source,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services devops-jenkins)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/sonarqube-webhook/
----
--
@ -173,55 +178,24 @@ echo http://$NODE_IP:$NODE_PORT/sonarqube-webhook/
// Bash
[,bash]
----
http://10.77.1.201:30180/sonarqube-webhook/
----
--
. 依次点击 **Administration**、**Configuration** 和 **Webhooks** 创建一个 Webhook。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-webhook-1.png[]
. 点击 **Create**。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-webhook-2.png[]
. 在弹出的对话框中输入 **Name** 和 **Jenkins Console URL**(即 SonarQube Webhook 地址)。点击 **Create** 完成操作。
=== 步骤 4将 SonarQube 配置添加到 ks-installer
. 执行以下命令编辑 **ks-installer**。
+
--
// Bash
[,bash]
----
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/webhook-page-info.png[]
kubectl edit cc -n kubesphere-system ks-installer
----
--
. 搜寻至 **devops**。添加字段 **sonarqube** 并在其下方指定 **externalSonarUrl** 和 **externalSonarToken**。
+
--
[,yaml]
----
devops:
enabled: true
jenkinsJavaOpts_MaxRAM: 2g
jenkinsJavaOpts_Xms: 512m
jenkinsJavaOpts_Xmx: 512m
jenkinsMemoryLim: 2Gi
jenkinsMemoryReq: 1500Mi
jenkinsVolumeSize: 8Gi
sonarqube: # Add this field manually.
externalSonarUrl: http://10.77.1.201:31377 # The SonarQube IP address.
externalSonarToken: 00ee4c512fc987d3ec3251fdd7493193cdd3b91d # The SonarQube admin token created above.
----
--
. 完成操作后保存此文件。
=== 步骤 5将 SonarQube 服务器添加至 Jenkins
=== 步骤 4将 SonarQube 服务器添加至 Jenkins
. 执行以下命令获取 Jenkins 的地址。
+
@ -229,32 +203,25 @@ devops:
// Bash
[,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services devops-jenkins)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
----
--
. 获取 Jenkins 的端口号。
+
--
// Bash
您将获得如下输出:
[,bash]
----
http://10.77.1.201:30180
----
--
. 参照link:../../03-how-to-use/02-pipelines/07-access-jenkins-console[登录 Jenkins 仪表板]进行配置。
. 使用地址 link:http://NodeIP:30180[] 访问 Jenkins。
+
--
安装 DevOps 时,默认情况下也会安装 Jenkins 仪表板。此外Jenkins 还配置有{ks_product_left} LDAP这意味着您可以直接使用{ks_product_both}账户登录 Jenkins。有关配置 Jenkins 的更多信息,请参阅 link:../../03-how-to-use/02-pipelines/07-jenkins-setting/[Jenkins 系统设置]。
安装 DevOps 时,默认情况下也会安装 Jenkins 仪表板。此外Jenkins 还配置有{ks_product_left} LDAP这意味着您可以直接使用{ks_product_both}账户(例如 `admin/P@88w0rd`登录 Jenkins。有关配置 Jenkins 的更多信息,请参阅 link:../../03-how-to-use/02-pipelines/07-jenkins-setting/[Jenkins 系统设置]。
//note
[.admon.note,cols="a"]
@ -273,37 +240,62 @@ http://10.77.1.201:30180
. 搜寻到 **SonarQube servers**,然后点击 **Add SonarQube**。
. 输入 **Name** 和 **Server URL** (link:http://NodeIP:NodePort[])。 点击**添加**,选择 **Jenkins**,然后在弹出的对话框中用 SonarQube 管理员令牌创建凭证(如下方第二张截图所示)。创建凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。点击**应用**完成操作。
. 输入 **Name** 和 **Server URL** (http://NodeIP:NodePort)。 点击**添加**,选择 **Jenkins**,然后在弹出的对话框中用 SonarQube 管理员令牌创建凭证(如下方第二张截图所示)。创建凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。点击**应用**完成操作。
+
--
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-jenkins-settings.png[,100%]
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/add-credentials.png[,100%]
//note
[.admon.note,cols="a"]
|===
|说明
|
如果点击**添加**按钮无效,前往**系统管理**下的 **Manage Credentials** 并点击 **Stores scoped to Jenkins** 下的 **Jenkins**,再点击**全局凭据 (unrestricted)**,然后点击左侧导航栏的**添加凭据**,参考上方第二张截图用 SonarQube 管理员令牌添加凭证。添加凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。
如果点击**添加**按钮无效,可前往**系统管理**下的 **Manage Credentials** 并点击 **Stores scoped to Jenkins** 下的 **Jenkins**,再点击**全局凭据 (unrestricted)**,然后点击左侧导航栏的**添加凭据**,参考下方第二张截图用 SonarQube 管理员令牌添加凭证。添加凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。
|===
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-jenkins-settings.png[,100%]
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/add-credentials.png[,100%]
--
=== 步骤 5将 SonarQube 配置添加到 DevOps
. 执行以下命令编辑配置字典 `devops-config`。
+
[source,bash]
----
kubectl -n kubesphere-devops-system edit cm devops-config
----
. 在 `devops` 段后添加字段 `sonarQube` 并在其下方指定 `host` 和 `token`。
+
[source,yaml]
----
devops:
host: http://devops-jenkins.kubesphere-devops-system
username: admin
maxConnections: 100
namespace: kubesphere-devops-system
workerNamespace: kubesphere-devops-worker
sonarQube:
host: http://10.77.1.201:31377
token: 00ee4c512fc987d3ec3251fdd7493193cdd3b91d
----
. 完成操作后保存此文件。
=== 步骤 6将 sonarqubeURL 添加到{ks_product_both}控制台
您需要指定 **sonarqubeURL**,以便可以直接从{ks_product_both} Web 控制台访问 SonarQube。
您需要指定 **sonarqubeURL**,以便可以直接从{ks_product_left} Web 控制台访问 SonarQube。
. 执行以下命令:
+
--
// Bash
[,bash]
[,bash]{ks_product_left} Web
----
kubectl editcm -n kubesphere-system ks-console-config
kubectl edit cm -n kubesphere-system ks-console-config
----
--
@ -329,17 +321,13 @@ client:
// Bash
[,bash]
----
kubectl -n kubesphere-devops-system rollout restart deploy devops-apiserver
----
// Bash
[,bash]
----
kubectl -n kubesphere-system rollout restart deploy ks-console
----
@ -363,10 +351,11 @@ image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/token-created.png[,100%]
. 分别选择 **Java** 和 **Maven**复制下图所示绿色框中的序列号。如果要在流水线中使用则需要在link:../../03-how-to-use/05-devops-settings/01-credential-management/[凭证]中添加此序列号。
. 选择 **Maven**复制下图所示绿色框中的序列号。如果要在流水线中使用则需要在link:../../03-how-to-use/05-devops-settings/01-credential-management/[凭证]中添加此序列号。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-example.png[,100%]
== 在{ks_product_both}控制台查看结果
link:../../03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile/[使用 Jenkinsfile 创建流水线]或link:../../03-how-to-use/02-pipelines/01-create-a-pipeline-using-graphical-editing-panel/[使用图形编辑面板创建流水线]之后,即可查看代码质量分析的结果。

View File

@ -88,7 +88,7 @@ sudo systemctl restart docker
== 创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。
. 在 **DevOps 项目设置**下的**凭证**页面为 Harbor 创建凭证。
. 在**创建凭证**页面,设置凭证 ID (**robot-test**)**类型**选择**用户名和密码****用户名**字段必须和您刚刚下载的 JSON 文件中 **name** 的值相同,并在**密码/令牌**中输入 Harbor 令牌文件中 **token** 的值。
@ -128,7 +128,7 @@ pipeline {
HARBOR_NAMESPACE = 'ks-devops-harbor'
// Docker 镜像名称。
APP_NAME = 'docker-example'
// robot-test是您在{ks_product_both} Web 控制台上创建的凭证 ID。
// robot-test是您在{ks_product_left} Web 控制台上创建的凭证 ID。
HARBOR_CREDENTIAL = credentials('robot-test')
}

View File

@ -121,5 +121,5 @@ whizard-telemetry:
// |说明
// |
// 修改 WhizardTelemetry 平台服务的扩展组件配置,可配合 WhizardTelemetry 监控扩展组件,启用 Whizard 可观测中心。有关更多信息,请参阅 link:../07-whizard/01-enable-whizard/[Whizard 可观测中心]。
// 修改 WhizardTelemetry 平台服务的扩展组件配置,可配合 WhizardTelemetry 监控扩展组件,启用 Whizard 可观测中心。有关更多信息,请参阅 link:../../07-whizard/01-enable-whizard/[Whizard 可观测中心]。
// |===

View File

@ -14,7 +14,7 @@ weight: 01
* 已安装 **WhizardTelemetry 平台服务**、 **WhizardTelemetry 监控**以及 **WhizardTelemetry 告警**扩展组件。
* 已在**平台设置 > 许可证**页面导入分布式云可观测中心的 license否则无法看到 Whizard 可观测中心的入口。
// * 已在**平台设置 > 许可证**页面导入分布式云可观测中心的 license否则无法看到 Whizard 可观测中心的入口。
== 操作步骤

View File

@ -27,3 +27,7 @@ helm upgrade --install -n kubesphere-system --create-namespace ks-core https://c
- 修复部分扩展组件页面白屏的问题
- 修复 ks-core 卸载时部分资源残留的问题
- 修复 K8s 1.19 环境无法安装的问题
### 已知问题
- DevOps 中镜像构建器S2I、B2I功能在此版本暂不可用

View File

@ -22,6 +22,8 @@ sectionLink:
- /docs/v4.1/09-project-management/06-project-settings/02-project-roles/01-create-a-project-role.adoc
- /docs/v4.1/06-extension-user-guide/01-install-components-pdf.adoc
- /docs/v4.1/10-toolbox/01-use-kubectl-tool.adoc
- docs/v4.1/11-use-extensions/01-devops/03-how-to-use/02-pipelines/01-create-a-pipeline-using-graphical-editing-panel.adoc
- docs/v4.1/11-use-extensions/01-devops/03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile.adoc
section3:
title: 在云服务上运行 KubeSphere 与 Kubernetes 技术栈

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 KiB

After

Width:  |  Height:  |  Size: 50 KiB