2017-04-02 2 views
0

jenkins 파이프 라인 작업에서 github에 대한 자격 증명을 설정하려고합니다. 내 파이프 라인 스크립트에서 다음을 가지고 있습니다 :jenkins 파이프 라인 작업에 github 자격 증명을 제공하려고 시도했습니다.

pipeline { 
    agent any 
    git([url: 'ssh://[email protected]/user/repname/', branch: 'master', credentialsId: 'xxx-xxx-xxx']) 

자격 증명은 어디에서 유래 되었습니까? 이게 젠킨스의 다른 곳에서 만들어 졌나요? 업데이트

: 나는이 페이지에서 자격 증명 ID를 뽑아 : enter image description here

하지만 지금이 오류를보고하고있다 :

Started by user anonymous org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: WorkflowScript: 3: Undefined section "git" @ line 3, column 5.

답변

1

자신을 발견, 그것은 자격 증명에 제공된 자격 증명 아이디입니다 전망.

pipeline { 
    agent any 
    stages { 
     stage('Example') { 
      steps { 
       git([url: 'ssh://[email protected]/user/repname/', branch: 'master', credentialsId: 'xxx-xxx-xxx']) 
      } 
     } 
    } 
} 

일예 : 당신이 선언 파이프 라인을 사용하고 두 번째 문제로

이제, 당신이 다음과 같은 구조를 가지고 있어야합니다 stages, stagesteps 절 (documentation of this can be found here)의 git 단계를 넣어야합니다.

이 또는 당신이 스크립팅 된 파이프 라인을 사용할 수 있습니다, 다음이됩니다 : 당신이 간단한 파이프 라인을 만들 때

node { 
    git([url: 'ssh://[email protected]/user/repname/', branch: 'master', credentialsId: 'xxx-xxx-xxx']) 
} 

을하지만, 다음 선언 파이프 라인을 가지고 좋은 기능을 많이 제공합니다. See my answer here은 선언적 파이프 라인과 스크립트 파이프 라인을 비교합니다.

+0

감사합니다. 오류가 발생했습니다. 지금은 다음에 :) – opike

관련 문제