문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
ci:jenkins:pipeline [2018/10/02 17:26] kwon37xi |
ci:jenkins:pipeline [2022/05/30 23:10] (현재) kwon37xi [lint] |
||
|---|---|---|---|
| 줄 3: | 줄 3: | ||
| * **Declarative**와 Scripted 파이프라인 두 종류가 있는데, 최신 버전이고 가독성이 더 높은 **Declarative**를 사용하는 것이 좋다. | * **Declarative**와 Scripted 파이프라인 두 종류가 있는데, 최신 버전이고 가독성이 더 높은 **Declarative**를 사용하는 것이 좋다. | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | |||
| + | ===== Snippet Generator ===== | ||
| + | * '' | ||
| + | |||
| + | ===== lint ===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[ci: | ||
| + | |||
| + | ===== 기본 환경변수 ===== | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| ===== Build Parameter | ===== Build Parameter | ||
| 줄 14: | 줄 30: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | |||
| + | ===== Archive Artifact ===== | ||
| + | * [[https:// | ||
| + | < | ||
| + | post { | ||
| + | always { | ||
| + | archiveArtifacts artifacts: ' | ||
| + | junit ' | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| ===== 변수 및 Script in Declarative ===== | ===== 변수 및 Script in Declarative ===== | ||
| 줄 46: | 줄 74: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | ===== 강제 상태변경 ===== | ||
| + | * 상태를 '' | ||
| + | * '' | ||
| + | |||
| + | 혹은 직접 지정 | ||
| + | |||
| + | < | ||
| + | currentBuild.result = ' | ||
| + | </ | ||
| + | |||
| + | ===== Git Branch Parameter ===== | ||
| + | * Git Branch 를 Job Parameter로 지정하고자 한다면, **Lightweight checkout**을 꺼야 한다. | ||
| + | * '' | ||
| + | <code groovy> | ||
| + | stage(' | ||
| + | steps { | ||
| + | git poll: true, | ||
| + | changelog: true, | ||
| + | url: ' | ||
| + | branch: params.GIT_BRANCH | ||
| + | credentialsId: | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Pipeline 에서 입력 값 받기 ===== | ||
| + | * [[https:// | ||
| + | * **입력 값은 '' | ||
| + | |||
| + | ===== JUnit 테스트 결과 메일/ | ||
| + | * [[https:// | ||
| + | * 호출하는 메소드가 금지돼 있어서 whitelist 에 추가 필요해 보임. Build 로그 메시지를 잘 보면, whitelist에 추가 시킬수 있는 admin 페이지로의('' | ||
| + | * 그 뒤에 계속해서 메소드 하나하나마다 추가하라고 나오므로 '' | ||
| + | <?xml version=' | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | * 선언적 파이프라인 구성시에 최상단에('' | ||
| + | |||
| + | <code groovy> | ||
| + | import jenkins.model.* | ||
| + | import hudson.tasks.test.AbstractTestResultAction | ||
| + | |||
| + | String testResultMessage = ' | ||
| + | |||
| + | pipeline { | ||
| + | stages { | ||
| + | |||
| + | stage(' | ||
| + | steps { | ||
| + | junit ' | ||
| + | |||
| + | script { | ||
| + | AbstractTestResultAction testResultAction = currentBuild.rawBuild.getAction(AbstractTestResultAction.class) | ||
| + | if (testResultAction != null) { | ||
| + | def totalNumberOfTests = testResultAction.totalCount | ||
| + | def failedNumberOfTests = testResultAction.failCount | ||
| + | def failedDiff = testResultAction.failureDiffString | ||
| + | def skippedNumberOfTests = testResultAction.skipCount | ||
| + | def passedNumberOfTests = totalNumberOfTests - failedNumberOfTests - skippedNumberOfTests | ||
| + | testResultMessage = " | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | post { | ||
| + | failure { | ||
| + | slackSend(channel: | ||
| + | - 테스트 실패 : ${testResultMessage} | ||
| + | """ | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== parallel pipeline ===== | ||
| + | * [[https:// | ||
| + | * 여러 장비를 [[ci: | ||
| + | * [[https:// | ||
| + | |||
| + | ===== 참조 ===== | ||
| + | * [[https:// | ||
| + | |||