PUT 步骤的目的是推送到给定资源,而OUTPUT 是TASK 步骤的结果。
任务可以配置输出以生成工件,然后可以将其传播到放置步骤或同一计划中的另一个任务步骤。
这意味着您将在 GET 步骤中指定的资源作为输入发送到任务,以执行构建或脚本执行以及该任务的输出
是修改后的资源,如果您不想使用 PUT,您可以稍后将其传递给您的 put 步骤或另一个 TASK。
这还取决于管道中已定义资源的性质。我假设你有一个像这样的 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 步骤将拉取该 repo,以便您可以将其用作任务的输入,如果您对示例代码中描述的同一资源使用 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
希望对你有帮助!