NewItem
-> 프로젝트명 입력, Pipeline 선택 -> OK
클릭Build Triggers
Pipeline
Jenkinsfile
입력Jenkinsfile
작성개발 컨테이너 접속
$ docker exec -it myproj /bin/bash
root@myproj:/# cd myproj/
root@myproj:/myproj#
Jenkinsfile 작성
$ vi Jenkinsfile
pipeline {
agent any
stages {
stage('Hello') {
steps {
echo "hello world"
}
}
stage('Good') {
steps {
sh "chmod +x main.sh"
retry(3) {
sh "./main.sh"
}
echo "good day"
}
}
stage('Finish') {
steps {
echo "Finished"
}
}
}
}
원격 저장소 내용 반영
root@myproj:/myproj# git add Jenkinsfile
root@myproj:/myproj# git commit -m "Add Jenkins"
root@myproj:/myproj# git push origin master
최초 연동 시 수동으로 빌드해야 함
지금 빌드
클릭프로젝트 페이지에서 Stage View 확인 가능