✅Settings -> Developer settings -> Personal access tokens -> Tokens (classic)


repo, admin:org, admin:repo_hook 을 선택
- Generic Webhook Trigger Plugin
- GitHub Integration Plugin
- GitHub API Plugin
✅ Jenkins 관리 -> Manage Credentials



Username : 본인의 GitHub 아이디Password : 위에서 발급 받은 GitHub tokenID : Credentials 이름Description : Optional✅{pipeline name} -> Configuration
General - GitHub project - Project url 작성
Project url: GitHub Repository 경로
Repository URL: GitHub Repository 경로.gitCredentials: 위에서 생성한 CredentialsBranch Specifier: trigger BranchScript Path: 루트 프로젝트에서 Jenkinsfile의 경로
✅ 빌드할 directory에서 Jenkinsfile을 작성한다.
ex) 루트 프로젝트/Back-end/Jenkinsfile
pipeline {
agent any
stages {
stage('github-clone') {
steps {
git branch: 'BE', credentialsId: 'github_token', url: '{REPOSITORY URL}'
}
}
// stage...
}
}
✅GitHub의 Repository -> Settings -> Webhooks -> Add webhook


Payload URL : http://Jenkins주소/github-webhook/Content type : application/json