From 27109cad0d97114b187ce98ce77e4d7b0c7c3270 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 13 Sep 2020 23:00:28 +0200 Subject: chore: allow overriding docker-compose env vars for tag --- .env | 2 ++ .renovaterc.json | 4 ++-- README.rst | 23 +++++++---------------- tools/functional/fixtures/docker-compose.yml | 2 +- 4 files changed, 12 insertions(+), 19 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..10ab7dc --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +GITLAB_IMAGE=gitlab/gitlab-ce +GITLAB_TAG=13.3.5-ce.0 diff --git a/.renovaterc.json b/.renovaterc.json index be47e3a..037a97e 100644 --- a/.renovaterc.json +++ b/.renovaterc.json @@ -4,8 +4,8 @@ ], "regexManagers": [ { - "fileMatch": ["^tools/build_test_env.sh$"], - "matchStrings": ["DEFAULT_GITLAB_TAG=(?.*?)\n"], + "fileMatch": ["^.env$"], + "matchStrings": ["GITLAB_TAG=(?.*?)\n"], "depNameTemplate": "gitlab/gitlab-ce", "datasourceTemplate": "docker", "versioningTemplate": "loose" diff --git a/README.rst b/README.rst index 2291242..9873380 100644 --- a/README.rst +++ b/README.rst @@ -166,7 +166,7 @@ You need to install ``tox`` to run unit tests and documentation builds locally: Running integration tests ------------------------- -Two scripts run tests against a running gitlab instance, using a docker +Integration tests run against a running gitlab instance, using a docker container. You need to have docker installed on the test machine, and your user must have the correct permissions to talk to the docker daemon. @@ -180,9 +180,9 @@ To run these tests: # run the python API tests: tox -e py_func_v4 -By default, the tests run against the ``gitlab/gitlab-ce:latest`` image. You can -override both the image and tag with the ``-i`` and ``-t`` options, or by providing -either the ``GITLAB_IMAGE`` or ``GITLAB_TAG`` environment variables. +By default, the tests run against the latest version of the ``gitlab/gitlab-ce`` +image. You can override both the image and tag by providing either the +``GITLAB_IMAGE`` or ``GITLAB_TAG`` environment variables. This way you can run tests against different versions, such as ``nightly`` for features in an upcoming release, or an older release (e.g. ``12.8.0-ce.0``). @@ -191,20 +191,11 @@ The tag must match an exact tag on Docker Hub: .. code-block:: bash # run tests against `nightly` or specific tag - ./tools/py_functional_tests.sh -t nightly - ./tools/py_functional_tests.sh -t 12.8.0-ce.0 + GITLAB_TAG=nightly tox -e py_func_v4 + GITLAB_TAG=12.8.0-ce.0 tox -e py_func_v4 # run tests against the latest gitlab EE image - ./tools/py_functional_tests.sh -i gitlab/gitlab-ee - - # override tags with environment variables - GITLAB_TAG=nightly ./tools/py_functional_tests.sh - -You can also build a test environment using the following command: - -.. code-block:: bash - - ./tools/build_test_env.sh + GITLAB_IMAGE=gitlab/gitlab-ee tox -e py_func_v4 A freshly configured gitlab container will be available at http://localhost:8080 (login ``root`` / password ``5iveL!fe``). A configuration diff --git a/tools/functional/fixtures/docker-compose.yml b/tools/functional/fixtures/docker-compose.yml index 5dd9d90..687eeaa 100644 --- a/tools/functional/fixtures/docker-compose.yml +++ b/tools/functional/fixtures/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: gitlab: - image: 'gitlab/gitlab-ce:latest' + image: '${GITLAB_IMAGE}:${GITLAB_TAG}' container_name: 'gitlab-test' hostname: 'gitlab.test' privileged: true # Just in case https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/1350 -- cgit v1.2.1