blob: 70577ccdba6727eeea16ef2bf4642b2ec20e1b73 [file] [log] [blame]
Antoine Musso45dd2cb2014-01-29 17:17:43 +01001:title: Zuul Cloner
2
3Zuul Cloner
4===========
5
6Zuul includes a simple command line client that may be used to clone
7repositories with Zuul references applied.
8
9Configuration
10-------------
11
12Clone map
13'''''''''
14
15By default, Zuul cloner will clone the project under ``basepath`` which
16would create sub directories whenever a project name contains slashes. Since
17you might want to finely tweak the final destination, a clone map lets you
18change the destination on a per project basis. The configuration is done using
19a YAML file passed with ``-m``.
20
21With a project hierarchy such as::
22
23 project
24 thirdparty/plugins/plugin1
25
26You might want to get ``project`` straight in the base path, the clone map would be::
27
28 clonemap:
29 - name: 'project'
30 dest: '.'
31
32Then to strip out ``thirdparty`` such that the plugins land under the
33``/plugins`` directory of the basepath, you can use regex and capturing
34groups::
35
36 clonemap:
37 - name: 'project'
38 dest: '.'
39 - name: 'thirdparty/(plugins/.*)'
40 dest: '\1'
41
42The resulting workspace will contains::
43
44 project -> ./
45 thirdparty/plugins/plugin1 -> ./plugins/plugin1
46
47
48Zuul parameters
49'''''''''''''''
50
51The Zuul cloner reuses Zuul parameters such as ZUUL_BRANCH, ZUUL_REF or
52ZUUL_PROJECT. It will attempt to load them from the environment variables or
53you can pass them as parameters (in which case it will override the
54environment variable if it is set). The matching command line parameters use
55the ``zuul`` prefix hence ZUUL_REF can be passed to the cloner using
56``--zuul-ref``.
57
58Usage
59-----
60The general options that apply are:
61
62.. program-output:: zuul-cloner --help
63
K Jonathan Harker676e0302015-10-06 10:10:15 -070064
65Ref lookup order
66''''''''''''''''
67
68The Zuul cloner will attempt to lookup references in this order:
69
70 1) Zuul reference for the indicated branch
71 2) Zuul reference for the master branch
72 3) The tip of the indicated branch
73 4) The tip of the master branch
74
75The "indicated branch" is one of the following:
76
77 A) The project-specific override branch (from project_branches arg)
78 B) The user specified branch (from the branch arg)
79 C) ZUUL_BRANCH (from the zuul_branch arg)
80
Antoine Musso45dd2cb2014-01-29 17:17:43 +010081Clone order
82-----------
83
84When cloning repositories, the destination folder should not exist or
85``git clone`` will complain. This happens whenever cloning a sub project
86before its parent project. For example::
87
88 zuul-cloner project/plugins/plugin1 project
89
90Will create the directory ``project`` when cloning the plugin. The
91cloner processes the clones in the order supplied, so you should swap the
92projects::
93
94 zuul-cloner project project/plugins/plugin1
James E. Blair48ff4d52014-08-25 15:07:21 -070095
96Cached repositories
97-------------------
98
99The ``--cache-dir`` option can be used to reduce network traffic by
100cloning from a local repository which may not be up to date.
101
102If the ``--cache-dir`` option is supplied, zuul-cloner will start by
103cloning any projects it processes from those found in that directory.
104The URL of origin remote of the resulting clone will be reset to use
105the ``git_base_url`` and then the remote will be updated so that the
106repository has all the information in the upstream repository.
Doug Hellmannbd5e4072015-09-04 17:47:24 +0000107
108The default for ``--cache-dir`` is taken from the environment variable
109``ZUUL_CACHE_DIR``. A value provided explicitly on the command line
110overrides the environment variable setting.