diff options
-rw-r--r-- | README.rst | 2 | ||||
-rw-r--r-- | docs/api-usage.rst | 22 | ||||
-rw-r--r-- | gitlab/__init__.py | 6 | ||||
-rwxr-xr-x | tools/build_test_env.sh | 17 |
4 files changed, 33 insertions, 14 deletions
@@ -31,7 +31,7 @@ Requirements python-gitlab depends on: -* `python-requests <http://docs.python-requests.org/en/latest/>`_ +* `python-requests <https://2.python-requests.org/en/latest/>`_ Install with pip ---------------- diff --git a/docs/api-usage.rst b/docs/api-usage.rst index dc88684..dac3997 100644 --- a/docs/api-usage.rst +++ b/docs/api-usage.rst @@ -204,6 +204,11 @@ listing methods support the ``page`` and ``per_page`` parameters: By default GitLab does not return the complete list of items. Use the ``all`` parameter to get all the items when using listing methods: +.. warning:: + + The all=True option uses keyset pagination by default if order_by is not supplied, + or if order_by="id". + .. code-block:: python all_groups = gl.groups.list(all=True) @@ -302,7 +307,19 @@ python-gitlab: gl = gitlab.gitlab(url, token, api_version=4, session=session) Reference: -http://docs.python-requests.org/en/master/user/advanced/#proxies +https://2.python-requests.org/en/master/user/advanced/#proxies + +SSL certificate verification +---------------------------- + +python-gitlab relies on the CA certificate bundle in the `certifi` package +that comes with the requests library. + +If you need python-gitlab to use your system CA store instead, you can provide +the path to the CA bundle in the `REQUESTS_CA_BUNDLE` environment variable. + +Reference: +https://2.python-requests.org/en/master/user/advanced/#ssl-cert-verification Client side certificate ----------------------- @@ -319,7 +336,7 @@ The following sample illustrates how to use a client-side certificate: gl = gitlab.gitlab(url, token, api_version=4, session=session) Reference: -http://docs.python-requests.org/en/master/user/advanced/#client-side-certificates +https://2.python-requests.org/en/master/user/advanced/#client-side-certificates Rate limits ----------- @@ -391,4 +408,3 @@ parameter to that API invocation: gl = gitlab.gitlab(url, token, api_version=4) gl.projects.import_github(ACCESS_TOKEN, 123456, "root", timeout=120.0) - diff --git a/gitlab/__init__.py b/gitlab/__init__.py index 5a59432..7ea141e 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -641,6 +641,12 @@ class Gitlab(object): get_all = kwargs.pop("all", False) url = self._build_url(path) + # use keyset pagination automatically, if all=True + order_by = kwargs.get("order_by") + if get_all and (not order_by or order_by == "id"): + kwargs["pagination"] = "keyset" + kwargs["order_by"] = "id" + if get_all is True and as_list is True: return list(GitlabList(self, url, query_data, **kwargs)) diff --git a/tools/build_test_env.sh b/tools/build_test_env.sh index f5feebf..7468a9a 100755 --- a/tools/build_test_env.sh +++ b/tools/build_test_env.sh @@ -29,12 +29,15 @@ REUSE_CONTAINER= NOVENV= PY_VER=3 API_VER=4 +GITLAB_IMAGE="gitlab/gitlab-ce" +GITLAB_TAG="latest" while getopts :knp:a: opt "$@"; do case $opt in k) REUSE_CONTAINER=1;; n) NOVENV=1;; p) PY_VER=$OPTARG;; a) API_VER=$OPTARG;; + t) GITLAB_TAG=$OPTARG;; :) fatal "Option -${OPTARG} requires a value";; '?') fatal "Unknown option: -${OPTARG}";; *) fatal "Internal error: opt=${opt}";; @@ -81,6 +84,7 @@ cleanup() { } if [ -z "$REUSE_CONTAINER" ] || ! docker top gitlab-test >/dev/null 2>&1; then + try docker pull "$GITLAB_IMAGE:$GITLAB_TAG" GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.test' gitlab_rails['initial_root_password'] = '5iveL!fe' gitlab_rails['initial_shared_runners_registration_token'] = 'sTPNtWLEuSrHzoHP8oCU' @@ -103,7 +107,7 @@ letsencrypt['enable'] = false " try docker run --name gitlab-test --detach --publish 8080:80 \ --publish 2222:22 --env "GITLAB_OMNIBUS_CONFIG=$GITLAB_OMNIBUS_CONFIG" \ - gitlab/gitlab-ce:latest >/dev/null + "$GITLAB_IMAGE:$GITLAB_TAG" >/dev/null fi LOGIN='root' @@ -141,20 +145,13 @@ while :; do sleep 1 docker top gitlab-test >/dev/null 2>&1 || fatal "docker failed to start" sleep 4 - # last command started by the container is "gitlab-ctl tail" - docker exec gitlab-test pgrep -f 'gitlab-ctl tail' &>/dev/null \ - && docker exec gitlab-test curl http://localhost/-/health 2>/dev/null \ - | grep -q 'GitLab OK' \ - && curl -s http://localhost:8080/users/sign_in 2>/dev/null \ - | grep -q "GitLab Community Edition" \ + docker logs gitlab-test 2>&1 | grep "gitlab Reconfigured!" \ && break I=$((I+5)) + log "Waiting for GitLab to reconfigure.. (${I}s)" [ "$I" -lt 180 ] || fatal "timed out" done -log "Pausing to give GitLab some time to finish starting up..." -sleep 200 - # Get the token TOKEN=$($(dirname $0)/generate_token.py) |