Continuous integration 大堂中放置和输出步骤之间的差异

Continuous integration 大堂中放置和输出步骤之间的差异,continuous-integration,concourse,concourse-git-resource,concourse-pipeline,concourse-task,Continuous Integration,Concourse,Concourse Git Resource,Concourse Pipeline,Concourse Task,有人能告诉我大厅中的PUT步骤和OUTPUT步骤的区别吗?例如,在以下类型的YAML文件中,为什么需要在get之后执行put步骤?我们不能用output代替put?如果不是,那么这两种方法的目的是什么 jobs: - name: PR-Test plan: - get: some-git-pull-request trigger: true - put: some-git-pull-request params: context

有人能告诉我大厅中的
PUT
步骤和
OUTPUT
步骤的区别吗?例如,在以下类型的YAML文件中,为什么需要在
get
之后执行
put
步骤?我们不能用
output
代替
put
?如果不是,那么这两种方法的目的是什么

jobs:
  - name: PR-Test
    plan:
    - get: some-git-pull-request
      trigger: true
    - put: some-git-pull-request
      params:
        context: tests
        path: some-git-pull-request
        status: pending

    ....
     <- some more code to build ->
    ....
作业:
-名称:PR测试
计划:
-获取:一些git请求
触发器:正确
-put:一些git请求
参数:
上下文:测试
路径:一些git请求
状态:待定
....
....

放置步骤的目的是推送到给定的资源,而输出是任务步骤的结果

任务可以配置输出以生成工件,然后这些工件可以传播到同一计划中的put步骤或另一个任务步骤

这意味着您将在GET步骤中指定的资源作为输入发送到任务,以执行构建或脚本执行以及该任务的输出 是一个修改过的资源,如果不想使用put,您可以稍后将其传递到put步骤或另一个任务

这还取决于管道中已定义资源的性质。我假设您有这样一个git类型的资源:

resources:

    - name: some-git-pull-request
      type: git
      source:
        branch:   ((credentials.git.branch))
        uri:      ((credentials.git.uri))
        username: ((credentials.git.username))
        password: ((credentials.git.pass)) 
 jobs:
  - name: PR-Test
    plan:
    - get: some-git-pull-request
      trigger: true 
    - task: test-code
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: yourRepo/yourImage
            tag: latest
        inputs:
          - name: some-git-pull-request                   
        run:
          path: bash  
          args:
          - -exc
          - |  
            cd theNameOfYourRepo
            npm install -g mocha
            npm test
        outputs:
          - name: some-git-pull-request-output
如果这是真的,GET步骤将拉取该repo,以便您可以将其用作任务的输入,如果您对示例代码中描述的同一资源使用PUT,则将推送对repo的更改

实际上,这取决于您想要编写的工作流,但要给出一个想法,它将如下所示:

resources:

    - name: some-git-pull-request
      type: git
      source:
        branch:   ((credentials.git.branch))
        uri:      ((credentials.git.uri))
        username: ((credentials.git.username))
        password: ((credentials.git.pass)) 
 jobs:
  - name: PR-Test
    plan:
    - get: some-git-pull-request
      trigger: true 
    - task: test-code
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: yourRepo/yourImage
            tag: latest
        inputs:
          - name: some-git-pull-request                   
        run:
          path: bash  
          args:
          - -exc
          - |  
            cd theNameOfYourRepo
            npm install -g mocha
            npm test
        outputs:
          - name: some-git-pull-request-output
然后你可以在任何一个看跌期权上使用它

  - put: myCloud
    params:
      manifest: some-git-pull-request-output/manifest.yml
      path: some-git-pull-request-output
或者同一计划中的另一项任务

- task: build-code
  config:
    platform: linux
    image_resource:
      type: docker-image
      source:
        repository: yourRepo/yourImage
        tag: latest
    inputs:
      - name: some-git-pull-request-output                   
    run:
      path: bash  
      args:
      - -exc
      - |  
        cd some-git-pull-request-output/
        npm install
        gulp build

    outputs:
      - name: your-code-build-output    

希望有帮助

放置步骤的目的是推送到给定的资源,而输出是任务步骤的结果

任务可以配置输出以生成工件,然后这些工件可以传播到同一计划中的put步骤或另一个任务步骤

这意味着您将在GET步骤中指定的资源作为输入发送到任务,以执行构建或脚本执行以及该任务的输出 是一个修改过的资源,如果不想使用put,您可以稍后将其传递到put步骤或另一个任务

这还取决于管道中已定义资源的性质。我假设您有这样一个git类型的资源:

resources:

    - name: some-git-pull-request
      type: git
      source:
        branch:   ((credentials.git.branch))
        uri:      ((credentials.git.uri))
        username: ((credentials.git.username))
        password: ((credentials.git.pass)) 
 jobs:
  - name: PR-Test
    plan:
    - get: some-git-pull-request
      trigger: true 
    - task: test-code
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: yourRepo/yourImage
            tag: latest
        inputs:
          - name: some-git-pull-request                   
        run:
          path: bash  
          args:
          - -exc
          - |  
            cd theNameOfYourRepo
            npm install -g mocha
            npm test
        outputs:
          - name: some-git-pull-request-output
如果这是真的,GET步骤将拉取该repo,以便您可以将其用作任务的输入,如果您对示例代码中描述的同一资源使用PUT,则将推送对repo的更改

实际上,这取决于您想要编写的工作流,但要给出一个想法,它将如下所示:

resources:

    - name: some-git-pull-request
      type: git
      source:
        branch:   ((credentials.git.branch))
        uri:      ((credentials.git.uri))
        username: ((credentials.git.username))
        password: ((credentials.git.pass)) 
 jobs:
  - name: PR-Test
    plan:
    - get: some-git-pull-request
      trigger: true 
    - task: test-code
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: yourRepo/yourImage
            tag: latest
        inputs:
          - name: some-git-pull-request                   
        run:
          path: bash  
          args:
          - -exc
          - |  
            cd theNameOfYourRepo
            npm install -g mocha
            npm test
        outputs:
          - name: some-git-pull-request-output
然后你可以在任何一个看跌期权上使用它

  - put: myCloud
    params:
      manifest: some-git-pull-request-output/manifest.yml
      path: some-git-pull-request-output
或者同一计划中的另一项任务

- task: build-code
  config:
    platform: linux
    image_resource:
      type: docker-image
      source:
        repository: yourRepo/yourImage
        tag: latest
    inputs:
      - name: some-git-pull-request-output                   
    run:
      path: bash  
      args:
      - -exc
      - |  
        cd some-git-pull-request-output/
        npm install
        gulp build

    outputs:
      - name: your-code-build-output    
希望有帮助