aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/README.md
blob: 1fb8f9e11b73d74b58419f25ce0ba4d0a6c50a9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cgit repos
==========

[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/egortensin/pull-cgit-repos?label=Docker)](https://hub.docker.com/repository/docker/egortensin/pull-cgit-repos/builds)

Mirror a list of git repositories and make them available for consumption by
cgit.

Usage
-----

Adjust the config in [examples/cgit-repos.conf] and pass it using the
`--config` parameter:

    > python3 -m pull.main --config path/to/cgit-repos.conf

The repository list is stored in my_repos.py (the `my_repos` setting in the
config).
See [examples/my_repos.py] for an example.

pull/main.py calls git, which might call ssh internally.
Make sure the required keys are loaded to a ssh-agent.

[examples/cgit-repos.conf]: examples/cgit-repos.conf
[examples/my_repos.py]: examples/my_repos.py

### Docker

The image is **egortensin/pull-cgit-repos**.
The container reads the config from */etc/cgit-repos/cgit-repos.conf* and
writes the repositories to */var/tmp/cgit-repos/output*.
If SSH is required, the socket should be mapped to
*/var/run/cgit-repos/ssh-agent.sock*.

For example:

    > docker run -it --rm                                      \
        -v "/path/to/config:/etc/cgit-repos:ro"                \
        -v "$SSH_AUTH_SOCK:/var/run/cgit-repos/ssh-agent.sock" \
        -v "/path/to/output:/var/tmp/cgit-repos/output"        \
        egortensin/pull-cgit-repos

### my_repos.py

Change the section to which the repository belongs to using `cp --archive` (so
that the "Idle" column isn't updated):

    > cp --archive -- section1/repo section2/

Update the URL of an existing repository mirror:

    > git remote set-url origin ssh://git@examples.com/username/name.git

Development
-----------

### Docker

To build an image:

    > docker build -t egortensin/pull-cgit-repos .

### Linting

Requires [Pylint].

    > pylint pull

[Pylint]: https://www.pylint.org/

License
-------

Distributed under the MIT License.
See [LICENSE.txt] for details.

[LICENSE.txt]: LICENSE.txt