Baì này anh/em cần tạo 1 Multibranch Pipeline

Giống như các bài trước là add repo github
https://github.com/mrnim94/pipeline-options-overrideIndexTriggers

nếu có thay đổi thì tự động build trên branch đó

thấy jenkins tạo scheduled trên branch master
nó sẽ triger branch master 1 phút 1 lần
overrideIndexTriggers()
overrideIndexTriggers(false) : sẽ ko triger build
overrideIndexTriggers(true): sẽ triger build
pipeline {
agent any
options {
timestamps()
}
stages {
stage('Build') {
steps {
echo 'Hello World 1'
echo env.BRANCH_NAME
}
}
}
}
Khi bạn thực hiện commit trên branch master
chờ một lúc thấy jenkins auto build

Giờ thêm overrideIndexTriggers(true)
pipeline {
agent any
options {
timestamps()
overrideIndexTriggers(true)
}
stages {
stage('Build') {
steps {
echo 'Hello World 1'
echo env.BRANCH_NAME
}
}
}
}
chờ 1 lúc vẫn thấy auto build
giờ sửa thành echo ‘Hello World 2’
pipeline {
agent any
options {
timestamps()
overrideIndexTriggers(true)
//overrideIndexTriggers(env.BRANCH_NAME == 'thang')
}
stages {
stage('Build') {
steps {
echo 'Hello World 2'
echo env.BRANCH_NAME
}
}
}
}
Vẫn auto build

và sửa thành echo ‘Hello World 3’
Vẫn auto build
chinh overrideIndexTriggers(false)
pipeline {
agent any
options {
timestamps()
overrideIndexTriggers(false)
//overrideIndexTriggers(env.BRANCH_NAME == 'thang')
}
stages {
stage('Build') {
steps {
echo 'Hello World 3'
echo env.BRANCH_NAME
}
}
}
}
vẫn auto build
sửa echo ‘Hello World 4’
pipeline {
agent any
options {
timestamps()
overrideIndexTriggers(false)
//overrideIndexTriggers(env.BRANCH_NAME == 'thang')
}
stages {
stage('Build') {
steps {
echo 'Hello World 4'
echo env.BRANCH_NAME
}
}
}
}
Có vẻ ko tự build

và không tự triger github và build