Author: nim
[Jenkins] Share Libraries 9: Defining Pipeline Script In Call Method
Ở các bài trước thì bạn sẽ thấy script pipeline của mình khá là dài. Bài này script pipeline siêu ngắn. Bạn sẽ thấy là script sẽ thấy call global function execBuildOrDeploy() https://github.com/mrnim94/pipeline-shared-lib/blob/master/vars/execBuildOrDeploy.groovy Chúng ta sẽ định nghĩ pipeline Script trong method Call Save lại và coi thành phả nào
[Grafana/Prometheus] Grafana Chars display “NA” value
1) Problem Vẫn là một ngày đẹp trời.Bạn cần vào các chart Granfana để monitor hệ thống có ngon lành hay ko?Bạn chợt nhận ra 1 điều Prometheus vấn chạy ngon lạnh, không lỗi gì. Vậy thử sem chart đó đang query cái j. Mình tiến hành kiểm tra config map của Prometheus. 2)Resovle problem…
Read More “[Grafana/Prometheus] Grafana Chars display “NA” value” »
[Jenkins] Share Libraries 8: Loading Resources
Như giới thiệu ở bài đầu tiên, thư mục resources chưa các file ko phải là Groovy Trong resources mình để 1 file Json https://github.com/mrnim94/pipeline-shared-lib/blob/master/resources/com/acceleratedskillup/request.json giờ chúng ta có script như sau: Giờ save material reference about libraryResoucehttps://www.jenkins.io/doc/book/pipeline/shared-libraries/#loading-resourceshttps://www.jenkins.io/doc/pipeline/steps/workflow-cps-global-lib/ Chúng ta có vẫn đề là bạn thấy jenkins master sẽ control jenkins agent.nhưng mà jenkins agent…
Read More “[Jenkins] Share Libraries 8: Loading Resources” »
[Jenkins] Share Libraries 7: Importing Third-Party Libraries
Groovy họ hàng với Java đúng ko anh em?Chúng ta có thể import được các package của java Nếu anh em đã uncheck thì log của chúng ta như sau:
[Jenkins] Share Libraries 6: Closures
Chúng ta có file groovy trong share library trên github – Khép kín https://github.com/mrnim94/pipeline-shared-lib/blob/master/vars/executeInScript.groovy chúng ta có thấy điều đặc biệt là họ chuyền luôn block script vào trong file grooy luôn Dưới này là file script của chúng ta. Ở đây chúng ta thấy truyền string { sh ‘printenv’ } vào body của func…
[Jenkins] Share Libraries 5: Custom Steps
Chúng ta có file sau trên share library:https://github.com/mrnim94/pipeline-shared-lib/blob/master/vars/execMaven.groovy Tạo pipeline: Các bạn để ý ở đây nim có sử dụng underscore thì chúng ta đang sử dùng global function trong thư mục var save và buid
[Jenkins] Share Libraries 4: Importing Static Libraries
Ở đây chúng ta có 1 single static method hay func. https://github.com/mrnim94/pipeline-shared-lib/blob/master/src/com/acceleratedskillup/ValidatorUtils.groovy Chúng ta tạo 1 pipeline scipt theo như suy luận thì bạn thấy validateInput(this)có chứ this đúng không?nghĩ là block script{} sẽ được đưa vào func validateInput như 1 parameter.ở file groovy thì nó sử dụng script.echo “in static validateInput()” nên là groovy…
Read More “[Jenkins] Share Libraries 4: Importing Static Libraries” »
[Jenkins] Share Libraries 3: Import library class.
Bài này khó vl các bạn ạ.Mình không rành java nên mình hiểu đến đâu mình giải thích đến đó nhé. Mong các bạn thông cảm. groovy file trên share library của chúng ta https://github.com/mrnim94/pipeline-shared-lib/blob/master/src/com/acceleratedskillup/Car.groovy In this function, we are using the echo step from the script object to print out the properties. Bài này…
Read More “[Jenkins] Share Libraries 3: Import library class.” »