gitlab-trace


Namegitlab-trace JSON
Version 0.7.1 PyPI version JSON
download
home_pagehttps://github.com/mgedmin/gitlab-trace
Summarylook at GitLab CI pipeline results from the command line
upload_time2023-10-09 10:13:24
maintainer
docs_urlNone
authorMarius Gedminas
requires_python>=3.7
licenseGPL
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            Look at GitLab CI job status from the command line
==================================================

.. image:: https://github.com/mgedmin/gitlab-trace/workflows/build/badge.svg?branch=master
    :target: https://github.com/mgedmin/gitlab-trace/actions

.. image:: https://coveralls.io/repos/mgedmin/gitlab-trace/badge.svg?branch=master
    :target: https://coveralls.io/r/mgedmin/gitlab-trace

Sometimes I want to look at the GitLab CI build status from my terminal ::

    $ gitlab-trace
    GitLab project: Foretagsdeklaration/foretagsdeklaration
    Available jobs for pipeline #84214:
       --job=500786 - success - build_server
       --job=500787 - success - build_client
       --job=500788 - success - test_safety
       --job=500789 - success - test_dev_safety
       --job=500790 - success - test_bandit
       --job=500791 - success - test_crontabs
       --job=500792 - success - test_newrelic
       --job=500793 - success - unittests_server
       --job=500794 - success - unittests_client
       --job=500795 - success - build_docker_image
       --job=500796 - failed - test_robot
       --job=500797 - success - test_robot_bolfin

You can take a closer look at a failed job by passing the job ID ::

    $ gitlab-trace --job=500796
    ...
    Uploading artifacts...
    robottests/output: found 540 matching files
    Uploading artifacts to coordinator... ok            id=500796 responseStatus=201 Created token=6yaRqQPr
    ERROR: Job failed: exit code 1

You can watch a job while it is running ::

    $ gitlab-trace --job=500796 --tail --follow
    ...
    Uploading artifacts...
    robottests/output: found 540 matching files
    Uploading artifacts to coordinator... ok            id=500796 responseStatus=201 Created token=6yaRqQPr
    ERROR: Job failed: exit code 1

You can watch the currently running job ::

    $ gitlab-trace --running --tail --follow
    ...
    Uploading artifacts...
    robottests/output: found 540 matching files
    Uploading artifacts to coordinator... ok            id=500796 responseStatus=201 Created token=6yaRqQPr
    ERROR: Job failed: exit code 1

You can look at a different branch ::

    $ gitlab-trace --branch=master
    GitLab project: Foretagsdeklaration/foretagsdeklaration
    https://git.vaultit.org/Foretagsdeklaration/foretagsdeklaration/pipelines/84185
    Available jobs for pipeline #84185:
       --job=500692 - success - build_server
       --job=500693 - success - build_client
       --job=500694 - success - test_safety
       --job=500695 - success - test_dev_safety
       --job=500696 - success - test_bandit
       --job=500697 - success - test_crontabs
       --job=500698 - success - test_newrelic
       --job=500699 - success - unittests_server
       --job=500700 - success - unittests_client
       --job=500701 - success - build_docker_image
       --job=500702 - failed - test_robot
       --job=500703 - success - test_robot_bolfin
       --job=500704 - success - tag_docker_image
       --job=500705 - manual - deploy_stv_managedkube_alpha
       --job=500706 - manual - deploy_id06_alpha
       --job=500707 - manual - deploy_id06_alpha_fs31
       --job=500708 - manual - deploy_id06_beta
       --job=500709 - manual - deploy_id06_beta_fs31
       --job=500710 - manual - deploy_stv_alpha
       --job=500747 - success - test_robot

You can look at the Nth latest pipeline ::

    $ gitlab-trace -1   # the latest one, default when run with no arguments

    $ gitlab-trace -2   # the one before that

    $ gitlab-trace --branch=mybranch -1   # the last one on this branch

You can look at a specific pipeline by ID ::

    $ gitlab-trace 84185

You can look at a specific job in that pipeline ::

    $ gitlab-trace 84185 test_robot

If a job has been retried several times you can look at a specific run ::

    $ gitlab-trace 84185 test_robot 1

    $ gitlab-trace 84185 test_robot 2


Installation
------------

``pip3 install --user gitlab-trace`` should take care of everything, just make
sure ~/.local/bin is on your $PATH.

Or you may want to use a script installer like pipx_ (my favourite).


Configuration
-------------

Create a ``~/.python-gitlab.cfg`` like this::

   [global]
   default = mygitlab

   [mygitlab]
   url = https://gitlab.example.com/
   private_token = ...

You can create a private access token in your GitLab profile settings.  It'll
need the "read_api" access scope.


Usage
-----

.. [[[cog
..   import cog, subprocess, textwrap, os
..   os.environ['COLUMNS'] = '80'  # consistent line wrapping
..   helptext = subprocess.run(['gitlab-trace', '--help'],
..                             capture_output=True, text=True).stdout
..   cog.outl('\nHelp is available via ::\n')
..   cog.outl('    $ gitlab-trace --help')
..   cog.outl(textwrap.indent(helptext, '    '))
.. ]]]

Help is available via ::

    $ gitlab-trace --help
    usage: gitlab-trace [-h] [--version] [-v] [--debug] [-g NAME] [-p ID]
                        [--job ID] [--running] [-b NAME] [-t [N]] [-f]
                        [--print-url] [-a]
                        [PIPELINE-ID] [JOB-NAME] [NTH-JOB-OF-THAT-NAME]

    gitlab-trace: show the status/trace of a GitLab CI pipeline/job.

    positional arguments:
      PIPELINE-ID           select a GitLab CI pipeline by ID (default: the last
                            pipeline of a git branch)
      JOB-NAME              select a GitLab CI pipeline job by name
      NTH-JOB-OF-THAT-NAME  select n-th GitLab CI pipeline job by this name
                            (default: the last one)

    options:
      -h, --help            show this help message and exit
      --version             show program's version number and exit
      -v, --verbose         print more information
      --debug               print even more information, for debugging
      -g NAME, --gitlab NAME
                            select configuration section in ~/.python-gitlab.cfg
      -p ID, --project ID   select GitLab project ('group/project' or the numeric
                            ID)
      --job ID              show the trace of GitLab CI job with this ID
      --running             show the trace of the currently running GitLab CI job,
                            if there is one (if there's more than one, picks the
                            first one)
      -b NAME, --branch NAME, --ref NAME
                            show the last pipeline of this git branch (default:
                            the currently checked out branch)
      -t [N], --tail [N]    show the last N lines of the trace log
      -f, --follow          periodically poll and output additional logs as the
                            job runs
      --print-url, --print-uri
                            print URL to job page on GitLab instead of printing
                            job's log
      -a, --artifacts       download build artifacts

.. [[[end]]]

.. _python-gitlab: https://pypi.org/p/python-gitlab
.. _pipx: https://pipxproject.github.io/pipx/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mgedmin/gitlab-trace",
    "name": "gitlab-trace",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Marius Gedminas",
    "author_email": "marius@gedmin.as",
    "download_url": "https://files.pythonhosted.org/packages/53/e8/fe07885e72d444b339eae33c7bd8a5996e0314c40df5c8f93df348e57a1c/gitlab-trace-0.7.1.tar.gz",
    "platform": null,
    "description": "Look at GitLab CI job status from the command line\n==================================================\n\n.. image:: https://github.com/mgedmin/gitlab-trace/workflows/build/badge.svg?branch=master\n    :target: https://github.com/mgedmin/gitlab-trace/actions\n\n.. image:: https://coveralls.io/repos/mgedmin/gitlab-trace/badge.svg?branch=master\n    :target: https://coveralls.io/r/mgedmin/gitlab-trace\n\nSometimes I want to look at the GitLab CI build status from my terminal ::\n\n    $ gitlab-trace\n    GitLab project: Foretagsdeklaration/foretagsdeklaration\n    Available jobs for pipeline #84214:\n       --job=500786 - success - build_server\n       --job=500787 - success - build_client\n       --job=500788 - success - test_safety\n       --job=500789 - success - test_dev_safety\n       --job=500790 - success - test_bandit\n       --job=500791 - success - test_crontabs\n       --job=500792 - success - test_newrelic\n       --job=500793 - success - unittests_server\n       --job=500794 - success - unittests_client\n       --job=500795 - success - build_docker_image\n       --job=500796 - failed - test_robot\n       --job=500797 - success - test_robot_bolfin\n\nYou can take a closer look at a failed job by passing the job ID ::\n\n    $ gitlab-trace --job=500796\n    ...\n    Uploading artifacts...\n    robottests/output: found 540 matching files\n    Uploading artifacts to coordinator... ok            id=500796 responseStatus=201 Created token=6yaRqQPr\n    ERROR: Job failed: exit code 1\n\nYou can watch a job while it is running ::\n\n    $ gitlab-trace --job=500796 --tail --follow\n    ...\n    Uploading artifacts...\n    robottests/output: found 540 matching files\n    Uploading artifacts to coordinator... ok            id=500796 responseStatus=201 Created token=6yaRqQPr\n    ERROR: Job failed: exit code 1\n\nYou can watch the currently running job ::\n\n    $ gitlab-trace --running --tail --follow\n    ...\n    Uploading artifacts...\n    robottests/output: found 540 matching files\n    Uploading artifacts to coordinator... ok            id=500796 responseStatus=201 Created token=6yaRqQPr\n    ERROR: Job failed: exit code 1\n\nYou can look at a different branch ::\n\n    $ gitlab-trace --branch=master\n    GitLab project: Foretagsdeklaration/foretagsdeklaration\n    https://git.vaultit.org/Foretagsdeklaration/foretagsdeklaration/pipelines/84185\n    Available jobs for pipeline #84185:\n       --job=500692 - success - build_server\n       --job=500693 - success - build_client\n       --job=500694 - success - test_safety\n       --job=500695 - success - test_dev_safety\n       --job=500696 - success - test_bandit\n       --job=500697 - success - test_crontabs\n       --job=500698 - success - test_newrelic\n       --job=500699 - success - unittests_server\n       --job=500700 - success - unittests_client\n       --job=500701 - success - build_docker_image\n       --job=500702 - failed - test_robot\n       --job=500703 - success - test_robot_bolfin\n       --job=500704 - success - tag_docker_image\n       --job=500705 - manual - deploy_stv_managedkube_alpha\n       --job=500706 - manual - deploy_id06_alpha\n       --job=500707 - manual - deploy_id06_alpha_fs31\n       --job=500708 - manual - deploy_id06_beta\n       --job=500709 - manual - deploy_id06_beta_fs31\n       --job=500710 - manual - deploy_stv_alpha\n       --job=500747 - success - test_robot\n\nYou can look at the Nth latest pipeline ::\n\n    $ gitlab-trace -1   # the latest one, default when run with no arguments\n\n    $ gitlab-trace -2   # the one before that\n\n    $ gitlab-trace --branch=mybranch -1   # the last one on this branch\n\nYou can look at a specific pipeline by ID ::\n\n    $ gitlab-trace 84185\n\nYou can look at a specific job in that pipeline ::\n\n    $ gitlab-trace 84185 test_robot\n\nIf a job has been retried several times you can look at a specific run ::\n\n    $ gitlab-trace 84185 test_robot 1\n\n    $ gitlab-trace 84185 test_robot 2\n\n\nInstallation\n------------\n\n``pip3 install --user gitlab-trace`` should take care of everything, just make\nsure ~/.local/bin is on your $PATH.\n\nOr you may want to use a script installer like pipx_ (my favourite).\n\n\nConfiguration\n-------------\n\nCreate a ``~/.python-gitlab.cfg`` like this::\n\n   [global]\n   default = mygitlab\n\n   [mygitlab]\n   url = https://gitlab.example.com/\n   private_token = ...\n\nYou can create a private access token in your GitLab profile settings.  It'll\nneed the \"read_api\" access scope.\n\n\nUsage\n-----\n\n.. [[[cog\n..   import cog, subprocess, textwrap, os\n..   os.environ['COLUMNS'] = '80'  # consistent line wrapping\n..   helptext = subprocess.run(['gitlab-trace', '--help'],\n..                             capture_output=True, text=True).stdout\n..   cog.outl('\\nHelp is available via ::\\n')\n..   cog.outl('    $ gitlab-trace --help')\n..   cog.outl(textwrap.indent(helptext, '    '))\n.. ]]]\n\nHelp is available via ::\n\n    $ gitlab-trace --help\n    usage: gitlab-trace [-h] [--version] [-v] [--debug] [-g NAME] [-p ID]\n                        [--job ID] [--running] [-b NAME] [-t [N]] [-f]\n                        [--print-url] [-a]\n                        [PIPELINE-ID] [JOB-NAME] [NTH-JOB-OF-THAT-NAME]\n\n    gitlab-trace: show the status/trace of a GitLab CI pipeline/job.\n\n    positional arguments:\n      PIPELINE-ID           select a GitLab CI pipeline by ID (default: the last\n                            pipeline of a git branch)\n      JOB-NAME              select a GitLab CI pipeline job by name\n      NTH-JOB-OF-THAT-NAME  select n-th GitLab CI pipeline job by this name\n                            (default: the last one)\n\n    options:\n      -h, --help            show this help message and exit\n      --version             show program's version number and exit\n      -v, --verbose         print more information\n      --debug               print even more information, for debugging\n      -g NAME, --gitlab NAME\n                            select configuration section in ~/.python-gitlab.cfg\n      -p ID, --project ID   select GitLab project ('group/project' or the numeric\n                            ID)\n      --job ID              show the trace of GitLab CI job with this ID\n      --running             show the trace of the currently running GitLab CI job,\n                            if there is one (if there's more than one, picks the\n                            first one)\n      -b NAME, --branch NAME, --ref NAME\n                            show the last pipeline of this git branch (default:\n                            the currently checked out branch)\n      -t [N], --tail [N]    show the last N lines of the trace log\n      -f, --follow          periodically poll and output additional logs as the\n                            job runs\n      --print-url, --print-uri\n                            print URL to job page on GitLab instead of printing\n                            job's log\n      -a, --artifacts       download build artifacts\n\n.. [[[end]]]\n\n.. _python-gitlab: https://pypi.org/p/python-gitlab\n.. _pipx: https://pipxproject.github.io/pipx/\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "look at GitLab CI pipeline results from the command line",
    "version": "0.7.1",
    "project_urls": {
        "Homepage": "https://github.com/mgedmin/gitlab-trace"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3960fe7f5975517769205ba2eeb898a3363295bcebe7c649a35fc7dd09b79a3d",
                "md5": "0a67c531ae086c4e556af087e9a50076",
                "sha256": "d60b5be7d354a0983e2112fb08792cf815752da9cbd7111db5ac4443be832d71"
            },
            "downloads": -1,
            "filename": "gitlab_trace-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a67c531ae086c4e556af087e9a50076",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 19383,
            "upload_time": "2023-10-09T10:13:22",
            "upload_time_iso_8601": "2023-10-09T10:13:22.757277Z",
            "url": "https://files.pythonhosted.org/packages/39/60/fe7f5975517769205ba2eeb898a3363295bcebe7c649a35fc7dd09b79a3d/gitlab_trace-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53e8fe07885e72d444b339eae33c7bd8a5996e0314c40df5c8f93df348e57a1c",
                "md5": "2ab50e27c8ce0c0c35a2518693f8ff23",
                "sha256": "d4872994d1e1ac69f11dee90ddae7f811d685906c6f059ef4d20d22633d292f0"
            },
            "downloads": -1,
            "filename": "gitlab-trace-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2ab50e27c8ce0c0c35a2518693f8ff23",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 27631,
            "upload_time": "2023-10-09T10:13:24",
            "upload_time_iso_8601": "2023-10-09T10:13:24.722130Z",
            "url": "https://files.pythonhosted.org/packages/53/e8/fe07885e72d444b339eae33c7bd8a5996e0314c40df5c8f93df348e57a1c/gitlab-trace-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-09 10:13:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mgedmin",
    "github_project": "gitlab-trace",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "appveyor": true,
    "tox": true,
    "lcname": "gitlab-trace"
}
        
Elapsed time: 0.27151s