Skip to content

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
tools:
# name of the tool
- name: jenkins-pipeline
  # id of the tool instance
  instanceID: default
  # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
  dependsOn: [ ]
  # options for the plugin
  options:
    jenkins:
      # url is used to config jenkins url
      url: http://jenkins.example.com:8080
      # jenkins' user name
      user: admin
      # jenkins namespace in k8s cluster
      namespace: jenkins
      # restart jenkins if true for plugin install
      enableRestart: false
      # jenkins login password
      password: JENKINS_PASSWORD
      # if offline is true, jenkins-pipeline will not install jenkins plugins and share library
      # it will use a local Jenkinsfile for jenkins-pipeline
      offline: false
    scm:
      # scm common field
      branch: YOUR_REPO_BRANCH
      token: YOUR_REPO_SCM_TOKEN
      # you can directly use the url of repo (git@github.com/root/test-exmaple.git for example)
      url: YOUR_REPO_URL
      # or you can config detailed fields for this repo
      owner: YOUR_REPO_OWNER
      org: YOUR_REPO_ORG
      name: YOUR_REPO_NAME
      scmType: github
    pipeline:
      # jobName is jenkins's job name; <jobFolder/jobName> or <jobName>; e.g. jobs/test-job, test-job, jobs2/test-job
      jobName: test-job
      # configLocation is the location of Jenkinsfile, it can be remote or local address
      # if you don't config this field, devstream will use https://raw.githubusercontent.com/devstream-io/dtm-pipeline-templates/main/jenkins-pipeline/general/Jenkinsfile
      configLocation: https://raw.githubusercontent.com/devstream-io/devstream/main/staging/dtm-jenkins-pipeline-example/general/Jenkinsfile
      # language config is required
      language:
        framework: # support gin/flask/spring for now
        name: LANGUAGE # support go/java/nodejs/python for now
      imageRepo:
        # image repo URL for pulling/pushing
        url: http://harbor.example.com:80
        # image repo user name
        user: admin
        # image repo password
        password: YOUR_IMAGE_REPO_PASSWORD
      dingTalk:
        # dingtalk robot name
        name: YOUR_DINGTALK_ROBOT_NAME
        # dingtalk webhook
        webhook: https://oapi.dingtalk.com/robot/send?access_token=changemeByConfig
        # dingtalk securityType, we support "SECRET" and "KEY"
        securityType: YOUR_DINGTALK_SECRET_TYPE
        # dingtalk securityValue
        securityValue: YOUR_DINGTALK_SECRET_VALUE
      sonarqube:
        # sonarqube address
        url: http://sonar.example.com
        # sonarqube token
        token: YOUR_SONAR_TOKEN
        # sonarqube name in jenkins
        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.