云客户?
免费开始>
在MyJFrog >中升级
云有什么新>







概述

全局模板是一组随管道一起提供的模板,所有管道用户都可以使用。


若要在添加管道源时使用全局模板,请使用values.yml文件应该在管道源存储库中可用。如下面的示例所示,values.yml文件应该包含全局模板创建管道定义所需的值。

管道目前包括以下全局模板:

页面内容

生活的例子

点击在这里查看这些全局模板的运行情况。


HelloWorld

HelloWorld模板创建一个简单的管道它展示了JFrog管道的一些基本特性。

  • 并行步骤
  • 读取和写入贯穿管道中不同步骤的变量
  • 读取和写入资源2022世界杯阿根廷预选赛赛程
  • 设置环境变量

此模板不需要任何特殊配置或预先存在的集成。


HelloWorld
2022世界杯阿根廷预选赛赛程资源:—name: {{. values . nameprefix}}_bag类型:PropertyBag配置:releaseVersion: "" {{if . values .repo. integrationname}} - name: {{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo. integrationname。getprovider: {{. values .repo. integrationname}}分支:包括:{{. values .repo. integrationname}}branchPattern}} {{end}} pipeline: - name: {{. values . nameprefix}}_hello_world steps: - name: first type: Bash {{if . values .repo. integrationname}} configuration: inputRe2022世界杯阿根廷预选赛赛程sources: - name: {{. values . nameprefix}}_repo {{end}} execution: onStart: - echo "onStart可用于对依赖项进行一些设置或初始化,为执行做准备。"- echo "onExecute是你将发布构建/测试命令的主要部分" - jfrog——version {{if .Values.repo.integrationName}} - echo "{{.Values.namePrefix}}_repo sha is $(find_resource_variable {{.Values.namePrefix}}_repo commitSha)"{{end}} onSuccess: - echo " onStart或onExecute部分完成无错误时执行onSuccess "onFailure: - echo "onFailure如果onStart或onExecute结束失败或错误时执行onFailure ." onComplete: - echo "onComplete在onSuccess或onFailure后执行" - name: variable_selection type: Bash配置:inputSteps: - name: first environmentVariables: forceFail: default: "false" description: "set to 'true'强制步骤失败" values: - "false" - "true"执行:onStart: - if [${forceFail} == "true"];然后退出1;fi onExecute: - echo "This step will succeed" onFailure: - echo "step has failed." onSuccess: - echo "step has succeeded." onComplete: - echo "onComplete无论成功还是失败都会执行。forceFail is ${forceFail}" - name: add_run_variable type: Bash配置:inputSteps: - name:第一次执行:onStart: - echo "This step will save a value to a run variable." onExecute: - add_run_variables step_info="runNumber $run_number, step_name $step_name, pipeline_name $pipeline_name" - name: write_to_resource type: Bash配置:inputSteps: - name: add_run_variable - name: variable_selection outputResources: - name: {{. values . namepr2022世界杯阿根廷预选赛赛程efix}}_bag执行:onStart:- echo "从上一步打印运行变量'step_info' " - echo "${step_info}" onExecute: - echo "更新资源{{.Values.namePrefix}}_bag与新的键/值对" - write_output {{.Values.namePrefix}}_bag "时间戳=$(日期+%s)"- write_output {{. values . nameprefix}}_bag "releaseVersion=${pipeline_name}。${run_number}" - write_output {{ .Values.namePrefix }}_bag "stepInfo=${step_info}" - name: read_from_resource type: Bash configuration: inputResources: - name: {{ .Values.namePrefix }}_bag execution: onExecute: - echo "printing resource details" - echo "Release Version is -- ${res_{{ .Values.namePrefix }}_bag_releaseVersion}" - echo "Release timestamp is -- ${res_{{ .Values.namePrefix }}_bag_timestamp}" - echo "Step Info is -- ${res_{{ .Values.namePrefix }}_bag_stepInfo}"


values.yml这是样品values.yml.可以对该文件进行编辑,以创建您自己的文件版本。

values.yml
#该字符串将作为“HelloWorld”资源和管道的前缀。它将允许您使用唯一的名称多次添加管道namePrefix: intro如果您有一个想要进行实验的存储库,可以在这里添加它。在创建管道源之前,为其中一个源代码控制提供者创建一个集成,并将集成名称放在这里。integrationName: myGitIntegration #这是完整的存储库路径。通常是org/repo或user/ project#,这取决于你使用的源代码控件。# branchPattern是一个正则表达式,所以你可以监听所有的#特性,例如,使用"^feature. path "*",或者你可以#配置它为单个分支branchPattern: "^main$"

GoCI

的特性,GoCI模板创建了一个管道GoBuildGoPublishBinary,GoPublishModule本机的步骤。这些特点包括:

这个模板可以用于二进制文件、模块或两者都可以使用,所需的配置取决于最终目标。配置必须包括所需的设置GoBuild而且GoPublishBinaryGoPublishModule并且可以同时包括发布二进制和模块。

在所有情况下,这些配置必须设置:

  • 一个Artifactory用于解决依赖关系和发布工件的集成
  • Git集成(比如GitHub),可以连接到您的Gradle项目
  • 解析器Artifactory存储库,从中解析依赖项

使用GoBuild而且GoPublishBinary要求:

  • 要发布到的binaryTargetRepository Artifactory存储库
  • 作为GoBuild步骤的一部分运行的命令(“go”后面的部分)
  • 输出文件名

使用GoPublishModule要求:

  • 要发布到的moduleTargetRepository Artifactory存储库
  • 一个版本

生活的例子

点击在这里查看这个全局模板的运行情况。

GoCI
2022世界杯阿根廷预选赛赛程资源:—name: {{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。getprovider: {{. values .repo. pathgitIntegration}}分支:包括:{{. values .repo。如果. values . branchPattern | default "main"}} {{如果. values . goconfig . publishBuild}} {{binaryTargetRepository}} - name: {{. values . nameprefix}}_binary_info type: BuildInfo configuration: sourceArtifactory: {{. values . nameprefix}}artIntegration}} - name: {{. values . nameprefix}}_binary_spec type: FileSpec configuration: sourceArtifactory: {{. values . nameprefix}}artIntegration}}模式:` {{. values。binaryBuildSpecPattern | default "*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}} {{if . values . goconfig .{{如果。moduleTargetRepository}} - name: {{. values . nameprefix}}_module_info type: BuildInfo configuration: sourceArtifactory: {{. values . nameprefix}}artIntegration}} - name: {{. values . nameprefix}}_module_spec type: FileSpec configuration: sourceArtifactory: {{. values . nameprefix}}artIntegration}}模式:` {{. values。moduleBuildSpecPattern | default "*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}} {{end}}管线:- name: {{. values . nameprefix}}_go_ci步骤:{{if . values . goconfig . build_number: ${JFROG_CLI_BUILD_NUMBER}binaryTargetRepository}} - name:构建类型:GoBuild配置:affinityGroup: {{. values . nameprefix}}_go_binary_ci environmentVariables: JFROG_CLI_BUILD_NAME: {{. values . nameprefix}}_go_binary_ci JFROG_CLI_BUILD_NUMBER: ${run_id}集成:—name: {{. values . nameprefix}}artIntegration}} inputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_repo {{if . values . goconfig .command}} goCommand: {{. values . goconfig .command}} {{if . values . goconfig .command}} {{if . values . goconfig .command}}sourceLocation}} sourceLocation: {{. values . goconfig。如果. values . goconfig . sourceLocation}} {{end}} {{resolverRepo}} resolverRepo: {{. values . goconfig。如果. values . goconfig . resolverRepo}} {{end}} {{outputLocation}} outputLocation: {{. values . goconfig . outputLocation:outputLocation}} {{end}} {{if . values . goconfig . outputLocation}} {{outputFile}} outputFile: {{. values . goconfig . outputFile:outputFile}} {{end}} - name:发布类型:gopubblishbinary配置:affinityGroup: {{. values . nameprefix}}_go_binary_ci environmentVariables: JFROG_CLI_BUILD_NAME: {{. values . nameprefix}}_go_binary_ci JFROG_CLI_BUILD_NUMBER: ${run_id}集成:—name: {{. values . build_number: ${run_id}。artIntegration}} inputSteps: - name: build {{if . values . build {{publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_binary_info—name: {{. values . nameprefix}}_binary_spec {{end}} {{if . values . nameprefix}}publishBuild}} autopubishbuildinfo: true {{end}} {{if和. values。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} targetRepository: {{. values . goconfig。如果. values . binaryTargetRepository}} {{publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_binary_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_binary_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }} {{ end }} {{ if .Values.goConfig.moduleTargetRepository }} - name: module type: GoPublishModule configuration: environmentVariables: JFROG_CLI_BUILD_NAME: {{ .Values.namePrefix }}_go_module_ci JFROG_CLI_BUILD_NUMBER: ${run_id} integrations: - name: {{ .Values.artIntegration }} inputResources: - name: {{ .Values.namePrefix }}_repo {{ if .Values.publishBuild }} outputResources: - name: {{ .Values.namePrefix }}_module_info - name: {{ .Values.namePrefix }}_module_spec {{ end }} {{ if .Values.goConfig.sourceLocation }} sourceLocation: {{ .Values.goConfig.sourceLocation }} {{ end }} {{ if .Values.goConfig.version }} version: {{ .Values.goConfig.version }} {{ end }} targetRepository: {{ .Values.goConfig.moduleTargetRepository }} {{ if .Values.goConfig.resolverRepo }} resolverRepo: {{ .Values.goConfig.resolverRepo }} {{ end }} {{ if .Values.publishBuild }} autoPublishBuildInfo: true {{ end }} {{ if and .Values.scanBuild .Values.publishBuild }} forceXrayScan: true {{ end }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_module_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_module_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }} {{ end }}


values.yml这是样品values.yml.可以对该文件进行编辑,以创建您自己的文件版本。

values.yml
##该字符串将作为资源和管道的前缀,允许您使用唯一的名称多次添2022世界杯阿根廷预选赛赛程加##管道源。namePrefix: sample ##您的Artifactory集成的名称artIntegration: myArtIntegrationName ##### Artifactory构建信息##设置为“true”以发布构建#publishBuild: true ##设置为“true”以扫描已发布的构建#scanBuild: true ##当publishBuild启用时,将创建一个指向每个已发布构建的文件pec资源##。在这里,您可以指定一个模式##来进一步缩小由规范引用的工件的范围。binaryBuildSpecPattern过滤了由gopubishbinary步骤输出的文件。moduleBuildSpecPattern过滤了由gopubishmodule步骤输出的文件。#moduleBuildSpecPattern: "*" #####存储库详细信息repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" goConfig: ###用于模块和二进制文件的设置:##源代码在存储库中的位置。命令将在这里执行。sourceLocation:“。”这个存储库,如果指定了,必须首先在Artifactory中创建。解析器用于解析依赖项。 It is recommended to ## use a remote repository so that any external dependencies will be cached ## in your local Artifactory instance. resolverRepo: go-remote ### Settings used only for GoBuild and GoPublishBinary: ## Required to use these steps, the repository to which to upload the binary. ## The repository must first be created in Artifactory. binaryTargetRepository: go-local ## Here you specify any additional arguments to the command to execute command: "build -o $outputLocation/$outputFile" outputLocation: "GoBuild" outputFile: "myOutputFile" ### Settings used only for GoPublishModule: ## Required to use this step, the repository to which to upload the module. ## The repository must first be created in Artifactory. moduleTargetRepository: go-local ## The version specified in the go-publish command. version: v1.0.${run_number}

GradleCI

GradleCI模板创建了一个管道,该管道展示了控件的特性GradleBuild本机的一步。这些特点包括:

  • 构建一个Gradle项目,并将生成的工件推送到Artifactory
  • 发布Artifactory构建并更新输出BuildInfo资源
  • 使用JFrog x射线扫描工件的安全漏洞
  • 写入输出文件规范资源可以连接到另一条管道。

这个模板需要一些配置来设置:

  • 一个Artifactory用于解决依赖关系和发布工件的集成
  • Git集成(比如GitHub),可以连接到您的Gradle项目
  • 解析器和部署器Artifactory库
  • 作为GradleBuild步骤(“Gradle”后面的部分)的一部分运行的Gradle命令


生活的例子

点击在这里到这个全局模板。

GradleCI
2022世界杯阿根廷预选赛赛程资源:—name: {{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。getprovider: {{. values .repo. pathgitIntegration}}分支:包括:{{. values .repo。如果. values . branchPattern | default "main"}} {{publishBuild}} - name: {{. values . nameprefix}}_info类型:BuildInfo配置:sourceArtifactory: {{. values . nameprefix}}artIntegration}} - name: {{. values . nameprefix}}_spec type: FileSpec configuration: sourceArtifactory: {{. values . nameprefix}}artIntegration}}模式:` {{. values。buildSpecPattern | default "*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}}管线:- name: {{. values . nameprefix}}_gradle_ci {{if . values . build_name}}publishBuild}}配置:environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{end}}步骤:—name:构建类型:GradleBuild配置:集成:—name: {{. values。artIntegration}} inputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_repo{{如果. values . nameprefix。publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_info - name: {{. values . nameprefix}}_spec {{end}} {{if . values . nameprefix}}publishBuild}} autopubishbuildinfo: true {{end}} {{if和. values。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} {{if . values . gradleconfig .command}} gradleccommand: {{. values . gradleconfig .command}} {{if . values . gradleconfig .command}} {{if . values . gradleconfig .command}}sourceLocation}} sourceLocation: {{. values . gradlecconfig . zip如果. values . sourceLocation}} {{end}} {{useWrapper}} useWrapper: true {{end}} {{if . values . gradlecconfig . if . value . gradlecconfig . if}} useWrapper: true {{end}}resolverRepo}} resolverRepo: {{. values . gradlecconfig . resolverRepo}}如果. values . resolverRepo}} {{end}} {{gradleConfig.deployerRepo }} deployerRepo: {{ .Values.gradleConfig.deployerRepo }} {{ end }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }}


values.yml这是样品values.yml.可以对该文件进行编辑,以创建您自己的文件版本。

values.yml
##该字符串将作为资源和管道的前缀,允许您使用唯一的名称多次添2022世界杯阿根廷预选赛赛程加##管道源。namePrefix: sample ##您的Artifactory集成的名称artIntegration: myArtIntegrationName ##### Artifactory构建信息##设置为“true”以发布构建#publishBuild: true ##设置为“true”以扫描已发布的构建#scanBuild: true ##当publishBuild启用时,将创建一个指向已发布构建的文件pec资源##。在这里你可以指定一个模式##来进一步缩小由规范引用的工件。#buildSpecPattern: "*" #####仓库详细信息repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" ##### Gradle配置gradleConfig: ##在这里你指定命令来执行命令:"hello" sourceLocation: "。"这些存储库必须首先在Artifactory中创建。解析器用于解析依赖项。建议使用远程存储库,这样任何外部依赖关系都会被缓存到本地Artifactory实例中。部署器是您的Artifacts ##将被上传的地方。resolverRepo: Gradle -remote deployerRepo: Gradle -local ##如果你的项目使用Gradle Wrapper,设置useWrapper为true #useWrapper: true

MavenCI

MavenCI模板创建了一个管道,该管道展示了MvnBuild本机的一步。这些特点包括:

  • 构建Maven项目并将结果工件推到Artifactory
  • 发布Artifactory构建并更新输出BuildInfo资源
  • 使用JFrog x射线扫描工件的安全漏洞
  • 写入输出文件规范资源可以连接到另一条管道

这个模板需要一些配置来设置:

  • 一个Artifactory用于解决依赖关系和发布工件的集成
  • Git集成(比如GitHub),可以连接到您的Maven项目
  • 用于快照和发布的解析器和部署器Artifactory Maven存储库


生活的例子

点击在这里查看这个全局模板的运行情况。

MavenCI
2022世界杯阿根廷预选赛赛程资源:—name: {{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。getprovider: {{. values .repo. pathgitIntegration}}分支:包括:{{. values .repo。如果. values . branchPattern | default "main"}} {{publishBuild}} - name: {{. values . nameprefix}}_info类型:BuildInfo配置:sourceArtifactory: {{. values . nameprefix}}artIntegration}} - name: {{. values . nameprefix}}_spec type: FileSpec configuration: sourceArtifactory: {{. values . nameprefix}}artIntegration}}模式:` {{. values。buildSpecPattern | default "*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}}管线:- name: {{. values . nameprefix}}_maven_ci {{if . values . build_name}}publishBuild}}配置:environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{end}}步骤:—name:构建类型:MvnBuild配置:集成:—name: {{. values。artIntegration}} inputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_repo{{如果. values . nameprefix。publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_info - name: {{. values . nameprefix}}_spec autopubishbuildinfo: true {{end}} {{if和. values . nameprefix。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} {{if . values . mavenconfig .command}} mvnCommand: {{. values . mavenconfig .command}} {{if . values . mavenconfig .command}} {{end}} {{if . values . mavenconfig .command}}sourceLocation}} sourceLocation: {{. values . mavenconfig。如果. values . mavenconfig . sourceLocation}} {{end}} {{resolverSnapshotRepo: {{. values . mavenconfig . resolverSnapshotRepo}}resolverSnapshotRepo}} {{end}} {{if . valuesemavenconfig .deployerSnapshotRepo}} deployerSnapshotRepo: {{. valuesemavenconfig .deployerSnapshotRepo}} {{end}} {{if . valuesmavenconfig . resolverSnapshotRepo}} {{if . valuesmavenconfig .deployerSnapshotRepo}} {{if . valuesmavenconfig .deployerSnapshotRepo}} {{resolverreleasereo}} resolverreleasereo: {{. values . mavenconfig . resolverreleasereo}}resolverReleaseRepo }} {{ end }} {{ if .Values.mavenConfig.deployerReleaseRepo }} deployerReleaseRepo: {{ .Values.mavenConfig.deployerReleaseRepo }} {{ end }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }}


values.yml这是样品values.yml.可以对该文件进行编辑,以创建您自己的文件版本。

values.yml
##资源和管道的前缀2022世界杯阿根廷预选赛赛程它将允许您使用唯一的名称从这个##模板中多次添加管道源。namePrefix: sample ##您的Artifactory集成的名称artIntegration: myArtIntegrationName ##### Artifactory构建信息##设置为“true”以发布构建#publishBuild: true ##设置为“true”以扫描已发布的构建#scanBuild: true ##当publishBuild启用时,将创建一个指向已发布构建的文件pec资源##。在这里你可以指定一个模式##来进一步缩小被规范引用的工件。#buildSpecPattern: "*" #####仓库详细信息repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" ##### Maven配置mavenConfig: ##在这里你指定命令来执行命令:clean install sourceLocation: "MavenCI/sample-project" ##这些repo必须首先在Artifactory中创建。##解析器用于解析依赖项。建议使用远程存储库,这样任何外部依赖关系都会被缓存到本地Artifactory实例中。部署器是您的Artifacts ##将被上传的地方。resolverSnapshotRepo: maven-snapshot-remote resolverreleaserpo: maven-release-remote deployerSnapshotRepo: maven-snapshot-local deployerreleaserpo: maven-release-local

NpmCI

NpmCI模板创建了一个管道,该管道展示了NpmBuild而且NpmPublish本机的步骤。这些特点包括:

  • 构建一个npm项目,并将生成的工件推送到Artifactory
  • 发布Artifactory构建并更新输出BuildInfo资源
  • 使用JFrog x射线扫描工件的安全漏洞
  • 写入输出文件规范资源可以连接到另一条管道。

这个模板需要一些配置来设置:

  • 一个Artifactory用于解决依赖关系和发布工件的集成
  • Git集成(比如GitHub),可以连接到你的NPM项目
  • 解析器和部署器Artifactory库


NpmCI
2022世界杯阿根廷预选赛赛程资源:—name: {{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。getprovider: {{. values .repo. pathgitIntegration}}分支:包括:{{. values .repo。如果. values . branchPattern | default "main"}} {{publishBuild}} - name: {{. values . nameprefix}}_info类型:BuildInfo配置:sourceArtifactory: {{. values . nameprefix}}artIntegration}} - name: {{. values . nameprefix}}_spec type: FileSpec configuration: sourceArtifactory: {{. values . nameprefix}}artIntegration}}模式:` {{. values。buildSpecPattern | default "*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}}管道:- name: {{. values . nameprefix}}_npm_ci配置:affinityGroup: {{. values . nameprefix}}_npm_ci {{if . values . build_name}}publishBuild}} environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{end}}步骤:—name:构建类型:NpmBuild配置:集成:—name: {{. values。artIntegration}} inputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_repo {{if . values . npmconfig . npmconfig . artIntegration}} inputResources:—name: {{. values . nameprefix}npmArgs}} npmArgs: {{. values . npmconfig。如果. values . npmconfig . npmArgs}} {{end}} {{sourceLocation: {{. values . npmconfig . sourceLocation}}如果. values . npmconfig . sourceLocation}} {{end}} {{resolverRepo: {{. values . npmconfig . resolverRepo}}resolverRepo}} {{end}} - name:发布类型:NpmPublish配置:集成:—name: {{. values . conf . conf}}artIntegration}} inputSteps: - name: build {{if . values . build {{publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_info - name: {{. values . nameprefix}}_spec {{end}} {{if . values . nameprefix}}publishBuild}} autopubishbuildinfo: true {{end}} {{if和. values。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} {{if . values . npmconfig .deployerRepo}} deployerRepo: {{. values . npmconfig .deployerRepo}} {{end}} {{if . values . npmconfig .deployerRepo}}publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }}


values.yml这是样品values.yml.可以对该文件进行编辑,以创建您自己的文件版本。

values.yml
##该字符串将作为资源和管道的前缀,允许您使用唯一的名称多次添2022世界杯阿根廷预选赛赛程加##管道源。namePrefix: sample ##您的Artifactory集成的名称artIntegration: myArtIntegrationName ##### Artifactory构建信息##设置为“true”以发布构建#publishBuild: true ##设置为“true”以扫描已发布的构建#scanBuild: true ##当publishBuild启用时,将创建一个指向已发布构建的文件pec资源##。#buildSpecPattern: "*" #####仓库详细信息repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" npmConfig: ##在这里您可以指定执行npmArgs命令的任何额外参数:"——no-install" sourceLocation: "。"这些存储库必须首先在Artifactory中创建。解析器用于解析依赖项。建议使用远程存储库,这样任何外部依赖关系都会被缓存到本地Artifactory实例中。部署器是您的Artifacts ##将被上传的地方。resolverRepo: npm-remote deployerRepo: npm-local

PromoteCI

的特性创建一个管道PromoteBuild本机的一步。这些特点包括:

  • 提升由另一个管道创建的Artifactory构建
  • 更新输出BuildInfo资源使用升级的构建信息
  • 可选地,使用签署了管道可以连接到另一条管道

这个模板需要一些配置来设置:

PromoteCI
2022世界杯阿根廷预选赛赛程资源:—name: {{. values . nameprefix}}_promotedBuildInfo类型:BuildInfo配置:sourceArtifactory: {{. values . nameprefix}}artIntegration}} pipelines:—name: {{. values . nameprefix}}_promote_ci configuration: environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} steps:—name: promote type: PromoteBuild configuration: inputReso2022世界杯阿根廷预选赛赛程urces:—name: {{. values . value . number: ${run_id}如果. values . inputBuildInfoResourceName}} {{inputBuildInfoResourceBranch}}分支:{{. values。inputBuildInfoResourceBranch}} {{end}} outputRes2022世界杯阿根廷预选赛赛程ources:—name: {{. values . nameprefix}}_promotedBuildInfo targetRepository: {{. values . targetRepository。targetRepository}}{{如果. values。includeDependencies}} includeDependencies: {{. values。includeDependencies}} {{end}} {{if . values。status}}状态:{{. values。status}} {{end}} {{if . values .comment}} comment: {{. values .comment}} {{end}} {{if . values .comment。复制:{{. values。如果. values . copy}} {{end}} {{failOnValidate}} failOnValidate: {{. values。failOnValidate}} {{end}}


values.yml这是样品values.yml.可以对该文件进行编辑,以创建您自己的文件版本。

values.yml
##该字符串将作为资源和管道的前缀,允许您使用唯一的名称多次添2022世界杯阿根廷预选赛赛程加##管道源。namePrefix: sample ## Artifactory集成的名称artIntegration: myArtIntegrationName ##引用要提升的构建的BuildInfo资源的名称inputBuildInfoResourceName: myBuildInfo ##如果您的输入BuildInfo资源来自多分支管道源,并且##您希望使用来自另一个分支的资源,请指定该分支名称。# inputBuildInfoResourceBranch: myBranchToUseAsInput # # # # # # #促销信息的存储库,促进构建targetRepository: myPromotionRepo # #设置这个“真实”包括依赖性促进# includeDependencies:真正的# #设置这个“真实”复制和不动提升文件副本:真正的# #设置这个“真实”通过签署验证输入BuildInfo管道# failOnValidate:真正构建# # #促进状态状态:测试构建注释的提升注释:“由运行号${run_number}提升。”

DockerBuildAndPush

DockerBuildAndPush模板创建一个管道,该管道从SCM存储库构建Docker映像,并将其推送到Docker注册表。本模板1.0.0版本使用的是JFrog CLI v1, 1.1.0版本使用的是JFrog CLI v2。模板版本1.0.0要求targetRepository而且sourceRepository设置(见模板自述)和模板版本1.1.0不使用这些设置。

生活的例子

点击在这里查看这个全局模板的运行情况。

DockerBuildAndPush.yml
2022世界杯阿根廷预选赛赛程资源:- name: {{. values .GitRepo.name | default " gitre毛孔"}}类型:GitRepo配置:gitProvider: {{. values .GitRepo.name | default " gitre毛孔"}}gitProvider}}路径:{{. values . gitrepo。path}} {{- if或(. values . gitrepo .branches.include) (. values . gitrepo .branches.exclude)}}分支:{{- if . values . gitrepo .branches.include{{. values . gitrepo .branches. include}}if . values . gitrepo .branches. include}} {{- end}} {{- if . values . gitrepo .branches. include排除}}排除:{{. values . gitrepo .branches。排除}}{{- end}} {{- end}} - name: {{. values .Image.name |默认的“ImageRes”}}类型:镜像配置:注册表:{{. values .name。artifactoryIntegration}} imageName: {{. values . dockerbuild . dockerbuild . dockerbuild . dockerbuild . dockerbuild . dockerbuild。dockerImageName}} imageTag: {{. values . dockerbuild . dockerbuild。dockerImageTag | default "latest"}}自动刷新:{{. values . image . dockerImageTagautopull |默认true}}{{-如果。BuildInfo}} - name: {{ .Values.BuildInfo.name | default "BuildInfo" }} type: BuildInfo configuration: sourceArtifactory: {{ .Values.artifactoryIntegration }} buildName: {{ .Values.DockerPush.name | default "DockerPush" }} buildNumber: {{ .Values.BuildInfo.buildNumber | default 1 }} {{- end }} pipelines: - name: {{ .Values.Pipeline.name | default "Pipeline" }} configuration: jfrogCliVersion: 2 steps: - name: {{ .Values.DockerBuild.name | default "DockerBuild" }} type: DockerBuild configuration: affinityGroup: DockerBuildAndPush dockerFileLocation: {{ .Values.DockerBuild.dockerFileLocation | default "." | quote }} dockerFileName: {{ .Values.DockerBuild.dockerFileName | default "Dockerfile" }} dockerImageName: {{ .Values.DockerBuild.dockerImageName }} dockerImageTag: {{ .Values.DockerBuild.dockerImageTag }} inputResources: - name: {{ .Values.GitRepo.name | default "GitRepoRes" }} integrations: - name: {{ .Values.artifactoryIntegration }} - name: {{ .Values.DockerPush.name | default "DockerPush" }} type: DockerPush configuration: {{- if .Values.BuildInfo }} autoPublishBuildInfo: {{ .Values.BuildInfo.autoPublishBuildInfo | default true }} {{- end }} affinityGroup: DockerBuildAndPush integrations: - name: {{ .Values.artifactoryIntegration }} inputSteps: - name: {{ .Values.DockerBuild.name | default "DockerBuild" }} outputResources: - name: {{ .Values.Image.name | default "ImageRes" }} {{- if .Values.BuildInfo }} - name: {{ .Values.BuildInfo.name | default "BuildInfo" }} {{- end }}


values.yml这是样品values.yml.可以对该文件进行编辑,以创建您自己的文件版本。

values.yml
GitRepo: # Required。name: fooGitRepo # GitRepo资源的名称。默认为gitre毛孔。gitProvider: github # Required。用于获取SCM的SCM集成的名称。存储库。path: jfrog/jfrog- pipes -simple-example #必选项。到SCM存储库的路径。分支:exclude: 'master' #正则表达式模式以排除分支。$ # Regex模式包含分支。 artifactoryIntegration: art # Required. Name of the artifactory integration using which the docker image will be pushed. Image: # Required. name: fooImage # Name of the Image resource. Defaults to ImageRes. autoPull: false # Defaults to true. DockerBuild: # Required. name: foobuild # Name of the DockerBuild step. Defaults to DockerBuild. dockerImageName: foo # Required. Name of the docker image getting built. dockerFileName: foo # Required. Name of the Dockerfile. dockerFileLocation: '.' # Required. Path to Dockerfile. dockerImageTag: ${run_number} # Name of the docker image tag. Defaults to latest. Pipeline: name: foo # Name of the pipeline. Defaults to Pipeline. DockerPush: # Required. name: foopush # Name of the DockerPush step. Defaults to DockerPush. BuildInfo: # Optional, if the BuildInfo needs to be published. autoPublishBuildInfo: true # Defaults to true. name: fooBuildInfo # Name of the BuildInfo resource. Defaults to BuildInfo.

HelmPublishAndDeploy

HelmPublishAndDeploy模板创建了一个管道将Helm Chart发布到Artifactory中的Helm存储库,创建构建信息,提升构建,然后从提升的构建资源使用HelmDeploy本机的一步。本模板1.0.0版本使用的是JFrog CLI v1, 1.1.0版本使用的是JFrog CLI v2。

HelmPublishAndDeploy.yml
2022世界杯阿根廷预选赛赛程资源:- name: {{. values .GitRepo.name | default " gitre毛孔"}}类型:GitRepo配置:gitProvider: {{. values .GitRepo.name | default " gitre毛孔"}}gitProvider}}路径:{{. values . gitrepo。path}} {{- if或(. values . gitrepo .branches.include) (. values . gitrepo .branches.exclude)}}分支:{{- if . values . gitrepo .branches.include{{. values . gitrepo .branches. include}}if . values . gitrepo .branches. include}} {{- end}} {{- if . values . gitrepo .branches. include排除}}排除:{{. values . gitrepo .branches。排除}}{{- end}} {{- end}} {{- if或(. values . gitrepo .files.include) (. values . gitrepo .files.exclude)}}文件:{{- if . values . gitrepo .files.exclude。包含:{{. values . gitrepo .files。if . values . gitrepo .files. include}} {{- end}} {{- if . values . gitrepo .files. include排除}}排除:{{. values . gitrepo .files。排除}}{{- end}} {{- end}} - name: {{. values .BuildInfo.name |默认的"BuildInfoRes"}}类型:BuildInfo配置:sourceArtifactory: {{. values .name。artifactoryIntegration}}{{-如果. values。BuildInfoPromoted }} - name: {{ .Values.BuildInfoPromoted.name | default "BuildInfoPromotedRes" }} type: BuildInfo configuration: sourceArtifactory: {{ .Values.artifactoryIntegration }} {{- end }} - name: {{ .Values.HelmChart.name | default "HelmChartRes" }} type: HelmChart configuration: sourceArtifactory: {{ .Values.artifactoryIntegration }} repository: {{ .Values.HelmChart.repository }} chart: {{ .Values.HelmChart.chartName }} version: {{ .Values.HelmChart.chartVersion }} pipelines: - name: {{ .Values.Pipeline.name | default "HelmDeployPipeline" }} configuration: jfrogCliVersion: 2 {{- if or (.Values.BuildInfo.buildName) (.Values.BuildInfo.buildNumber) }} environmentVariables: readOnly: {{- if .Values.BuildInfo.buildName }} JFROG_CLI_BUILD_NAME: {{ .Values.BuildInfo.buildName }} {{- end }} {{- if .Values.BuildInfo.buildNumber }} JFROG_CLI_BUILD_NUMBER: {{ .Values.BuildInfo.buildNumber }} {{- end }} {{- end }} steps: - name: {{ .Values.HelmPublish.name | default "HelmPublish" }} type: HelmPublish configuration: helmVersion: {{ .Values.HelmChart.helmVersion | default 3 }} autoPublishBuildInfo: true chartPath: {{ .Values.HelmPublish.chartPath }} {{- if .Values.HelmPublish.flags }} flags: {{ .Values.HelmPublish.flags }} {{- end }} {{- if .Values.HelmPublish.valueFilePaths }} valueFilePaths: {{- range $.Values.HelmPublish.valueFilePaths }} - {{ . }} {{- end }} {{- end }} lint: {{ .Values.HelmPublish.lint | default false }} {{- if .Values.HelmPublish.lintFlags }} lintFlags: {{ .Values.HelmPublish.lintFlags }} {{- end }} inputResources: - name: {{ .Values.GitRepo.name | default "GitRepoRes" }} outputResources: - name: {{ .Values.BuildInfo.name | default "BuildInfoRes" }} - name: {{ .Values.HelmChart.name | default "HelmChartRes" }} {{- if and (.Values.PromoteBuild) (.Values.BuildInfoPromoted) }} - name: {{ .Values.PromoteBuild.name | default "PromoteBuild" }} type: PromoteBuild configuration: copy: {{ .Values.PromoteBuild.copy | default false }} targetRepository: {{ .Values.PromoteBuild.targetRepository }} inputResources: - name: {{ .Values.BuildInfo.name | default "BuildInfoRes" }} trigger: {{ .Values.PromoteBuild.autoPromotion | default true }} outputResources: - name: {{ .Values.BuildInfoPromoted.name | default "BuildInfoPromotedRes" }} {{- end }} - name: {{ .Values.HelmDeploy.name | default "HelmDeploy" }} type: HelmDeploy configuration: {{- if .Values.HelmChart.namespace }} environmentVariables: HELM_NAMESPACE: {{ .Values.HelmChart.namespace }} {{- end }} integrations: - name: {{ .Values.kubernetesIntegration }} inputResources: {{- if and (.Values.PromoteBuild) (.Values.BuildInfoPromoted) }} - name: {{ .Values.BuildInfoPromoted.name | default "BuildInfoPromotedRes" }} {{- else }} - name: {{ .Values.BuildInfo.name | default "BuildInfoRes" }} {{- end }} chartPath: {{ .Values.HelmDeploy.chartPath }} chartName: {{ .Values.HelmChart.chartName }} chartVersion: {{ .Values.HelmChart.chartVersion }} helmVersion: {{ .Values.HelmChart.helmVersion | default 3 }} {{- if .Values.HelmDeploy.releaseName }} releaseName: {{ .Values.HelmDeploy.releaseName }} {{- end }} {{- if .Values.HelmChart.namespace }} namespace: {{ .Values.HelmChart.namespace }} {{- end }} {{- if .Values.HelmDeploy.flags }} flags: {{ .Values.HelmDeploy.flags }} {{- end }} {{- if .Values.HelmDeploy.valueFilePaths }} valueFilePaths: {{- range $.Values.HelmDeploy.valueFilePaths }} - {{ . }} {{- end }} {{- end }} lint: {{ .Values.HelmDeploy.lint | default false }} {{- if .Values.HelmDeploy.lintFlags }} lintFlags: {{ .Values.HelmDeploy.lintFlags }} {{- end }} test: {{ .Values.HelmDeploy.test | default false }} {{- if .Values.HelmDeploy.testFlags }} testFlags: {{ .Values.HelmDeploy.testFlags }} {{- end }}
例子
2022世界杯阿根廷预选赛赛程资源:—名称:fooGitRepo类型:GitRepo配置:gitProvider: bb_benha路径:~benha/simplehelm分支:包括:主文件:包括:simplehelm。* - name: fooBuild type: BuildInfo configuration: sourceArtifactory: art_v - name: fooBuildPromote type: BuildInfo configuration: sourceArtifactory: art_v - name: fooHelmChart type: HelmChart configuration: sourceArtifactory: art_v repository: simplecharts chart: simplehelm version: 0.3.0 pipeline: - name: fooHelmDeploy configuration: environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: foo JFROG_CLI_BUILD_NUMBER: '${run_number}' steps: - name: HelmPublish type: HelmPublish configuration:helmVersion: 3 autopubishbuildinfo: true chartPath: ./simplehelm lint: false inputR2022世界杯阿根廷预选赛赛程esources: - name: fooGitRepo outputResources: - name: fooBuild - name: fooHelmChart - name: fooPromoteBuild type: PromoteBuild configuration: copy: false targetRepository: helm-promote inputResources: - name: fooBuildPromote - name: fooHelmDeploy type: HelmDeploy configuration: environmentVariables: HELM_NAMESPACE: pipe-master-pool integrations: - name:k8s input2022世界杯阿根廷预选赛赛程Resources:—name: fooBuildPromote chartPath:。chartName: simplehelm chartVersion: 0.3.0 helmVersion: 3 releaseName: 'simplehelm-${run_id}' flags: >-——force——wait——timeout 900s——set image。Repository = triplejay /simplehelm—set image。tag=latest valuefileppaths: - values。yaml lint: true lintFlags: '——strict'测试:true

values.yml这是一个样本values.yml,您可以编辑它来创建您自己的文件版本。

values.yml
artifactory_integration #必选。Artifactory集成的名称。kubernetesIntegration: kubernetes_integration #必选。Kubernetes集成的名称。GitRepo: # Required。name: fooGitRepo # GitRepo资源的名称。默认为gitre毛孔。gitProvider: github # Required。用于获取SCM存储库的SCM集成的名称。path: jfrog/jfrog- pipes -simple-example #必选项。 Path to the SCM repository. branches: # Optional. exclude: ^master$ # Regex pattern to exclude branches. include: ^{{gitBranch}}$ # Regex pattern to include branches. files: # Optional. exclude: ^fileName$ # Regex pattern to exclude files. include: ^fileName$ # Regex pattern to include files. BuildInfo: # Required. name: fooBuild # Name of the BuildInfo resource. Defaults to BuildInfoRes. buildName: foo # Optional. Name of the Artifactory Build that will be created. Defaults to $pipeline_name. buildNumber: $run_number # Optional. Number of the Artifactory Build that will be created. Defaults to $run_number. BuildInfoPromoted: # Optional. name: fooBuildInfoPromoted # Name of the promoted BuildInfo resource. Defaults to BuildInfoPromotedRes. autoPromotion: false # Optional. When set to false, indicates that Build promotion in the pipeline will be manually triggered. Defaults to true. HelmChart: # Required. name: fooHelmChart # Name of the HelmChart resource. Defaults to HelmChartRes. chartName: foo # Required. Helm chart name. chartVersion: 0.0.1 # Required. Helm chart version. repository: foo # Required. The name of the Helm repository in Artifactory. helmVersion: 3 # Optional. A number representing the major version of Helm to use. Defaults to 3. namespace: foo # Optional. Set the namespace used for the Helm operations. Only supported when used with Helm 3. Pipeline: # Optional. name: foo # Name of the pipeline. Defaults to HelmDeployPipeline. HelmPublish: # Required. name: HelmPublish # Name of the HelmPublish step. Defaults to HelmPublish. chartPath: '.' # Required. The path to the Helm chart YAML in the GitRepo resource. flags: '--app-version=foo' # Optional. Command line options to pass to the helm package command. lint: true # Optional. When set to true performs a lint to examine a Helm chart for possible issues. Defaults to false. lintFlags: '--strict' # Optional. Flag string to pass to the helm lint command. valueFilePaths: # Optional. Specifies values YAML file(s) that will be used in the lint command helm lint command. - values.yaml # Optional. An exmaple of how to add a values YAML file. - values2.yaml # Optional. An exmaple of how to add an additional values YAML file. PromoteBuild: # Optional. name: fooPromoteBuild # Name of the PromoteBuild step. Defaults to PromoteBuild. targetRepository: fooPromote # Required. The name of the repository in Artifactory to promote the build to. copy: false # Optional. When set to true, copies the artifacts to the targetRepository vs moving them to the targetRepository. Defaults to false. HelmDeploy: # Required. name: fooHelmDeploy # Name of the HelmDeploy step. Defaults to HelmDeploy. chartPath: '.' # Required. The path to the Helm chart YAML in the input BuildInfo resource. releaseName: foo # Required. The release name. Equivalent to the --name (-n) option of the helm install command. flags: '--wait --timeout 900s' # Optional. Command line options to pass to the helm upgrade command. lint: true # Optional. When set to true performs a lint to examine a Helm chart for possible issues. Defaults to false. lintFlags: '--strict' # Optional. Flag string to pass to the helm lint command. valueFilePaths: # Optional. Specifies values YAML file(s) for use with a --values (-f) option of the helm lint command. - values.yaml - values2.yaml test: true # Optional. When set to true performs a test to run the tests for release. Defaults to false. testFlags: # Optional. Flag string to pass to the helm test command.

使用全局模板创建管道源(1.31.0及更高版本)

使用全局模板作为管道源:

  1. 在您的SCM存储库中,创建一个名为.jfrog-pipelines

  2. 在目录中,创建两个新文件:

    • pipelines.yml

    • values.yml

  3. pipelines.yml:在pipelines.yml文件:

    valuesFilePath:。/值。Yml包括:template: jfrog//
    例子
    valuesFilePath:。/值。模板:jfrog/HelloWorld/1.0.0


    在哪里

    • jfrog用于全局模板的预定义名称空间。这是强制性的,不能更改。
    • global_template_name要使用的全局模板的名称。去管道|扩展和模板然后点击模板t选项卡找到所有可用的预加载模板。
    • template_version要使用的模板的版本。去管道|扩展和模板然后点击模板选项卡可查找每个模板可用的版本。
    • valuesFilePath这条路在哪里values.yml文件被保存。
  4. values.yml:更新values.yml文件中包含正在使用的全局模板所需的值。有关更多信息,请参见例子values.yml文件
  5. 在JFrog平台中,转到管理→管道→管道源并将管道添加为管道源。有关更多信息,请参见添加管道源
    管道源同步成功后,您可以通过导航到查看新添加的管道我的管道在左侧导航栏上单击管道我的管道
  6. 应用程序→管道→我的管道→所有管道运行管道。

使用全局模板创建管道源(1.30.0及以下版本)

执行以下步骤使用全局模板创建管道源:

  1. 管理|管道|管道源,并单击添加管道源,从模板

  2. 完成结果选择模板形式:



    • 单击选择模板命名空间字段,并选择jfrog名称空间。
    • 单击选择模板名称字段,并选择DockerBuildAndPushHelmPublishAndDeploy全球模板。
    • 单击选择模板版本字段并为模板选择相关的版本。

  3. 点击下一个并完成结果指定值文件以添加values.yml文件。



    • 单击集成字段并选择您的源代码控件集成从下拉列表中。

    • 存储库全名字段时,输入存储库的路径values.yml存储。
    • 指定分支存储库(例如,).
    • 在Values文件路径字段中,提供values.yml文件,其中包含全局模板的值。默认情况下,该字段设置为从根目录获取文件。如果你的values.yml文件存放在不同的目录,请输入完整路径。

      当你这样做的时候values.yml文件将被解析,并根据文件中的配置添加值。

      有关的更多信息指定值文件表单,请参见本节添加管道源


  4. 点击创建源来添加管道源。

管道模板名称、命名空间、版本和的组合values.yml解析以创建管道定义。

管道源同步成功后,您可以通过导航到查看新添加的管道我的管道在左侧导航栏上单击管道我的管道

  • 没有标签
版权所有©2023 JFrog Ltd。