大厅中PUT和OUTPUT步骤之间的差异

时间:2019-12-02 15:33:56

标签: continuous-integration concourse concourse-git-resource concourse-pipeline concourse-task

有人可以告诉我Concourse中的 public void paintComponent(Graphics page) { page.setColor(Color.yellow); int[] x = {42,52,72,52,60,40,15,28,9,32,42}; int [] y = {38,62,68,80,105,85,102,75,58,60,38}; page.fillPolygon(x, y, 11); page.setColor(Color.yellow); int[] x1 = {358,341,359,363,377,365,373,355,336,342,320,340}; int[] y1 = {35,55,36,53,57,65,74,67,75,65,58,56}; page.fillPolygon(x, y, 11); 步骤和PUT步骤之间的区别吗?例如,在以下类型的YAML文件中,为什么我们需要在OUTPUT之后执行put步骤?我们不能使用get而不是output吗?如果不是,那么两者的目的是什么?

put

1 个答案:

答案 0 :(得分:1)

PUT 步骤的目的是推送到给定资源,而 OUTPUT TASK 步骤的结果。

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

这意味着您将在 GET 步骤上指定的资源作为输入发送给任务,以执行构建或脚本执行的地方以及该任务的输出 是经过修改的资源,如果您不想使用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)) 

如果这是真的,则GET步骤将拉回该存储库,以便您可以将其用作任务的输入,并且如果对示例代码中描述的相同资源使用PUT,则会将更改推送到您的回购。

确实取决于您要编写的工作流程,但是要给出一个想法,它看起来像这样:

 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上使用它

  - 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    

希望有帮助!