Skip to content

Commit dd28d50

Browse files
committed
Merge branch 'development' release 0.6.0
2 parents 9c45db8 + 8c1c1e8 commit dd28d50

14 files changed

+146
-63
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
---
2+
## gitlab-mirrors v0.6.0
3+
4+
* Consolidate user options and deps inclusion. See [PR #104][#104]
5+
* Added support for version 4 of the Gitlab API. See [PR #100][#100]
6+
7+
[#100]: https://github.com/samrocketman/gitlab-mirrors/pull/100
8+
[#104]: https://github.com/samrocketman/gitlab-mirrors/pull/104
9+
10+
111
---
212
## gitlab-mirrors v0.5.3
313

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gitlab-mirrors creates read only copies of remote repositories in gitlab. It
77
provides a CLI management interface for managing the mirrored repositories (e.g.
88
add, delete, update) so that an admin may regularly update all mirrors using
99
`crontab`. It operates by interacting with the [GitLab API][gitlab-api] using
10-
[python-gitlab3][python-gitlab3].
10+
[python-gitlab][python-gitlab].
1111

1212
## Features
1313

@@ -81,10 +81,11 @@ Created by Sam Gleske under [MIT License](LICENSE).
8181
* Docs #54 [Martijn Vermaat](https://github.com/martijnvermaat)
8282
* Better logging #57 [Loic Dachary](https://github.com/dachary)
8383
* Fixed project transfer bug #78 [Corey Osman](https://github.com/logicminds)
84+
* Added support for GitLab API v4 #100 [Romke van Dijk](https://github.com/zyronix)
8485

8586
[gitlab-api]: http://api.gitlab.org/
8687
[gm-docker]: https://github.com/Klowner/docker-gitlab-mirrors
8788
[gm-puppet]: https://github.com/logicminds/gitlab_mirrors
8889
[issues]: https://github.com/samrocketman/gitlab-mirrors/issues
8990
[mirror-missing]: http://feedback.gitlab.com/forums/176466-general/suggestions/4286666-mirror-git-svn-into-repo-
90-
[python-gitlab3]: https://github.com/alexvh/python-gitlab3
91+
[python-gitlab]: https://github.com/python-gitlab/python-gitlab

add_mirror.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ set -e
1010

1111
#Include all user options and dependencies
1212
git_mirrors_dir="${0%/*}"
13-
[ -f "${git_mirrors_dir}/config.sh" ] && . "${git_mirrors_dir}/config.sh"
14-
. "${git_mirrors_dir}/lib/VERSION"
15-
. "${git_mirrors_dir}/lib/functions.sh"
16-
if [ ! -f "${git_mirrors_dir}/config.sh" ];then
17-
red_echo "config.sh missing! Copy and customize from config.sh.SAMPLE. Aborting." 1>&2
18-
exit 1
19-
fi
13+
source ${git_mirrors_dir}/includes.sh
14+
15+
#check if api version is set
16+
[ -z $gitlab_api_version ] && gitlab_api_version=4
2017

2118
#export env vars for python script
22-
export gitlab_user_token_secret gitlab_url gitlab_namespace gitlab_user ssl_verify
19+
export gitlab_user_token_secret gitlab_url gitlab_namespace gitlab_user ssl_verify gitlab_api_version
2320

2421
PROGNAME="${0##*/}"
2522
PROGVERSION="${VERSION}"

config.sh.SAMPLE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ gitlab_url="https://gitlab.example.com"
4242
gitlab_user="gitmirror"
4343
#Generate a token for your $gitlab_user and set it here.
4444
gitlab_user_token_secret="$(head -n1 "${user_home}/private_token" 2> /dev/null || echo "")"
45+
#Sets the Gitlab API version, either 3 or 4
46+
gitlab_api_version=4
4547
#Verify signed SSL certificates?
4648
ssl_verify=true
4749
#Push to GitLab over http? Otherwise will push projects via SSH.

delete_mirror.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ set -e
88

99
#Include all user options and dependencies
1010
git_mirrors_dir="${0%/*}"
11-
[ -f "${git_mirrors_dir}/config.sh" ] && . "${git_mirrors_dir}/config.sh"
12-
. "${git_mirrors_dir}/lib/VERSION"
13-
. "${git_mirrors_dir}/lib/functions.sh"
14-
if [ ! -f "${git_mirrors_dir}/config.sh" ];then
15-
red_echo "config.sh missing! Copy and customize from config.sh.SAMPLE. Aborting." 1>&2
16-
exit 1
17-
fi
11+
source ${git_mirrors_dir}/includes.sh
12+
13+
#check if api version is set
14+
[ -z $gitlab_api_version ] && gitlab_api_version=4
1815

1916
#export env vars for python script
20-
export gitlab_user_token_secret gitlab_url gitlab_namespace gitlab_user ssl_verify
17+
export gitlab_user_token_secret gitlab_url gitlab_namespace gitlab_user ssl_verify gitlab_api_version
2118

2219
cd "${git_mirrors_dir}"
2320

docs/prerequisites.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
### Required software
44

5-
* [Tested with GitLab 6.x/7.x/8.x][gitlab]
6-
* [pyapi-gitlab3 @ v0.5.4][python-gitlab3]
5+
* [Tested with GitLab 8.x/9.x/10/x][gitlab]
6+
* [python-gitlab @ v1.1.0][python-gitlab]
77
* [GNU coreutils][coreutils]
88
* [git 1.8.0][git] or later
99

@@ -24,14 +24,10 @@ aditional options.
2424

2525
### Required software install snippets
2626

27-
#### python-gitlab3
28-
29-
yum install python-setuptools
30-
git clone https://github.com/alexvh/python-gitlab3.git
31-
cd python-gitlab3
32-
git checkout v0.5.4
33-
python setup.py install
27+
#### python-gitlab
3428

29+
yum install python-pip
30+
pip install python-gitlab
3531

3632
#### Installing git
3733

@@ -93,4 +89,4 @@ Next up is [Installation and Setup](installation.md).
9389
[gitlab]: https://about.gitlab.com/
9490
[git-src]: http://code.google.com/p/git-core/
9591
[git-svn]: https://www.kernel.org/pub/software/scm/git/docs/git-svn.html
96-
[python-gitlab3]: https://github.com/alexvh/python-gitlab3
92+
[python-gitlab]: https://github.com/python-gitlab/python-gitlab
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Upgrade Notes
2+
3+
This documentation outlines steps for you to upgrade from gitlab-mirrors `0.5.x`
4+
to gitlab-mirrors `0.6.x`. It is assumed you'll be working on a test instance
5+
of gitlab in a production environment. If you only have a single gitlab
6+
instance then follow these steps with care and at your own risk.
7+
8+
gitlab-mirrors has been certified to use a new prerequisite library called
9+
[python-gitlab](https://github.com/python-gitlab/python-gitlab). Therefore you
10+
must install `python-gitlab` before upgrading `gitlab-mirrors` to the latest
11+
edition.
12+
13+
# 1. Disable any cron jobs
14+
15+
If you have cron jobs set up then you'll need to disable them to avoid them
16+
launching gitlab-mirrors during your upgrade.
17+
18+
# 2. Update python-gitlab3 python-gitlab
19+
20+
I'll ouline the steps here real quick.
21+
22+
yum install python-pip
23+
pip uninstall gitlab3
24+
pip install python-gitlab
25+
26+
# 3. Update your gitlab-mirrors
27+
28+
su - gitmirror
29+
cd gitlab-mirrors
30+
git checkout master
31+
git fetch
32+
git pull origin master
33+
git checkout v0.6.x
34+
35+
Test on a dummy project to ensure your new setup works. Once you have verified
36+
everything works then you can re-enable the cron jobs.
37+
38+
# Alternatively
39+
40+
Rely on virtualenv.
41+
42+
virtualenv -p python2.7 .venv
43+
source ./.venv/bin/activate
44+
pip install python-gitlab
45+
46+
Be sure to source ./.venv/bin/activate before running gitlab-mirrors shell
47+
scripts.

git-mirrors.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55

66
#Include all user options and dependencies
77
git_mirrors_dir="${0%/*}"
8-
[ -f "${git_mirrors_dir}/config.sh" ] && . "${git_mirrors_dir}/config.sh"
9-
. "${git_mirrors_dir}/lib/VERSION"
10-
. "${git_mirrors_dir}/lib/functions.sh"
11-
if [ ! -f "${git_mirrors_dir}/config.sh" ];then
12-
red_echo "config.sh missing! Copy and customize from config.sh.SAMPLE. Aborting." 1>&2
13-
exit 1
14-
fi
8+
source ${git_mirrors_dir}/includes.sh
159

1610
cd "${git_mirrors_dir}"
1711

includes.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -e
2+
3+
#Include all user options and dependencies
4+
git_mirrors_dir="${0%/*}"
5+
[ -f "${git_mirrors_dir}/config.sh" ] && . "${git_mirrors_dir}/config.sh"
6+
. "${git_mirrors_dir}/lib/VERSION"
7+
. "${git_mirrors_dir}/lib/functions.sh"
8+
if [ ! -f "${git_mirrors_dir}/config.sh" ];then
9+
red_echo "config.sh missing! Copy and customize from config.sh.SAMPLE. Aborting." 1>&2
10+
exit 1
11+
fi

lib/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION="v0.5.3"
1+
VERSION="v0.6.0"

0 commit comments

Comments
 (0)