0

Groovy 스크립트를 사용하여 Jenkins userContent 위치에 파일을 업로드하려는 다중 분기 파이프 라인 작업이 있습니다. 나는 userContent 방법을 사용하는 job-dsl-plugin을 시도하지만 오류는 다음과 같이 예외 :jenkins 서버의 userContent에 파일 업로드

java.lang.NoSuchMethodError: No such DSL method 'userContent' found among steps 

참조 : https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-DSL-Commands

내가 userContent에 파일을 업로드하기 위해 무엇을 구성해야합니까? userContent 위치에 파일을 업로드하는 다른 방법이 있습니까?

답변

1

단순히 파이프 라인 DSL과 작업 DSL을 섞어서는 안됩니다. 작업 DSL 빌드 단계를 파이프 라인 단계로 사용하는 방법은 Use Job DSL in Pipeline scripts을 참조하십시오.

node { 
    jobDsl scriptText: 'userContent("test.txt", new ByteArrayInputStream("test".bytes))' 
}