Gitlab+Jenkins+Pipeline+WebHook+Multibranch - 지속적인 통합 및 자동 게시
[Gitlab + Jenkins + Pipeline + WebHook + Multibranch] - 지속적인 통합 및 자동 게시
본고의 실현:
Jenkins 준비 작업
gitlab
pipeline
- - gitlab
Enable authentication for '/project' end-point
Connection name
및 Gitlab host URL
Gitlab API token
- User settings - Access Tokens
, Token 기록을 작성Test Connection
테스트를 클릭Success
Git
Username with Password
Private
에 속한다면 이 사용자는 반드시 이 프로젝트의 구성원이어야 한다Jenkinsfile 준비 작업
Jenkinsfile Demo 참조
기본 구성:
// gitlab connection, gitlab connection
properties([gitLabConnection('gitlab-bigdata')])
//
checkout scm
// gitlab job
updateGitlabCommitStatus name: 'build', state: 'pending'
//
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'dev' ) {
stage("Build Docker Image"){
echo "build docker image"
echo "Only dev/master branch can build docker image"
}
if(env.BRANCH_NAME == 'dev'){
stage("Deploy to test"){
echo "branch dev to deploy to environment test"
}
stage("Integration test"){
echo "test "
}
}
if(env.BRANCH_NAME == 'master'){
stage("Deploy to prod"){
echo "branch master to deploy to environment prod"
}
stage("Health check"){
echo "prod "
}
}
}
Gitlab 준비
- - - (Admin Area - settings - Network - Outbound requests)
Allow requests to the local network from hooks and services
, 저장Jenkins 작업 트리거 방법 선택
Settings - Integrations
Push events
및 Merge request events
http://JENKINS_URL/project/PROJECT_NAME
When you configure the plugin to trigger your Jenkins job, by following the instructions below depending on job type, it will listen on a dedicated URL for JSON POSTs from GitLab's webhooks. That URL always takes the form http://JENKINS_URL/project/PROJECT_NAME, or http://JENKINS_URL/project/FOLDER/PROJECT_NAME if the project is inside a folder in Jenkins. You should not be using http://JENKINS_URL/job/PROJECT_NAME/build or http://JENKINS_URL/job/gitlab-plugin/buildWithParameters, as this will bypass the plugin completely.
확인
Settings - Integrations
Recent Deliveries
부분, 최근 Trigger 상태200
passed
감사
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.