jenkins-pipeline Plugin

This plugin is used to create a Jenkins Pipeline for Github/Gitlab Repo.

Usage

The following content is an example of the “tool file”.

For more information on the main config, the tool file and the var file of DevStream, see Core Concepts Overview and DevStream Configuration.

YAML

  1. tools:
  2. # name of the tool
  3. - name: jenkins-pipeline
  4. # id of the tool instance
  5. instanceID: default
  6. # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
  7. dependsOn: [ ]
  8. # options for the plugin
  9. options:
  10. jenkins:
  11. # url is used to config jenkins url
  12. url: http://jenkins.example.com:8080
  13. # jenkins' user name
  14. user: admin
  15. # jenkins namespace in k8s cluster
  16. namespace: jenkins
  17. # restart jenkins if true for plugin install
  18. enableRestart: false
  19. # jenkins login password
  20. password: JENKINS_PASSWORD
  21. # if offline is true, jenkins-pipeline will not install jenkins plugins and share library
  22. # it will use a local Jenkinsfile for jenkins-pipeline
  23. offline: false
  24. scm:
  25. # scm common field
  26. branch: YOUR_REPO_BRANCH
  27. token: YOUR_REPO_SCM_TOKEN
  28. # you can directly use the url of repo (git@github.com/root/test-exmaple.git for example)
  29. url: YOUR_REPO_URL
  30. # or you can config detailed fields for this repo
  31. owner: YOUR_REPO_OWNER
  32. org: YOUR_REPO_ORG
  33. name: YOUR_REPO_NAME
  34. scmType: github
  35. pipeline:
  36. # jobName is jenkins's job name; <jobFolder/jobName> or <jobName>; e.g. jobs/test-job, test-job, jobs2/test-job
  37. jobName: test-job
  38. # configLocation is the location of Jenkinsfile, it can be remote or local address
  39. # if you don't config this field, devstream will use https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/jenkins-pipeline/general/Jenkinsfile
  40. configLocation: https://raw.githubusercontent.com/devstream-io/devstream/main/staging/dtm-jenkins-pipeline-example/general/Jenkinsfile
  41. # language config is required
  42. language:
  43. framework: # support gin/flask/spring for now
  44. name: LANGUAGE # support go/java/nodejs/python for now
  45. imageRepo:
  46. # image repo URL for pulling/pushing
  47. url: http://harbor.example.com:80
  48. # image repo user name
  49. user: admin
  50. # image repo password
  51. password: YOUR_IMAGE_REPO_PASSWORD
  52. dingTalk:
  53. # dingtalk robot name
  54. name: YOUR_DINGTALK_ROBOT_NAME
  55. # dingtalk webhook
  56. webhook: https://oapi.dingtalk.com/robot/send?access_token=changemeByConfig
  57. # dingtalk securityType, we support "SECRET" and "KEY"
  58. securityType: YOUR_DINGTALK_SECRET_TYPE
  59. # dingtalk securityValue
  60. securityValue: YOUR_DINGTALK_SECRET_VALUE
  61. sonarqube:
  62. # sonarqube address
  63. url: http://sonar.example.com
  64. # sonarqube token
  65. token: YOUR_SONAR_TOKEN
  66. # sonarqube name in jenkins
  67. name: sonar_test

Notes:

  • scm config option represents codebase location; for more info, you can refer to SCM Config.
  • The pipeline config option controls CI stages; you can refer to Pipeline Config for more info.
  • jenkins.token is the password of jenkins.user.