OpenShift 4 Tekton (4) - Tekton實現包含Gogs+SonaQube+Nexus+Report+WebHook的Pipeline

本實例是siamaksade在其github上的一個Tekton Pipeline演示示例,它是《OpenShift 4之實現一個基於Gogs+Nexus+Sonarqube的Jenkins CI/CD Pipeline》的Tekton升級版本。示例演示了Dev和Stage的CI/CD過程。在這個Tekton Pipeline中集成了Gogs、SonaQube、Nexus、Report等DevOps工具。
在這裏插入圖片描述
主要的配置過程如下:

  1. 在OpenShift上安裝OpenShift Pipeline Operator。
  2. 在客戶機安裝Tekon環境。
$ curl -L https://github.com/tektoncd/cli/releases/download/v0.8.0/tkn_0.8.0_Linux_x86_64.tar.gz | tar -xzf -
$ sudo mv tkn /usr/local/bin/
  1. 下載github項目,然後運行安裝。
$ git clone https://github.com/siamaksade/tekton-cd-demo 
$ cd tekton-cd-demo 
$ demo.sh install --project-prefix <PREFIX>
 
。。。。
############################################################################
############################################################################
  Demo is installed! Give it a few minutes to finish deployments and then:
 
  1) Go to spring-petclinic Git repository in Gogs:
     http://gogs-tkn-cicd.apps.cluster-beijing-0f11.beijing-0f11.example.opentlc.com/gogs/spring-petclinic.git
  2) Log into Gogs with username/password: gogs/gogs
  3) Edit a file in the repository and commit to trigger the pipeline
  4) Check the pipeline run logs in Dev Console or Tekton CLI:
    $ tkn pipeline logs petclinic-deploy-dev -f -n tkn-cicd
 
  You can find further details at:
  PipelineRun Reports: http://reports-repo-tkn-cicd.apps.cluster-beijing-0f11.beijing-0f11.example.opentlc.com
  SonarQube: http://sonarqube-tkn-cicd.apps.cluster-beijing-0f11.beijing-0f11.example.opentlc.com
  Sonatype Nexus: http://nexus-tkn-cicd.apps.cluster-beijing-0f11.beijing-0f11.example.opentlc.com
############################################################################
############################################################################
  1. 在安裝完後,在OpenShift控制檯的Develoer視圖中查看PREFIX-cicd項目的Topology包括以下部署對象。
    在這裏插入圖片描述
    說明:在我安裝的時候曾出現gogs部署找不到gogs-config的情況,可以無需刪除資源再次執行一次安裝。

  2. 根據以上提示用對應用戶訪問Gogs、Nexue、SonaQube、Reports地址。
    其中Gogs上有兩個Repo,其中一個是petclinic應用的源碼,另一個是OpenShift的部署YAML文件。
    在這裏插入圖片描述
    並且spring-petclinic的Repo已經自動配置好了Webhook。
    在這裏插入圖片描述

  3. 運行pipeline,然後在OpenShift控制檯的PREFIX-cicd項目中查看Pipeline運行情況。

$ demo.sh start

Pipeline 運行列表
在這裏插入圖片描述
Pipeline 運行的Task
在這裏插入圖片描述
Pipeline 運行日誌
在這裏插入圖片描述
7. 在Pipeline完成後查看Gogs、Nexue、SonaQube、Reports結果。
Report中的性能報告
在這裏插入圖片描述
在這裏插入圖片描述
8. 在PREFIX-dev和PREFIX-state項目中訪問petclinic應用。
在這裏插入圖片描述
9. 在Gogs中修改下圖路徑中的messages.properties文件內容,將welcome設爲“Welcome Pet Clinic”,然後點擊“Commit Changes”。
在這裏插入圖片描述
10. 確認OpenShift啓動新的Pipeline Run。在運行結束後查看應用已經被更新。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章