You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 9
Next »
Jenkins
Jenkins 개요
- Jenkins is a free and open source automation server
- It helps automate the parts of software development related to building, testing and deploying, facilitating continuous integration and continuous delivery
Jenkins 특징
- 오픈소스인 자동화 서버
- 다양한 플러그인 제공
- Pipeline
- Authentication / Authorization
- Git
- Docker
- 다양하게 확장
Jenkins 설치 및 실행 with Docker-compose
version: '3.9'
services:
jenkins:
image: jenkins/jenkins:latest #2.60.3
container_name: jenkins
environment:
- "TZ=Asia/Seoul"
ports:
- "8080:8080"
volumes:
- "./data:/var/jenkins_home"
Jenkins Pipeline of Sample
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
Jenkins Pipeline Syntax
Section
- agent
- pipeline or stage가 실행될 노드 지정
- node
- any
- label
- node
- docker
- dockerfile
- kubernetes
- stages
- steps
- 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
- ...
Jenkins Pipeline Overview