Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Code Block
    pipeline {
    	agent any
    	stages {
    		stage("Build") {
    			steps {
    				echo "Jenkins Pipeline running"
    			}
    		}
    	}
    }

Jenkins Pipeline

Jenkins Pipeline 개요

  • Jenkins 2.x or later (older versions back to 1.642.3 may work but are not recommended)
  • Required Plugin 'Pipeline plugin'
  • Support CD
  • Pipeline as code (DSL, Jenkinsfile)

Jenkins Pipeline Script

  • Scripted pipeline

    • inject groovy script
    • Java API reference
  • Declarative pipeline (recommended)

    • Jenkins DSL
    • Isolate complex logic into Jenkins plugin
  • Image Added
  • Jenkins Pipeline Syntax

    • Section

      • agent
        • pipeline or stage가 실행될 노드 지정
          • node
          • any
          • label
          • node
          • docker
          • dockerfile
          • kubernetes
      • stages
        • 순차적인 작업의 명세인 stage들의 묶음
      • steps
        • stage안에서의 실행되는 단계
      • post
        • 위치에 따라 stages들의 작업이 끝난 후 추가적인 steps 혹은 stage에 steps들의 작업이 끝난 후 추가적인 step
        • Condition
          • always
          • changed
          • fixed
          • regression
          • aborted
          • failure
          • success
          • unstable
          • unsuccessful
          • cleanup
    • Directive

      • parameters
        • key = value
        • pipeline 내부에서 사용할 환경변수
        • credentials()를 통해 Jenkins credential에 접근 가능
      • environments
        • pipeline을 trigger할 때 입력 받아야 할 변수를 정의
        • Type
          • string
          • text
          • booleanParam
          • choice
          • password
      • when
        • stage를 실핼 할 조건 설정
      • ...

Jenkins Pipeline Overview

Image Added