{ "info": { "author": "Joseph Weston", "author_email": "joseph@weston.cloud", "bugtrack_url": null, "classifiers": [], "description": "Gitlab CI Tools\n===============\n.. badges-start\n\n\n.. image:: https://gitlab.com/jbweston/gitlab-ci-tools/badges/master/build.svg\n :target: https://gitlab.com/jbweston/gitlab-ci-tools/badges/master/build.svg\n :alt: Build status\n\n.. image:: https://img.shields.io/pypi/l/gitlab-ci-tools.svg\n :target: https://img.shields.io/pypi/l/gitlab-ci-tools.svg\n :alt: License\n\n.. image:: https://img.shields.io/pypi/v/gitlab-ci-tools.svg\n :target: https://img.shields.io/pypi/v/gitlab-ci-tools.svg\n :alt: PyPi package\n\n.. badges-end\n\nScripts for getting useful information (e.g. the git hash of the last successful build) from within Gitlab CI \n\nOverview\n--------\nOften when using Gitlab CI you need information that is not\navailable from the `environment variables`_ provided by the CI\nrunner. This package contains a collection of scripts for obtaining\ninformation from the Gitlab API\n\n.. _environment variables: https://docs.gitlab.com/ce/ci/variables/\n\nLicense\n-------\n``gitlab-ci-tools`` is licensed under the simplfied (2-clause) BSD licence.\nSee the LICENSE_ file for details.\n\n.. _LICENSE: LICENSE\n\nInstallation\n------------\nThe scripts are written in Python 3, so this will need to be installed\nprior to the following::\n\n pip3 install gitlab-ci-tools\n\nYou can install the package on your local computer to test out\nthe scripts (see the Usage section for details), however typically\nyou will want to install this package into the Gitlab CI environment.\n\nThe simplest way to accomplish this is to add the following to the top\nof your ``.gitlab-ci.yml``::\n\n before_script:\n - pip3 install gitlab-ci-tools\n\n\nUsage\n-----\nInstalling ``gitlab-ci-tools`` installs a bunch of scripts that you can\nrun from the command line. See the next section for a list of the installed\ntools.\n\nIn order for the scripts to be able to access the Gitlab API you must\nprovide a CI secret variable ``GITLAB_API_TOKEN`` that contains a\npersonal access token with ``api`` scope (check out `these instructions`_ to\nfind out how to generate one).\n\nSecurity Considerations\n~~~~~~~~~~~~~~~~~~~~~~~\n\nUnfortunately Gitlab's API permissions are not very granular, so\n**anyone with access to this token is, effectively, you** (at least as\nfar as Gitlab is concerned). If people you don't trust have access to\nyour CI (e.g. they can make CI-triggering commits to your repository)\n**this is a bad idea**. There are several outstanding issues on Gitlab\n(e.g. `#29566`_ and `#41084`_) that attempt to address the problem of\nauthenticated API access from within CI runners.\n\n.. _these instructions: https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html#creating-a-personal-access-token\n.. _#29566: https://gitlab.com/gitlab-org/gitlab-ce/issues/29566\n.. _#41084: https://gitlab.com/gitlab-org/gitlab-ce/issues/41084\n\nList of Tools\n-------------\n\n``last-good-build``\n~~~~~~~~~~~~~~~~~~~\nPrint the Git hash of the last successful build for the current branch.\nAn useful example would be generating a PDF of the diff between two Latex\ndocuments::\n\n before_script:\n pip install gitlab-ci-tools\n LAST_GOOD_BUILD=$(last-good-build || echo '')\n\n report diff:\n script:\n - git show $LAST_GOOD_BUILD:important_doc.tex > old_doc.tex\n - latexdiff old_doc.tex important_doc.tex > diff_doc.tex\n - latexmk -pdf diff_doc.tex\n artifacts:\n paths:\n - diff_doc.pdf\n\nContributing\n------------\nI would be happy to add more tools here, not just ones that I find useful.\nIt would be good if the script were to follow a similar structure to the\nexisting ones (i.e. provide a ``main()`` function, and expose a command line\nthat can be driven with command-line options or with environment variables),\nbut I am happy to guide anyone through this process if need be.\n\nOnce there is more than a single script we can start to think about how best\nto separate out common functionlity so that we can reduce boilerplate.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jbweston/gitlab-ci-tools", "keywords": "", "license": "BSD 2-Clause", "maintainer": "", "maintainer_email": "", "name": "gitlab-ci-tools", "package_url": "https://pypi.org/project/gitlab-ci-tools/", "platform": "GNU/Linux", "project_url": "https://pypi.org/project/gitlab-ci-tools/", "project_urls": { "Homepage": "https://github.com/jbweston/gitlab-ci-tools" }, "release_url": "https://pypi.org/project/gitlab-ci-tools/0.1.0/", "requires_dist": [ "python-gitlab", "pep8; extra == 'dev'", "pylint; extra == 'dev'" ], "requires_python": "", "summary": "Tools for working inside Gitlab CI", "version": "0.1.0" }, "last_serial": 3546376, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "68e23cf30e5156e78951e10fe1555f9c", "sha256": "d78f7993a84d5b3be801cbeccf8ffac8a68cf19ad624f7390a9360ea8f6babaa" }, "downloads": -1, "filename": "gitlab_ci_tools-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "68e23cf30e5156e78951e10fe1555f9c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7735, "upload_time": "2018-02-02T17:32:35", "url": "https://files.pythonhosted.org/packages/c5/2c/1dc9ebea43d79f41bf832ce4c65ff49a7074341c06bbb3c1889674d9b9e7/gitlab_ci_tools-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "23c681234049b00792937d6d41e8b37e", "sha256": "52335836cec49ce13a443def989e0ad52f25fc664c5e2ef8750d039629861755" }, "downloads": -1, "filename": "gitlab-ci-tools-0.1.0.tar.gz", "has_sig": false, "md5_digest": "23c681234049b00792937d6d41e8b37e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21194, "upload_time": "2018-02-02T17:32:38", "url": "https://files.pythonhosted.org/packages/d2/88/c6fca2a306565802e5c3f7a26cdf6f86a5a5385e62facb0000133a987c30/gitlab-ci-tools-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "68e23cf30e5156e78951e10fe1555f9c", "sha256": "d78f7993a84d5b3be801cbeccf8ffac8a68cf19ad624f7390a9360ea8f6babaa" }, "downloads": -1, "filename": "gitlab_ci_tools-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "68e23cf30e5156e78951e10fe1555f9c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7735, "upload_time": "2018-02-02T17:32:35", "url": "https://files.pythonhosted.org/packages/c5/2c/1dc9ebea43d79f41bf832ce4c65ff49a7074341c06bbb3c1889674d9b9e7/gitlab_ci_tools-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "23c681234049b00792937d6d41e8b37e", "sha256": "52335836cec49ce13a443def989e0ad52f25fc664c5e2ef8750d039629861755" }, "downloads": -1, "filename": "gitlab-ci-tools-0.1.0.tar.gz", "has_sig": false, "md5_digest": "23c681234049b00792937d6d41e8b37e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21194, "upload_time": "2018-02-02T17:32:38", "url": "https://files.pythonhosted.org/packages/d2/88/c6fca2a306565802e5c3f7a26cdf6f86a5a5385e62facb0000133a987c30/gitlab-ci-tools-0.1.0.tar.gz" } ] }