JFrog帮助中心

我们的新门户即将推出!
文档+知识库







概述

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


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

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

页面内容


HelloWorld

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

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

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


HelloWorld
2022世界杯阿根廷预选赛赛程资源:-名称:{{. values . nameprefix}}_bag类型:PropertyBag配置:releaseVersion: "" {{if . values .repo. integrationname}} -名称:{{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo. properties}}。gitProvider: {{. values .repo. integrationname}}分支:包括:{{. values .repo. path}}branchPattern}} {{end}}管道:-名称:{{. values . nameprefix}}_hello_world步骤:-名称:第一类型:Bash {{if . values .repo. integrationname}}配置:inputResources: -名称:{{. values . nameprefix}}_re2022世界杯阿根廷预选赛赛程po {{end}}执行:onStart: - echo "onStart可以用来做一些设置或初始化你的依赖,为执行做准备。"- 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 " onStart或onExecute部分结束失败或错误时onFailure执行"onComplete: - echo "onSuccess或onFailure之后onComplete执行" - name: variable_selection类型:Bash配置:inputSteps: - name: first environmentVariables: forceFail: default: "false"描述:"设置为'true'强制步骤失败"取值:- "false" - "true"执行:onStart: - if [${forceFail} == "true"];然后退出1;fi onExecute: - echo "此步骤将成功" onFailure: - echo "步骤已失败" onSuccess: - echo "步骤已成功"onComplete: - echo "onComplete无论成功或失败都执行。forceFail is ${forceFail}" - name: add_run_variable类型:Bash配置:inputSteps: - name:第一次执行:onStart: - echo "此步骤将保存一个值给运行变量" onExecute: - add_run_variables step_info="runNumber $run_number, step_name $step_name, pipeline_name $pipeline_name" - name: write_to_resource类型:Bash配置:inputSteps: - name: add_run_variable - name: variable_selection outputResources: - name: {{. values . nameprefix}}_bag执行:onStart:2022世界杯阿根廷预选赛赛程- echo "${step_info}" onExecute: - echo "用新的键值对更新资源{{.Values.namePrefix}}_bag " - write_output {{.Values.namePrefix}}_bag "timestamp=$(date +%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 ## #下面的部分是可选的。如果您有一个想要进行#实验的存储库,可以在这里添加它。在创建你的管道源之前,为其中一个源控制提供程序创建一个集成,并把集成名称放在这里。集成名称:myGitIntegration #这是完整的存储库路径。通常是/repo或user/project #,这取决于你使用哪个源代码控制。# branchPattern是一个正则表达式,所以你可以监听所有#特征,例如,使用"^feature "。*",或者你可以# just为单个分支配置它。

GoCI

GoCI模板创建了一个管道,该管道展示了GoBuildGoPublishBinary,GoPublishModule本机的步骤。这些功能包括:

该模板可用于二进制文件、模块,或两者兼而有之,所需的配置因最终目标而异。配置必须包括两者所需的设置GoBuildGoPublishBinaryGoPublishModule并且可以同时包含发布二进制文件和模块。

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

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

发布带有GoBuildGoPublishBinary要求:

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

发布带有GoPublishModule要求:

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

GoCI
2022世界杯阿根廷预选赛赛程—名称:{{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。} gitProvider: {{. values .repo。gitIntegration}}分支:包括:{{. values .repo。branchPattern |默认"main"}} {{if . values。{{if . values . goconfig。-名称:{{. valuesname_prefix}}_binary_info类型:BuildInfo配置:sourceArtifactory: {{. valuesname_prefix}}artIntegration}} -名称:{{. values . nameprefix}}_binary_spec类型:FileSpec配置:sourceArtifactory: {{. values . prefix}}artIntegration}}模式:'{{. values。binaryBuildSpecPattern |默认"*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}} {{if . values . goconfig . conf . conf . conf . conf。moduleTargetRepository}} -名称:{{. values . nameprefix}}_module_info类型:BuildInfo配置:sourceArtifactory: {{. values . info}}-名称:{{. values . nameprefix}}_module_spec类型:FileSpec配置:sourceArtifactory: {{. values . prefix}}artIntegration}}模式:'{{. values。moduleBuildSpecPattern |默认"*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}} {{end}}管道:- name: {{. values . nameprefix}}_go_ci步骤:{{if . values . goconfig . conf}}-名称:构建类型:GoBuild配置:affinityGroup: {{. values . nameprefix}}_go_binary_ci环境变量:JFROG_CLI_BUILD_NAME: {{. values . namprefix}}_go_binary_ci JFROG_CLI_BUILD_NUMBER: ${run_id}集成:-名称:{{. values . repository}} -名称:{{. values . namprefix}}artIntegration}} inputR2022世界杯阿根廷预选赛赛程esources: - name: {{. values . nameprefix}}_repo {{if . values . goconfig .command}} goCommand: {{. values . goconfig .command}} {{end}} {{if . values . goconfig . goconfig . info}sourceLocation}} sourceLocation: {{. values . goconfig。sourceLocation}} {{end}}} {{if . values . goconfig。resolverRepo}} resolverRepo: {{. values . goconfig。resolverRepo}} {{end}} {{if . values . goconfig。outputLocation}} outputLocation: {{. values . goconfig。outputLocation}} {{end}} {{if . values . goconfig。outputFile}} outputFile: {{. values . goconfig。outputFile}} {{end}} - name:发布类型:GoPublishBinary配置:affinityGroup: {{. values . nameprefix}}_go_binary_ci环境变量:JFROG_CLI_BUILD_NAME: {{. values . nameprefix}}_go_binary_ci JFROG_CLI_BUILD_NUMBER: ${run_id}集成:- name: {{. values . prefix}}artIntegration}} inputSteps: - name: build {{if . values。publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources:—名称:{{. values . nameprefix}}_binary_info—名称:{{. values . nameprefix}}_binary_spec {{end}} {{if . values . value . info}publishBuild}} autoppublishbuildinfo: true {{end}} {{if和. values。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} targetRepository: {{. values . goconfig。binarytargetrerepository}} {{if . values。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启用时,将创建一个指向每个已发布构建的FileSpec资源##。在这里,您可以指定一个模式##,以进一步缩小规范引用的工件范围。binaryBuildSpecPattern通过GoPublishBinary步骤过滤包含在FileSpec ##输出中的文件。#binaryBuildSpecPattern: "*" ## moduleBuildSpecPattern过滤包含在GoPublishModule步骤输出的FileSpec ##文件。#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 ## it is executed as `go {{ command }}` 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
  • 发布人工构建并更新输出BuildInfo资源
  • 利用JFrog x射线扫描工件的安全漏洞
  • 写入输出文件规范资源可以连接到另一个管道。

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

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


GradleCI
2022世界杯阿根廷预选赛赛程—名称:{{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。} gitProvider: {{. values .repo。gitIntegration}}分支:包括:{{. values .repo。branchPattern |默认"main"}} {{if . values。publishBuild}} -名称:{{. values . nameprefix}}_info类型:BuildInfo配置:sourceArtifactory: {{. values。artIntegration}} -名称:{{. values . nameprefix}}_spec类型:FileSpec配置:sourceArtifactory: {{. values . prefix}}artIntegration}}模式:'{{. values。buildSpecPattern |默认"*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}}管道:- name: {{. values . nameprefix}}_gradle_ci {{if . values . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value . value。publishBuild}} configuration: environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{end}} steps: - name:构建类型:GradleBuild配置:集成:- name: {{. values . value . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties . properties。inputResources: - name:2022世界杯阿根廷预选赛赛程 {{. values . nameprefix}}_repo {{if . values。publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_info—name: {{. values . nameprefix}}_spec {{end}} {{if . values . prefix}publishBuild}} autoppublishbuildinfo: true {{end}} {{if和. values。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} {{if . values . gradleconfig .command}} gradleccommand: {{. values . gradleconfig .command}} {{end}} {if . values . gradlecconfig .command}}sourceLocation}} sourceLocation: {{. values . gradlecconfig。sourceLocation}} {{end}} {{if . values。useWrapper}} useWrapper: true {{end}} {{if . values . gradlecconfig . conf}}resolverRepo}} resolverRepo: {{. values . gradlecconfig。resolverRepo}} {{end}} {{if . values。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启用时,将创建一个指向已发布构建的FileSpec资源##。在这里,你可以指定一个模式##来进一步缩小规范所引用的构件。#buildSpecPattern: "*" #####存储库详细信息repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" ##### Gradle配置gradleConfig: ##这里你指定要执行的命令##它被执行为' Gradle {{command}} '命令:"hello" sourceLocation: "。"这些存储库必须首先在Artifactory中创建。解析器用于解析依赖项。建议使用远程存储库,以便将任何外部依赖项缓存在本地Artifactory实例中。部署器是上传工件##的地方。resolverRepo: Gradle -remote deployerRepo: Gradle -local ##如果你的项目使用Gradle Wrapper,将useWrapper设置为true

MavenCI

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

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

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

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


MavenCI
2022世界杯阿根廷预选赛赛程—名称:{{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。} gitProvider: {{. values .repo。gitIntegration}}分支:包括:{{. values .repo。branchPattern |默认"main"}} {{if . values。publishBuild}} -名称:{{. values . nameprefix}}_info类型:BuildInfo配置:sourceArtifactory: {{. values。artIntegration}} -名称:{{. values . nameprefix}}_spec类型:FileSpec配置:sourceArtifactory: {{. values . prefix}}artIntegration}}模式:'{{. values。buildSpecPattern |默认“*”}}’buildName: $ {JFROG_CLI_BUILD_NAME} buildNumber: $ {JFROG_CLI_BUILD_NUMBER}{{结束}}管道:-名称:{{.Values.namePrefix}} _maven_ci{{如果. values。publishBuild}} configuration: environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{end}} steps:—name: build type: MvnBuild configuration: integrations:—name: {{. values . values . properties . properties . properties . properties . properties . properties . properties . properties。inputResources: - name:2022世界杯阿根廷预选赛赛程 {{. values . nameprefix}}_repo {{if . values。publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources: - name: {{. values . nameprefix}}_info - name: {{. values . nameprefix}}_spec autoPublishBuildInfo: true {{end}} {{if and . values。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} {{if . values . mavenconfig .command}} mvnCommand: {{. values . mavenconfig .command}} {{end}} {if . values . mavenconfig .command}}sourceLocation}} sourceLocation: {{. values . mavenconfig。sourceLocation}} {{end}}} {{if . values . mavenconfig。resolverSnapshotRepo}} resolverSnapshotRepo: {{. values . mavenconfig。resolverSnapshotRepo}} {{end}} {if . values . mavenconfig .deployerSnapshotRepo}} deployerSnapshotRepo: {{. values . mavenconfig .deployerSnapshotRepo}} {{end}} {if . values . mavenconfig . mavenconfig . resolverSnapshotRepo} {{end}}resolverReleaseRepo}} resolverReleaseRepo: {{. values . mavenconfig。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启用时,将创建一个指向已发布构建的FileSpec资源##。在这里你可以指定一个模式##来进一步缩小由规范引用的工件。#buildSpecPattern: "*" #####存储库详细信息repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" ##### Maven配置mavenConfig: ##在这里你指定命令执行##它被执行为' mvn{{命令}}'命令:clean install sourceLocation: "MavenCI/sample-project" ##这些reppos必须首先在Artifactory中创建。## resolver用于解析依赖项。建议使用远程存储库,以便将任何外部依赖项缓存在本地Artifactory实例中。部署器是上传工件##的地方。resolverSnapshotRepo: maven-snapshot-remote resolverReleaseRepo: maven-release-remote deploersnapshotrepo: maven-snapshot-local deploerreleaserepo: maven-release-local

NpmCI

NpmCI模板创建了一个管道,该管道展示了NpmBuildNpmPublish本机的步骤。这些功能包括:

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

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

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


NpmCI
2022世界杯阿根廷预选赛赛程—名称:{{. values . nameprefix}}_repo类型:GitRepo配置:路径:{{. values .repo。} gitProvider: {{. values .repo。gitIntegration}}分支:包括:{{. values .repo。branchPattern |默认"main"}} {{if . values。publishBuild}} -名称:{{. values . nameprefix}}_info类型:BuildInfo配置:sourceArtifactory: {{. values。artIntegration}} -名称:{{. values . nameprefix}}_spec类型:FileSpec配置:sourceArtifactory: {{. values . prefix}}artIntegration}}模式:'{{. values。buildSpecPattern |默认"*"}}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{end}}管道:- name: {{. values . nameprefix}}_npm_ci配置:affinityGroup: {{. values . nameprefix}}_npm_ci {{if . values . value . prefix}}。publishBuild}} environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{end}} steps:—name:构建类型:NpmBuild配置:集成:—name: {{. values . values . properties . properties . properties . properties . properties . properties . properties . properties。inputResources: - name:2022世界杯阿根廷预选赛赛程 {{. values . nameprefix}}_repo {{if . values . npmconfig。npmArgs}} npmArgs: {{. values . npmconfig。npmArgs}} {{end}}} {{if . values . npmconfig . conf}}sourceLocation}} sourceLocation: {{. values . npmconfig。sourceLocation}} {{end}}} {{if . values . npmconfig . conf}}resolverRepo}} resolverRepo: {{. values . npmconfig。resolverRepo}} {{end}} - name:发布类型:NpmPublish配置:集成:- name: {{. values。artIntegration}} inputSteps: - name: build {{if . values。publishBuild}} outputR2022世界杯阿根廷预选赛赛程esources:—name: {{. values . nameprefix}}_info—name: {{. values . nameprefix}}_spec {{end}} {{if . values . prefix}publishBuild}} autoppublishbuildinfo: true {{end}} {{if和. values。scanBuild . values。publishBuild}} forceXrayScan: true {{end}} {{if . values . npmconfig .deployerRepo}} deployerRepo: {{. values . npmconfig .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启用时,将创建一个指向已发布构建的FileSpec资源##。在这里你可以指定一个模式##来进一步缩小被规范引用的构件。#buildSpecPattern: "*" ##### Repository Details repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" npmConfig: ##这里你指定任何额外的参数来执行命令##它被执行为' npm install {{npmArgs}} ' npmArgs: "——no-install" sourceLocation: "。"这些存储库必须首先在Artifactory中创建。解析器用于解析依赖项。建议使用远程存储库,以便将任何外部依赖项缓存在本地Artifactory实例中。部署器是上传工件##的地方。resolverRepo: npm-remote deployerRepo: npm-local

PromoteCI

PromoteCI模板创建了一个管道,该管道展示了PromoteBuild本机的一步。这些功能包括:

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

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

PromoteCI
2022世界杯阿根廷预选赛赛程资源:—名称:{{. values . nameprefix}}_promotedBuildInfo类型:BuildInfo配置:sourceArtifactory: {{. values . prefix}}artIntegration}}管道:—名称:{{. values . nameprefix}}_promote_ci配置:environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} steps:—名称:promote type: PromoteBuild配置:inputResources:—名称:{{. values . value . propertie2022世界杯阿根廷预选赛赛程s}inputBuildInfoResourceName}} {{if . values。inputBuildInfoResourceBranch}} branch: {{. values。inputBuildInfoResourceBranch}} {{end}} outputRes2022世界杯阿根廷预选赛赛程ources: - name: {{. values . nameprefix}}_promotedBuildInfo targetRepository: {{. values . resourcebranch}}targetrerepository}} {{if . values。includeDependencies}} includeDependencies: {{. values。includeDependencies}} {{end}} {{if . values。status}}状态:{{. values。status}} {{end}} {{if . values .comment}}注释:{{. values .comment}} {{end}} {{if . values .comment}。copy}} copy: {{. values。copy}} {{end}}} {{if . values。failOnValidate}} failOnValidate: {{. values。failOnValidate}} {{end}}


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

values.yml
这个字符串将作为资源和管道的前缀,允许您使用唯一的名称多次添加2022世界杯阿根廷预选赛赛程管道源。您的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需要targetRepositorysourceRepository设置(参见模板自述)和模板版本1.1.0不使用这些设置。

DockerBuildAndPush.yml
2022世界杯阿根廷预选赛赛程- name: {{. values .GitRepo.name | default " gitrepore "}} type: GitRepo配置:gitProvider: {{. values .GitRepo.name}}gitProvider}}路径:{{. values . gitrepo。{{- if (. values . gitrepo .branches.include) (. values . gitrepo .branches.exclude)}}分支:{{- if . values . gitrepo .branches.include){{. values . gitrepo .branches。{{- end}} {{- if . values . gitrepo .branches。{{. values . gitrepo .branches。{{- end}} {{- end}} - name: {{. values .Image.name | default "ImageRes"}}类型:图像配置:注册表:{{. values .name}}artifactoryIntegration}} imageName: {{. values . dockerbuild。dockerImageName}} imageTag: {{. values . dockerbuild。dockerImageTag |默认“最新”}}autoPull: {{.Values.Image。{{- if . values。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集成的名称。存储库。路径:jfrog/jfrog-pipelines-simple-example #必选到SCM存储库的路径。branches: exclude: 'master' # Regex模式排除分支。^{{gitBranch}}$ # 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 " gitrepore "}} type: GitRepo配置:gitProvider: {{. values .GitRepo.name}}gitProvider}}路径:{{. values . gitrepo。{{- if (. values . gitrepo .branches.include) (. values . gitrepo .branches.exclude)}}分支:{{- if . values . gitrepo .branches.include){{. values . gitrepo .branches。{{- end}} {{- if . values . gitrepo .branches。{{. values . gitrepo .branches。{{- end}} {{- end}} {{- if或(. values . gitrepo .files.include) (. values . gitrepo .files.exclude)}}文件:{{- if . values . gitrepo .files.include){{. values . gitrepo .files。include}} {{- end}} {{- if . values . gitrepo .files。{{. values . gitrepo .files。{{- end}} {{- end}} -名称:{{. values .BuildInfo.name |默认"BuildInfoRes"}}类型:BuildInfo配置:sourceArtifactory: {{. values .name}}artifactoryIntegration}} {{- if . 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。* -名称:fooBuild类型:BuildInfo配置:sourceArtifactory: art_v -名称:fooBuildPromote类型:BuildInfo配置:sourceArtifactory: art_v -名称:fooHelmChart类型:HelmChart配置:sourceArtifactory: art_v存储库:simplecharts图表:simplehelm版本:0.3.0管道:-名称:fooHelmDeploy配置:environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: foo JFROG_CLI_BUILD_NUMBER: '${run_number}'步骤:-名称:HelmPublish类型:HelmPublish配置:helmVersion: 3 autoPublishBuildInfo: true chartPath: ./simplehelm lint: false input2022世界杯阿根廷预选赛赛程Resources: - name: fooGitRepo outputResources: - name: fooBuild - name: fooHelmChart - name: fooPromoteBuild类型:PromoteBuild配置:copy: false targetRepository: helm-promote inputResources: - name: fooBuild触发器:true outputResources: - name: fooBuildPromote - name: fooHelmDeploy类型:HelmDeploy配置:environmentVariables: HELM_NAMESPACE:管道-主-池集成:- 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=最新的valuefileppaths: - value。lintFlags: '——strict' test: true

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

values.yml
artifactoryIntegration: artifactory_integration #必需。Artifactory集成的名称。kubernetesIntegration: kubernetes_integration #必选。Kubernetes集成的名称。GitRepo: # Required。name: fooGitRepo # GitRepo资源的名称。默认为gitre毛孔。gitProvider: github # Required。将用于获取SCM存储库的SCM集成的名称。路径:jfrog/jfrog-pipelines-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.yml文件,其中包含全局模板的值。默认情况下,该字段被设置为从根目录获取文件。如果你的values.yml文件存储在不同的目录,输入完整路径。

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

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


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

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

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

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