16. Jenkins PipeLine 작성
1. credential 연결
Jenkins 설정에서 GitHub Server정보 입력
2. 파이프라인 생성
깃에서 아래의 간단한 프로젝트를 fork 뜨고 해당 프로젝트로 파이프라인을 만들어보고자한다
https://github.com/11mia/docker-hello-world
GitHub - 11mia/docker-hello-world: Node.js "Hello world"
Node.js "Hello world". Contribute to 11mia/docker-hello-world development by creating an account on GitHub.
github.com
우선, Jenkinsfile로 젠킨스 파이프라인을 작성한 후, 깃에 반영하였다. (git의 소스를 빌드까지만 하고, 배포까진 구현하지 못하였다)
pipeline {
agent any
stages {
stage('git scm update') {
steps {
git url: 'https://github.com/11mia/docker-hello-world.git'
}
}
stage('build'){
steps {
nodejs(nodeJSInstallationName: 'nodejs'){
sh 'npm install'
sh 'npm run'
}
}
}
}
}
파이프라인을 작성하기 위해 new item > pipeline 선택
Node.js 로 작성되었기 때문에 Node.js 플러그인 설치 및 Global Tool Configuration을 설정해준다
# 어디까지 했나

# 참고
CI를 위한 Jenkins, GitHub, Docker Hub 연계
본격적인 CI 구성을 위해 Jenkins와 GitHub 그리고 Docker Hub를 연계하는 방법에 대해 설명한다. k8s 위에 Jenkins를 배포하는 방법에 대해선 이전 포스트를 참고한다. 실습 환경에서 CI는 다음과 같은 일
cwal.tistory.com