2017-05-03 4 views
1

콩 코스 작업과 작업간에 매개 변수를 전달하는 가장 좋은 방법은 무엇입니까? 예를 들어; 첫 번째 작업에서 고유 한 ID가 생성되면 해당 ID를 다음 작업이나 작업에 전달하는 가장 좋은 방법은 무엇입니까?콩 코스 작업/작업 간 매개 변수 전달

답변

4

동일한 작업 내에서 작업간에 전달하는 중이라면 이슈 (http://concourse.ci/running-tasks.html#outputs)를 사용할 수 있으며 작업간에 전달하는 경우 자원을 사용할 수 있습니다 (git 또는 s3에 넣는 것과 같은). 당신이 작업 사이를 통과하는 경우 예를 들어, 경로 unique-id/에 고유 ID를 포함하는 파일을 넣어하는 작업 파일

--- 
platform: linux 

image_resource: # ... 

outputs: 
- name: unique-id 

run: 
    path: project-src/ci/fill-in-output.sh 

그리고 스크립트 fill-in-output.sh을 가질 수 있습니다. 이를 통해 unique-id 출력을 입력 (http://concourse.ci/running-tasks.html#inputs)으로 사용하고 고유 한 id 파일을 사용하는 다른 작업을 수행 할 수 있습니다.

0

또한 작업 리소스는 파일을 작업 디렉토리에 자동으로 저장합니다. 쉽게 입력을 할 수

jobs: 
- name: build 
    plan: 
    - get: git-some-repo 
    - put: push-some-image 
     params: 
     build: git-some-repo/the-image 
    - task: Use-the-image-details 
     config: 
     platform: linux 
     image_resource: 
      type: docker-image 
      source: 
      repository: alpine 
     inputs: 
      - name: push-some-image 
     run: 
      path: sh 
      args: 
      - -exc 
      - | 
      ls -lrt push-some-image 
      cat push-some-image/repository 
      cat push-some-image/digest 

음 작업의 작업에서 push-some-image

+ cat push-some-image/repository 
xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/path/image 
+ cat push-some-image/digest 
sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
0

데이터 전달에서 이미지 푸시의 세부 정보를 보려면 다음과 같이

예를 들어 내가 파이프 라인 작업을/클라우드 푸 (Clara Fu)가 지적한 것처럼, 결과 산출물 (파일).

작업 간의 경우, 간단한 경우. 'string'데이터가 전달되어야하고, git를 사용하는 것은 잔인한 것이므로 'keyval'리소스 [1]가 좋은 해결책 인 것 같습니다. readme는 데이터가 표준 특성 파일로 저장되고 관리됨을 설명합니다.

  1. https://github.com/SWCE/keyval-resource