Jenkins

Jenkins 빌드 로그를 변수에 저장하기

thxxyj 2023. 8. 8. 14:51
728x90

 

빌드 전체 로그 저장: currentBuild.rawBuild.log

마지막 100 lines를 list 에 저장: currentBuild.rawBuild.getLog(100)

 

def testBuild = build (
    job: "TEST_JOB",
    propagate: false,
    parameters: [
        string(name: "TARGET_NODE", value: "${TARGET_NODE}")
    ]
)
JENKINS_BUILD_URL = testBuild.getAbsoluteUrl()
JENKINS_STATUS = testBuild.getCurrentResult()
JENKINS_LOG = testBuild.rawBuild.log  // 전체 로그 저장
JENKINS_LOG100 = testBuild.rawBuild.getLog(100) // 마지막 로그 100라인을 저장(list type)

 

https://stackoverflow.com/questions/37018509/jenkinsfile-build-log

 

Jenkinsfile build log

Is there any builtin variable that gives access to the text of the currently executing build? I tried using something like currentBuild.log, currentBuild.buildLog but without any luck.

stackoverflow.com

 

 

728x90