日期:星期三,15 Mar 2023 07:27:14 +0000 (UTC)消息- id: <352054481.32383.1678865234489@confluence1e.prod-use1.jfrog.local>主题:导出从Confluence mime -版本:1.0内容-类型:多部分/相关;border ="----=_Part_32382_423518327.1678865234487" ------=_Part_32382_423518327.1678865234487 Content-Type: text/html;charset=UTF-8 Content-Transfer-Encoding: quote -printable Content-Location: file:///C:/exported.html HelmDeploy

HelmDeploy

= 20
= 20
= 20
= 20

概述

HelmDeploy步骤将Do= cker映像部署到Kubernetes集群使用Helm图。


通过这个本地步骤部署映像的Helm图可以=:

  • 一个HelmChartre= source,通过&= nbsp标识存储在Artifactory存储库中的Helm图;HelmPublish
  • 控件标识的源代码存储库中的Helm图GitRepo资源。

在正确配置后,HelmDeploy步骤还执行replace_envs对= the下指定的所有文件进行操作valueFilePaths标记将这些文件中的所有环境v=变量替换为它们的值。这使该步骤能够从资源中派生=信息,例如从 图像,并使用它来生成部署。

HelmDeploy步骤使用执掌升级命令=执行部署。

从Bash派生的标记

所有本机步骤都派生自&n= bsp;Bash的一步。这意味着所有步骤中的th=都共享来自Bash的相同基本标记集,而本地步骤=也有自己的附加标记,这些标记支持该步骤的特定f= uncfunction。所以熟悉这个很重要Bash步骤定义,因为它是所有其他步骤的th= e定义的核心。

= 20
= 20
= 20
= 20
页面内容
= 20

= 20
= 20
= 20
= 20
= 20
= 20
= 20

YAML模式

HelmDeploy本机步骤的YAML模式如下:

HelmDeploy
= 20
pipeline= s: - name:  steps: - name:  type: HelmDeploy configuration: #从bash继承所有标签;//www.si-fil.com/confluenc= e/display/JFROG/Bash helmVersion: <2 | 3> # optional, defaults = to 2 namespace:  # optional, namespace=部署到其中的flags: = # optional valuefileppaths: # optional -  releaseName: =20 chartPath:  # optional, may be re= required for certain input resources =02022世界杯阿根廷预选赛赛程9=09 chartName:  # optional, may be required for certain input resources =09=09 chartVersion: # optional,可能需要某些输入资源dryRun:  # op2022世界杯阿根廷预选赛赛程tional, only depl= oys if dryRun is success lint:  # lints chart before = upgrade, default false lintFlags: =E2=80=9C——strict=E2=80=9D test:  # runs helm test after te= r upgrade, default false testFlags: =E2=80=9C——parallel=E2=80=9D integrations: - name:  =09=09 # = required =20 inputResources: - name: - name: # required,从这个列表中的一个输入资源= is required =09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09 =09=09=09=09=09=09=09=09=09=09=09=09=09=09=09=09= HelmChart和2022世界杯阿根廷预选赛赛程GitRepo输入资源被允许一起执行:onStart: - echo "准备工作…" onSuccess: - echo "工作做得好!" onFailure: - echo "uh oh,出错了" onComplete: #always - echo "清理一些东西"
= 20
= 20
= 20
= 20
= 20
= 20
= 20

标签

的名字

一个字母数字字符串(允许下划线)tha= t标识步骤。

类型

必须HelmDeploy对于这一步,typ= e。

配置

为步骤的执行环境指定所有配置select= ions。这一步继承了th= eBash/PowerShell=步骤配置标签,包括这些相关的标签:< = / span >

= 20= 20= 20= 20

标签

使用说明

要求=国关/可选的

集成

Mus= t指定aKubernetes集成

必须指定Artifactory集成当=ReleaseBundleinputResource到台阶。

要求=国关


可能需要

input2022世界杯阿根廷预选赛赛程Resources

必须指定HelmChartGitRepo文件规范BuildInfo法则= aseBundle资源,其中包含舵图。
还可以指定s=第二个输入资源类型= GitRepo包含Helm值文件,如果HelmChart作为= other输入资源提供。

要求=艾德

从Bash派生的标记

所有本机步骤都派生自&n= bsp;Bash的一步。这意味着所有步骤中的th=都共享来自Bash的相同基本标记集,而本地步骤=也有自己的附加标记,这些标记支持该步骤的特定f= uncfunction。所以熟悉这个很重要Bash步骤定义,因为它是所有其他步骤的th= e定义的核心。

此外,这些标记可以被de= fine来支持步骤的本机操作:

= 20= 20= 20= 20

标签

使用说明

必需的/可选
helmVersion 代表舵机使用的主要型号的数字。可以是2或3。默认值为2。 可选
名称空间 要部署到的名称空间。=这将作为a添加到deploy命令中——名称空间帕拉=计。 可选
=旗帜 Helm命令中包含的flag=字符串。例如:"——set key=3D=E2= =80=99value=E2=80=99 -f myTestValues.yaml" 可选
= valueFilePaths

指定与&= nbsp的——values (-f)选项一起使用的值YAML文件;舵安装命令。

指定文件中引用的所有环境变量都自动替换为匹配的运行时环境变量的值。=;

可选
releaseName

发布名称。类的——name (-n)选项舵安装命令。

要求
chartPath

通往掌舵的路径图在GitRepo /文件规范/ BuildInfo / = ReleaseBundle指定的资源input2022世界杯阿根廷预选赛赛程Resources=。

当指定了HelmChart资源时不要使用。

可能需要
chartName

掌舵图的名字文件规范/ BuildInfo / Rel = easeBundle指定的资源input2022世界杯阿根廷预选赛赛程Resources

当指定了HelmChart/GitRepo资源或当你的inpu= t资源不是Artifactory Helm存储库时,不要使用。
可能需要
chartVersion

掌舵图的名字文件规范/ BuildInfo / Rel = easeBundle指定的资源input2022世界杯阿根廷预选赛赛程Resources

当指定了HelmChart/GitRepo资源或当你的inpu= t资源不是Artifactory Helm存储库时,不要使用。
可能需要
dryRun

真正的只有在——dry-run install模拟成功时才部署。

Def= aults to

可选
线头

当设置为真正的,执行线头检查图表以找出可能的问题。

默认为

可选
lintFlags 对象要传递的标志字符串榆树绒命令。 可选
测验

当设置为真正的,执行测验为发布运行测试。

默认为

可选
testFlags 对象要传递的标志字符串H =榆木测验命令。 可选

执行

声明在执行前= -和执行后阶段执行的shell命令序列集合:

= 20= 20= 20= 20

标签

使用说明

必需的/可选
onStart 在=本机操作之前执行的命令 可选
调用onSuccess 成功完成后执行的命令 可选
onFailure 在完成失败时执行的命令 可选
onComplete 在任何补全时执行的命令 可选

对象执行的操作onExecute阶段是此步骤类型固有的,不能被覆盖。

保留关键字

onExecuteonStartonSucce =党卫军onFailure,onCompleteAre reserved=关键字。在执行scri= pts的任何其他上下文中使用这些关键字都可能导致意外行为。

= 20
= 20
= 20
= 20
= 20
= 20

例子

下面的示例展示如何配置HelmDeploy步骤。

Helm 3和HelmChart R= source Input

使用Helm 3和HelmChart资源输入的HelmDeploy步骤。

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 3 namespace: my-namespace releaseName: myHelmRelease integrations:—name: kubernetes_integration inputResou2022世界杯阿根廷预选赛赛程rces:—name: helmChartResource
= 20

排练

使用Helm 3和HelmChart资源输入value= s文件的HelmDeploy步骤,并在部署前进行演练。

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 3 namespace: my-namespace releaseName: myHelmRelease dryRun: true valuefileppaths: - values/values1. 2。Yaml - values/values2。yaml集成:—name: kubernetes_integration inputResources:—na2022世界杯阿根廷预选赛赛程me: helmChartResource
= 20

GitRepo输入

一个HelmDeploy步骤,使用GitRepo输入代替HelmChart和lint A = nd test命令。

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 3 namespace: my-namespace chartPath: "。/myChart" releaseName: myHelmRelease lint: true lintFlags: "——strict" test: true testFlags: "——parallel" valuefileppaths: - values/values1. "Yaml - values/values2。yaml集成:—name: kubernetes_integration inputResources:—na2022世界杯阿根廷预选赛赛程me: gitRepoResource
= 20

文件规范输入

一个带有FileSpec输入资源的HelmDeploy步骤。在使用FileSpe= c输入资源时,请使用chartPath属性指定where = Helm图表文件位于FileSpec资源中。如果FileSpec在Artifactory中表示=一个包含Helm图表的Generic存储库,则使用=下面的配置作为参考:

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 3 namespace: my-namespace chartPath: "。/myChart" releaseName: myHelmRelease lint: true lintFlags: "——strict" test: true testFlags: "——parallel" valuefileppaths: - values/values1. "Yaml - values/values2。yaml集成:—name: kubernetes_integration inputResources:—na2022世界杯阿根廷预选赛赛程me: fileSpecResource
= 20

如果FileSpec输入资源表示Art= ifactory中的Helm存储库,您也需要这样做提供= chartName而且chartVersionConf = iguration属性:

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 3 namespace: my-namespace chartPath: "。/myChart" =09=09 chartName: "myChartName" =09=09 chartVersion: 0.0.1 releaseName: myHelmRelease lint: true lintFlags: "--strict" test: true testFlags: "--parallel" valueFilePaths: - values/values1.yaml - values/values2.yaml integrations: - name: kubernetes_integration inputResources: - name: fileSpecResource
= 20

BuildInfo输入

带有BuildInfo输入资源的HelmDeploy步骤。在使用BuildI= nfo输入资源时,使用chartPath属性sp=指定Helm图表文件在BuildInfo资源中的位置。如果B= uildInfo表示Artifactory中包含H= elm图表的通用存储库,则使用以下配置作为参考:

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 3 namespace: my-namespace chartPath: "。/myChart" releaseName: myHelmRelease lint: true lintFlags: "——strict" test: true testFlags: "——parallel" valuefileppaths: - values/values1. "Yaml - values/values2。yaml集成:—name: kubernetes_integration inputResources:—na2022世界杯阿根廷预选赛赛程me: buildInfoResource
= 20

如果BuildInfo输入资源表示Ar= tifactory中的Helm存储库,您也需要这样做提供chartN = ame而且chartVersion配置pr= operties:

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 3 namespace: my-namespace chartPath: "。/myChart" =09=09 chartName: "myChartName" =09=09 chartVersion: 0.0.1 releaseName: myHelmRelease lint: true lintFlags: "--strict" test: true testFlags: "--parallel" valueFilePaths: - values/values1.yaml - values/values2.yaml integrations: - name: kubernetes_integration inputResources: - name: buildInfoResource
= 20

ReleaseBundle输入

带有ReleaseBundle输入资源的HelmDeploy步骤。当使用t= he ReleaseBundle输入资源时,您需要指定Hel= m图表文件在ReleaseBundle资源中的位置chartPath财产。

如果ReleaseBundle在Artifactory=中表示一个包含Helm图表的通用存储库,请使用以下配置作为参考:

需要人工集成

您必须指定Artifactory集成ReleaseBundle&nb = sp;inputResourceHelmDeploy=一步。该集成将指向作为sourc= e的工件,以下载将在此步骤中使用的ReleaseBundle。

HelmDeploy
= 20
pipeline= s:—name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration: helmVersion: 3 namespace: my-namespace chartPath: "。/myChart" releaseName: myHelmRelease lint: true lintFlags: "——strict" test: true testFlags: "——parallel" valuefileppaths: - values/values1. "Yaml - values/values2。yaml集成:—name: kubernetes_integration—name: artifactory_integration inputResources:—name2022世界杯阿根廷预选赛赛程: releaseBundleResource
= 20

如果ReleaseBundle输入resour= ce表示Artifactory中的Helm存储库,您还必须指定i= fychartName而且chartVersion 配置属性:

HelmDeploy
= 20
pipeline= s: -name: helmDeployPipeline =20 steps: -name: helmDeployStep type: HelmDeploy configuration: helmVersion: 3 namespace: my-namespace chartPath: "。/myChart" chartName: "myChartName" chartVersion: 0.0.1 releaseName: myHelmRelease lint: true lintFlags: "--strict" test: true testFlags: "--parallel" valueFilePaths: - values/values1.yaml - values/values2.yaml integrations: - name: kubernetes_integration =09=09=09- name: artifactory_integration=09 inputResources: - name: releaseBundleResource
= 20

执掌2

使用Helm 2的HelmDeploy步骤。

HelmDeploy
= 20
pipeline= s:=20 -name: helmDeployPipeline steps:—name: helmDeployStep type: HelmDeploy configuration:=20 helmVersion: 2 namespace: my-namespace releaseName: myHelmRelease integrations:—name: kubernetes_integration inputResou2022世界杯阿根廷预选赛赛程rces:—name: helmChartResource
= 20
= 20
= 20
= 20
= 20
= 20
= 20

工作原理

当你使用HelmDeploypipe = ine中的本机step,它在后台执行以下功能:

  • Helm init—仅面向客户端(如果Helm版本为2
  • jfrog rt配置(如果有一个HelmChart资源输入,用Artifactory凭据来配置jfrog CLI)
  • jfrog rt使用(如果有HelmChart资源输入,设置=当前默认Artifactory配置
  • 执掌取回(如果有一个HelmChart资源输入an= d Helm版本为2,来获取图表
  • 执掌拉(如果有HelmChart资源输入并且= Helm版本为3,获取图表
  • replace_envs(如果有valuefilepath,替换variab= le占位符)
  • 头盔绒线(如果绒线为真)
  • helm—dry-run(如果dryRun为真)
  • 舵(部署)
  • 头盔测试(如果测试为真)
= 20
= 20
= 20
——= _Part_32382_423518327.1678865234487