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







概述

JFrog管线的关键特性之一是能够创建相互连接的管线,称为管线中的管线跨越几个不同的团队、技术平台和工具,使团队能够在相互依赖的项目上进行协作。

考虑SDLC的不同阶段,例如开发、测试、从部署到登台、从部署到验证,等等,每个团队创建数十甚至数百个单独的软件管道。管道中的管道使您能够轻松地连接这些管道,以创建端到端工作流并跨管道交换信息。可以相互连接的管道数量没有限制。可以使用全球资源轻松创建管道中的管道2022世界杯阿根廷预选赛赛程,其中管道更新资源,该资源被用作触发下游管道的输入。

创建管道的管道之后,您可以在r中查看端到端工作流etime,交互式管道仪表板,具有警报和通知,可以轻松识别和升级瓶颈和故障。

页面内容


创建管道的管道

要创建管道的管道,您需要:

  • 至少两条管道
  • 连接这些管道的资源

就像依赖步骤如何使用资源连接一样,依赖管道也使用资源连接。2022世界杯阿根廷预选赛赛程

在下面的图像中,第一个管道(app_dev_pipeline)以输出资源结束app_buildinfo.第二个管道(app_prod_pipeline)以相同的资源开始,将其用作输入资源。


默认情况下,在运行期间,只有当连接管道的资源有新版本时才会触发依赖管道。

例子

这里有两个例子展示了管道中的管道。

示例1

此示例显示了包含8个管道的管道组合管道,使用PropertyBag资源。

在这个例子中:

  • 有三个PropertyBag2022世界杯阿根廷预选赛赛程资源:

    2022世界杯阿根廷预选赛赛程resources:—name: runpopprop type: PropertyBag配置:key1: value1 key2: value2—name: runpopprop2 type: PropertyBag配置:key1: value1 key2: value2—name: runpopprop3 type: PropertyBag配置:key1: value1 key2: value2
  • 有8个相互连接的管道:

    管道:—name: TRIGGER步骤:—name: TRIGGER类型:Bash配置:outputResources:—name: runpopprop执行:on2022世界杯阿根廷预选赛赛程Execute:—write_output runpopprop runId=$run_number—name: TRIGGER_OUT_1_1步骤:—name: TRIGGER_OUT_1类型:Bash配置:inputResources:—name: runpopprop outputResources:—name: runpopprop3执行:onExecute:—printenv#—write_output runpopprop3 runId=$run_number—name: TRIGGER_OUT_3_3步骤:—name: TRIGGER_OUT_1类型:Bash配置:input2022世界杯阿根廷预选赛赛程Resources:—name: runpopprop3执行:onExecute:—printenv - name: TRIGGER_OUT_1_2步骤:—name: TRIGGER_OUT_2类型:Bash配置:inputResources:—name: runpopprop outputResources:—name: runpopprop2环境变量:SOME_KEY: asd执行:onExecute:—printenv - name: TRIGGER_OUT_1_3步骤:—name: TRIGGER_OUT_2类型:Bash配置:inputResources:—name: runpopprop环境变量:SOME_KEY: asd执行:onExecute:—printenv - name: runpopprop2环境变量:SOME_KEY: asd执行:onExecute:—name: runpopprop环境变量:SOME_KEY: asd执行:onExecute:—printenv - name: runpopprop2环境变量TRIGGER_OUT_1_4步骤:—name: TRIGGER_OUT_2 type: Bash配置:inputResources:—name: ru2022世界杯阿根廷预选赛赛程npopprop outputResources:—name: runpopprop2 environmentVariables: SOME_KEY:“asd”执行:onExecute:—printenv - name: TRIGGER_OUT_3_1步骤:—name: TRIGGER_OUT_3_2 type: Bash配置:inputResources:—name: runpopprop2 environmentVariables: SOME_KEY:“asd”执行:onExecute:—printenv - name: TRIGGER_OUT_3_2步骤:—name: TRIGGER_OUT_3_2 type: Bash配置:inputResources:—name: TRIGGER_OUT_3_2步骤:—name: TRIGGER_OUT_2 type: Bash配置:inputResources:—name: runpopprop2 environmentVariables: SOME_KEY: 'asd' execute: onExecute:—printenv .环境变量
  • 管道命名为触发生成一个名为runpopprop
  • 资源runpopprop是这些管道的输入资源:
    • TRIGGER_OUT_1_1
    • TRIGGER_OUT_1_2
    • TRIGGER_OUT_1_3
    • TRIGGER_OUT_1_4
  • 触发管道使用write_output实用函数来触发这四个管道。
  • 资源runpopprop2连接管道TRIGGER_OUT_1_2而且TRIGGER_OUT_1_4到管道TRIGGER_OUT_3_2,但不会触发。
  • 类似地,输出资源runpopprop3来自管道TRIGGER_OUT_1_4不触发管道TRIGGER_OUT_1_4

示例2

此示例显示了包含五条管道的管道的管道,使用几种类型的资源相互连接。2022世界杯阿根廷预选赛赛程

在这个例子中:

  • 这些资源用于2022世界杯阿根廷预选赛赛程连接管道:GitRepoPropertyBag图像BuildInfoReleaseBundleDistributionRule

    2022世界杯阿根廷预选赛赛程资源:—name: myGithub type: GitRepo configuration: gitProvider: myGithub path: RjSH1/pop #branches: #include: {{gitBranch}} - name: myBashPropertyBag type: PropertyBag configuration: key1: value1 key2: value2 - name: myPowerShellPropertyBag type: PropertyBag configuration: key1: value1 key2: value2 - name: myImageResource type: Image configuration: registry: myArtifactory sourceRepository: d-docker-local imageName: icarusjuly30.jfrogdev.org/d-docker-local/myimage imageTag: mytag - name:myImageBuildInfo类型:BuildInfo配置:sourceArtifactory: myArtifactory buildName: my_build buildNumber: 1 - name: myImageReleaseBundle类型:ReleaseBundle配置:sourceDistribution: myDistribution名称:demo_rb版本:v1.0.0 #同一发布包的签名版本- name: mySignedReleaseBundle类型:ReleaseBundle配置:sourceDistribution: myDistribution名称:demo_rb版本:v1.0.0 - name: myDistributionRule类型:DistributionRule配置:sourceDistribution: myDistribution serviceName: "*" siteName: "*" cityName: "*" countryCodes: - "CN" - "GB"
  • 有五个相互连接的管道:

    管路:—name: image_build steps:—name: docker_build type: DockerBuild configuration: affinityGroup: docker_group dockerFileLocation:。dockerFileName: Dockerfile dockerImageName: icarusjuly30.jfrogdev.org/d-docker-local/myimage dockerImageTag: ${run_number} input2022世界杯阿根廷预选赛赛程Resources:—name: myGithub integrations:—name: myArtifactory—name: docker_push type: DockerPush配置:affinityGroup: docker_group targetRepository: d-docker-local autopubishbuildinfo: true integrations:—name: myArtifactory inputSteps:—name: myImageResource—name: myImageBuildInfo—name: bash_ci steps:—name:bash_ci类型:Bash配置:inputResources: - name2022世界杯阿根廷预选赛赛程: myGithub - name: myImageResource outputResources: - name: myBashPropertyBag执行:onExecute: - echo "Testing the image…"- echo "$res_myImageResource_imageTag" - echo "正在更新输出资源…"—write_output myBashPropertyBag runId=$run_number—name: create_release configuration: dependencyMode: waitOnParentSuccess: true steps:—name: bash_step type: Bash configuration: inputResou2022世界杯阿根廷预选赛赛程rces:—name: myImageBuildInfo—name: myBashPropertyBag—name: myPowerShellPropertyBag execution: onExecute:—echo“Bash step”—name: create_bundle type: CreateReleaseBundle configuration: releaseBundleName: myImageReleaseBundle releaseBundleVersion: v1.0。${run_number} dryRun: false sign: true description: "My Docker image ReleaseBundle " inputSteps: - name: bash_step input2022世界杯阿根廷预选赛赛程Resources: - name: myImageBuildInfo outputResources: - name: myImageReleaseBundle - name: sign_release steps: - name: sign type: SignReleaseBundle configuration: inputResources: - name: myImageReleaseBundle outputResources: - name: mySignedReleaseBundle - name: distribute_bundle type: DistributeReleaseBundle configuration: dryRun:- name: myS2022世界杯阿根廷预选赛赛程ignedReleaseBundle触发器:false - name: myDistributionRule

控制管道运行

在配置管道的管道时,您可能希望指定当一个管道相对于由资源连接的其他管道运行时。2022世界杯阿根廷预选赛赛程

dependencyMode标记,该标记可以在pipelines.configuration部分的管道YAML,年代指定一个管道何时可以相对于由资源连接的其他管道运行。2022世界杯阿根廷预选赛赛程它有三种设置:waitOnParentCompletewaitOnParentSuccess,waitOnChildComplete.如果这些设置是真正的,如果一个运行已经在使用相同的资源和步骤等待,则不会为其他管道更新的资2022世界杯阿根廷预选赛赛程源创建新的运行。因此,如果一个管道(名为Pipeline_A)连续运行两次,而下面的管道(名为Pipeline_B)连续运行两次waitOnParentComplete设置为真正的,则Pipeline_B将只运行一次。当管道运行时,它们将使用最新的资源版本。

当您希望确保每个管道步骤的输入资源在步骤开始执行之前处于稳定状态(没有等待或正在进行的运行)时,可以使用这些标记,以防止资源2022世界杯阿根廷预选赛赛程所指向的工件在步骤执行中间发生变化的情况。这在管道创建将覆盖自身的工件的情况下特别有用。例如,带有“最新”标签的Docker图像或每次上传的同名文件。在这些情况下,某些工件可能会在步骤触发后发生更改,从而导致下载的内容不一致。

dependencyMode标签有以下可选的设置

设置 描述 默认的
waitOnParentComplete 如果真正的,当输出资源作为该管道的输入的管道正在运行等待或处理时,该管道将不会开始运行。管道只有在父管道运行完成后才会运行。
waitOnParentSuccess 如果真正的,当输出作为该管道输入的资源的管道执行处理运行或最后一次完整运行未成功时,该管道将不会开始运行。只有在父管道运行成功之后,管道才会运行。但是,如果父管道没有被触发,子管道仍然可以作为一个独立的管道被触发。
waitOnChildComplete 如果真正的,当拥有该管道输出的输入资源的管道运行等待或处理时,该管道将不会开始运行,除非该子管道正在等待该管道完成。该管道将仅在子管道运行完成后运行。
管道:- name: myPipeline configuration:时间顺序:true/false # default false dependencyMode: waitOnParentComplete: true/false # default false waitOnParentSuccess: true/false # default false waitOnChildComplete: true/false # default false steps:…

虽然不建议,如果父管道有waitOnParentCompletewaitOnParentSuccess子管道也有waitOnChildComplete父管道首先运行

例子

例1 -waitOnParentComplete而且waitOnParentSuccess

在本例中,是第一条管道A_parent创建Docker映像。T贺子管道A_waitOnParent直到父管道A_parent的运行成功完成,因为两者waitOnParentComplete而且waitOnParentSuccess设置为真正的A_waitOnParent

2022世界杯阿根廷预选赛赛程resources:—name: dependencyModeImage type:镜像配置:registry: myDocker imageName: jfrog/test imageTag: "0" - name: dependencyModeRepo type: GitRepo configuration: gitProvider: myGithub path: jfrog/dependencyMode branches: include: ^{{gitBranch}}$ pipelines:—name: A_parent steps:—name: createImage type: Bash configuration: inputResources:—name: dependencyModeImage integrations:—name: myDocker execution: onExecute:—docker build -t ${res_dependencyModeImage_imageName}:${run_number}。—docker push ${res_dependencyModeImage_imageName}:${run_number}—write_output dependencyModeImage imageTag=${run_number}—name: A_waitOnParent configuration: dependencyMode: waitOnParentComplete: true waitOnParentSuccess: true steps:—name: pullImage type: Bash configuration: inputResourc2022世界杯阿根廷预选赛赛程es:—name: dependencymodeimage_imagename}:${res_dependencyModeImage_imageTag}

例2 -waitOnChildComplete

在这个例子中,t他父母管道B_waitOnChilD一直等到子管道B_Child的运行结束了,自从waitOnChildComplete设置为真正的B_waitOnChild

2022世界杯阿根廷预选赛赛程resources:—name: dependencyModePropertyBag type: PropertyBag configuration: runNumber: 0 pipelines:—name: B_waitOnChild configuration: dependencyMode: waitOnChildComplete: true steps:—name: updateProperties type: Bash configuration: outputResources:—name: dependencyModePropertyBag execution: onExecute:—write_output dependencyModePropertyBag runNumber=${run_number}—name: B_Child steps:—name: echoProperty type: Bash configuration: inputResources:—name:dependencyModePropertyBag执行:onExecute: - echo ${res_dependencyModePropertyBag_runNumber} - sleep 5 - name: echoComplete类型:Bash配置:inputSteps: - name: echoProperty执行:onExecute: - echo "complete"

查看管路

您的管道中的管道工作流可以像您希望的那样复杂,有几个单独的管道可以跨团队相互连接。的管道图形视图使查看和导航如此复杂的管道变得容易。

图形视图:

  • 显示所有相互连接的管道的组合视图
  • 提供管道和步骤的可视化
  • 显示管道正在使用的管道、资源和互连路径2022世界杯阿根廷预选赛赛程
  • 提供向下钻取单个管道的能力
  • 提供运行的实时更新
  • 显示项目级多管道映射和运行列表

有关更多信息,请参见管道图形视图

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