Bài đầu tiên chúng ta tìm hiểu và ứng dụng share library nhé
1) Overview share library in Jenkins
Trên đây là design tiêu chuẩn.
var: Ở đây định nghĩ global functions mà bạn có thể sử dụng cho script
resources: để chứa mọi thứ mà ko phải là groovy file
src: chứa groovy file để bạn có thể import vào script của bạn.
2) Configure share library and connect to github
3) Practise
3.1) Global function and note
Giờ chúng ta cùng khám phá github
@Library("pipeline-shared-lib") _
pipeline{
agent any
stages{
stage("Build"){
steps{
script{
swissknife.printName 'Nimtechnology'
}
}
}
}
}
anh em để ý @Library(“”) trong đây là cái tên mình đặt cho share library
Ấn build thử sem ntn