SCM

The SCM module allows you to specify the source code location for the project. It adds the scm attribute to the Job definition, which accepts any number of scm definitions.

Note: Adding more than one scm definition requires the Jenkins Multiple SCMs plugin.

Component: scm
Macro:scm
Entry Point:jenkins_jobs.scm

Example:

job:
  name: test_job
  scm:
    -git:
      url: https://example.com/project.git
    -git:
      url: https://example.org/otherproject.git
      basedir: other
git

Specifies the git SCM repository for this job. Requires the Jenkins Git Plugin.

Parameters:
  • url (str) – URL of the git repository
  • refspec (str) – refspec to fetch
  • name (str) – name to fetch
  • branches (list(str)) – list of branch specifiers to build
  • excluded-users (list(str)) – list of users to ignore revisions from when polling for changes. (if polling is enabled)
  • included-regions (list(str)) – list of file/folders to include
  • excluded-regions (list(str)) – list of file/folders to exclude
  • merge (dict) –
    merge:
    • remote (string) - name of repo that contains branch to
      merge to (default ‘origin’)
    • branch (string) - name of the branch to merge to
  • basedir (str) – location relative to the workspace root to clone to (default: workspace)
  • skip-tag (bool) – Skip tagging
  • prune (bool) – Prune remote branches
  • clean (bool) – Clean after checkout
  • fastpoll (bool) – Use fast remote polling
  • disable-submodules (bool) – Disable submodules
  • recursive-submodules (bool) – Recursively update submodules
  • use-author (bool) – Use author rather than committer in Jenkin’s build changeset
  • git-tool (str) – The name of the Git installation to use
  • wipe-workspace (bool) – Wipe out workspace before build
  • browser (str) – what repository browser to use (default ‘(Auto)’)
  • browser-url (str) – url for the repository browser
Browser values:
githubweb:
fisheye:
bitbucketweb:
gitblit:
gitlab:
gitoriousweb:
gitweb:
redmineweb:
viewgit:

Example:

scm:
  - git:
    url: https://example.com/project.git
    branches:
      - master
      - stable
    browser: githubweb
    browser-url: http://github.com/foo/example.git
svn

Specifies the svn SCM repository for this job.

Parameters:
  • url (str) – URL of the svn repository
  • basedir (str) – location relative to the workspace root to checkout to (default ‘.’)
  • workspaceupdater (str) – optional argument to specify how to update the workspace (default wipeworkspace)
  • repos (list) –

    list of repositories to checkout (optional)

    Repo:
    • url (str) – URL for the repository
    • basedir (str) – Location relative to the workspace
      root to checkout to (default ‘.’)
Workspaceupdater values:
 
wipeworkspace:
  • deletes the workspace before checking out
revertupdate:
  • do an svn revert then an svn update
emulateclean:
  • delete unversioned/ignored files then update
update:
  • do an svn update as much as possible

Example:

scm:
  - svn:
     workspaceupdater: update
     repos:
       - url: http://svn.example.com/repo
         basedir: .
       - url: http://svn.example.com/repo2
         basedir: repo2
tfs

Specifies the Team Foundation Server repository for this job. Requires the Jenkins Team Foundation Server Plugin.

NOTE: TFS Password must be entered manually on the project if a user name is specified. The password will be overwritten with an empty value every time the job is rebuilt with Jenkins Job Builder.

Parameters:
  • server-url (str) – The name or URL of the team foundation server. If the server has been registered on the machine then it is only necessary to enter the name.
  • project-path (str) – The name of the project as it is registered on the server.
  • login (str) – The user name that is registered on the server. The user name must contain the name and the domain name. Entered as domain\user or user@domain (optional). NOTE: You must enter in at least two slashes for the domain\user format in JJB YAML. It will be rendered normally.
  • use-update (str) – If true, Hudson will not delete the workspace at end of each build. This causes the artifacts from the previous build to remain when a new build starts. (default true)
  • local-path (str) – The folder where all files will be retrieved into. The folder name is a relative path, under the workspace of the current job. (default .)
  • workspace (str) –

    The name of the workspace under which the source should be retrieved. This workspace is created at the start of a download, and deleted at the end. You can normally omit the property unless you want to name a workspace to avoid conflicts on the server (i.e. when you have multiple projects on one server talking to a Team Foundation Server). (default Hudson-${JOB_NAME}-${NODE_NAME})

    The TFS plugin supports the following macros that are replaced in the workspace name:

    • ${JOB_NAME} - The name of the job.
    • ${USER_NAME} - The user name that the Hudson server or slave is
      running as.
    • ${NODE_NAME} - The name of the node/slave that the plugin currently
      is executed on. Note that this is not the hostname, this value is the Hudson configured name of the slave/node.
    • ${ENV} - The environment variable that is set on the master or slave.
  • web-access (dict) –

    Adds links in “changes” views within Jenkins to an external system for browsing the details of those changes. The “Auto” selection attempts to infer the repository browser from other jobs, if supported by the SCM and a job with matching SCM details can be found. (optional, default Auto).

    web-access value:
     
    • web-url – Enter the URL to the TSWA server. The plugin will strip the last path (if any) of the URL when building URLs for change set pages and other pages. (optional, default uses server-url)

Examples:

scm:
  - tfs:
     server-url: "tfs.company.com"
     project-path: "$/myproject"
     login: "mydomain\\jane"
     use-update: false
     local-path: "../foo/"
     workspace: "Hudson-${JOB_NAME}"
     web-access:
         - web-url: "http://TFSMachine:8080"

scm:
  - tfs:
     server-url: "tfs.company.com"
     project-path: "$/myproject"
     login: "jane@mydomain"
     use-update: false
     local-path: "../foo/"
     workspace: "Hudson-${JOB_NAME}"
     web-access:

scm:
  - tfs:
     server-url: "tfs.company.com"
     project-path: "$/myproject"
     login: "mydomain\\jane"
     use-update: false
     local-path: "../foo/"
     workspace: "Hudson-${JOB_NAME}"

Previous topic

Reporters

Next topic

Triggers

This Page