Git Product home page Git Product logo

gitlab-art's Introduction

Kosma Moczek

Buy me a Ko-Fi

Thanks for visiting. This profile contains a multitude of different projects I've created over the years. My work is scattered over the 'net; if you can't find something on this profile, see also:

PS. Need electronics designed? I'm available for hire. I specialize in IoT/battery-powered/wireless/communication/interface devices.

gitlab-art's People

Contributors

ellisto avatar haboustak avatar jonathonreinhart avatar kosma avatar retu2libc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gitlab-art's Issues

Add CI_JOB_TOKEN support

From the README:

Gitlab's $CI_BUILD_TOKEN infrastructure doesn't support accessing artifacts, so a private token must be used. This is very unfortunate and kludgey. This might be fixed in future Gitlab releases (if I bug them hard enough).

This seems to have been resolved on Gitlab's end since setting the request header JOB-TOKEN to $CI_JOB_TOKEN allows you to query the Gitlab artifacts api.

Supported Python3 versions

1c0dfde changed ZipFile iteration to use ZipInfo.is_dir which was introduced in Python 3.6.

I have not yet upgraded everything to Debian Buster, so some machines are still running 3.5.

Can we have a statement in the README about supported python versions?

Problem with API v4

Project doesn't work with GitLab API v4, API v3 was removed since GitLab 11.0.

Install should create empty directories

Even when the gitlab artifact includes empty directories the install step skips them and doesn't ever create them. It should reproduce the artifact as-is.

In the example below, if the artifact zip contains the directories and files below the directory bar will not ever be installed.

$ tree 
.
├── bar
├── foo
│   └── hello.txt
└── hello.txt

Add the ability to fetch source files from a repository also

Sometimes, we want to not only use artifacts from another project, but also files out of the source tree. This can be worked around by collecting those files as artifacts, but it might be helpful to pull them right from the repository instead.

The hardest part of this would be adapting the YML schema to accommodate.

Ambiguity if a branch and tag have the same name

@xanarin pointed out that Git allows a tag and a branch to have the same name. So the fix in #16 introduces a potential ambiguity, by no longer allowing tags/v1.2.3.

The problem is that the GitLab list project pipelines API just says ref, and I've proven that you cannot pass tags/foo:

>>> p.pipelines.list(ref='v8.4.8-1')
[<ProjectPipeline id:20692>, <ProjectPipeline id:20685>, <ProjectPipeline id:20639>, <ProjectPipeline id:20638>, <ProjectPipeline id:20478>]
>>> p.pipelines.list(ref='tags/v8.4.8-1')
[]

The API does however provide scope:

Attribute Type Required Description
scope string no The scope of pipelines, one of: running, pending, finished, branches, tags

So perhaps we could look at the ref to see if tags/ is present, and if so, strip it, and then pass scope=tags.

install should fail if a source path is not found in the archive

The install command builds a list of file operations, but it never checks that every operation is performed. It's very common for a source file path to change, resulting in no match when iterating archive members.

One solution is to remove source files from the list when they are matched. An error should be raised if the installs list is not empty after processing the entire archive.

Fetch job by ref instead of commit

Currently art resolves ref to its commit hash and then queries jobs using the sha field.

This can result in incorrect results. In particular, consider a policy of only retaining artifacts for tags and latest:

job id commit hash ref artifacts
2 abcdefdeadbeef master (deleted)
1 abcdefdeadbeef v1.0.0 artifacts.zip

in this case, fetching aritfacts for ref: v1.0.0 results in resolving v1.0.0 to abcdefdeadbeef and then getting the last successful job, (2), whose artifacts have been deleted.

If, on the other hand, the job was queried by ref, it would have returned 1.

art install raises a KeyError exception if an artifact isn't available in the cache

If the art install command is run without art download or if an archive file is removed from the cache directory, the command raises a KeyError exception and prints a traceback.

$ python3 -m art install
Traceback (most recent call last):
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.cache/art/project/499184.zip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "kosma/gitlab-art/art/_cache.py", line 35, in get
    raise KeyError(filename)

Improve handling of GitLab exceptions

There are several common exceptions raised by GitLab that should be expected and reported to the user in a clearer way.

  1. Exceptions related to connecting to GitLab (bad url, no network)
  2. Problems with the TLS certificate (expired cert, untrusted cert)
  3. Authentication issues (no token, expired token)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.