Giter Site home page Giter Site logo

rvojcik / gitlab-project-export Goto Github PK

View Code? Open in Web Editor NEW
100.0 3.0 38.0 55 KB

Simple python project for exporting GitLab projects with Export Project funkcionality in GitLab API. Import of exported projects is also supported

License: GNU General Public License v3.0

Python 100.00%
gitlab gitlab-api exporting-gitlab importing-gitlab gitlab-backup

gitlab-project-export's People

Contributors

daka83 avatar lpirl avatar matandd avatar mrimann avatar rvojcik avatar syphernl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gitlab-project-export's Issues

Throttle requests

Trying to download many projects results in

Export failed for project <group>/<project>
API not respond well with 429 {"message":{"error":"This endpoint has been requested too many times. Try again later."}}

I have an error when exporting

python --version fish-1 | 1
Python 3.6.9

/gitlab-project-export.py -c ./config.yml fish-1 | 0 [19:33:18]
Traceback (most recent call last):
File "./gitlab-project-export.py", line 49, in
c = config.Config(args.config)
File "/root/test/gitlab-project-export/gitlab_export/config.py", line 15, in init
self.config_load()
File "/root/test/gitlab-project-export/gitlab_export/config.py", line 43, in config_load
self.config = yaml.load(self.conf_fh.read(), Loader=yaml.FullLoader)
AttributeError: module 'yaml' has no attribute 'FullLoader'

error when importing

Hi, I am trying to import a repo and I am getting :

API not respond well with 404 {"message":"404 Namespace Not Found"}
{"message":"404 Namespace Not Found"}
Import was not successful

this is the command I am running:

python3 gitlab_project_import/gitlab-project-import.py -c gitlab_project_import/config_import2.yml -f ./importedgitlab_cicdtar.gz "-p group/gitlab_cicd"

I did not find anywhere where I can specify a namespace. I used the same kind of config.yml as to export the repo. Do you have an example of a specific one for importing?

Thanks Javier

Migration of Archived Projects

I've just exported from one Gitlab installation and tried to import into the new Gitlab Installation - so far this worked pretty well!

But one single project did not appear on the new Gitlab - but it was exported + imported successful without any warning. It turned out, that in the source Gitlab-Instance, this project was marked as archived.

As an improvement, it would be cool, if the exporter script either

  • warns on archived projects
  • ignores archived projects

Or alternatively, that the importer script would properly handle this (and the imported project would again be marked archived in the target installation, rather than getting lost after importing)

Import GitLab project error

Hi,

I am trying to export one of the gitlab project and import it.
While importing at first I got the issue,

AttributeError: module 'urllib' has no attribute 'quote'

But I resolved by changing the
urllib.quote(project_path, safe='') -> urllib.parse.quote(project_path, safe='')

Later while importing the file I am getting following issue:

File "gitlab-project-import.py", line 60, in <module>
    status = gitlab.project_import(args.project_path, args.filepath)
  File "....\gitlab-project-export\lib\gitlab.py", line 191, in project_import
    r = self.__api_import(project_name, namespace, filepath)
  File "....\gitlab-project-export\lib\gitlab.py", line 43, in __api_import
    headers=self.headers)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 516, in request
    prep = self.prepare_request(req)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 459, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 317, in prepare
    self.prepare_body(data, files, json)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 505, in prepare_body
    (body, content_type) = self._encode_files(files, data)
  File "....\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 159, in _encode_files
    fdata = fp.read()
  File "....\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 111: character maps to <undefined>

Any idea how to resolve this?

Option for exporting all projects

Hi, I had to set this value to membership=False in order to download all projects on a shared gitlab instance, with config of:

  projects: 
    - '/*'

I'm not sure if anyone knows of a better way to have this utility simply export all projects?

Regularity of backups

Thanks for a great program!

I wanted to be able to schedule regular backups, but some projects need to be backed up at different regularities than others. So I forked and added the concept of regularity to your code. Now each project has associated with it a list of regularities. If the regularity (passed as argument -r) matches one in the list for the project, then it is exported. You can see the details at https://github.com/dazsmith/gitlab-project-export/commits/master.

Should I submit a pull request?

API not respond well with 404

Hi,

I'm trying to use the script to export my Gitlab projects, but I get API not respond well with 404 error.

I tried to specify my project as group/project-name, but I also tried with /*. Using /* it identifies all my projects and creates the folders for them (the whole group - project names hierarchy), but it gives the same 404 error for all projects.

In Gitlab I can access the project using https://_gitlab_url/group/project-name

I also tried to export the project from Postman. Using https://_gitlab_url/api/v4/projects/2/export works, but using https://_gitlab_url/api/v4/projects/group%2Fproject-name/export returns 404.

I'm using Gitlab 13.9.2-ce.0 (Dockerized).
I enabled all scopes for the Personal Access Token.

option for self-signed certs?

As many people run gitlab on private instances, they may be using self-signed certs. Is there a technique to work with this setup?

I'm thinking of a couple different solutions:

  • an option to point to a cert file
  • an option to disable SSL verification
  • at least an update to README saying how to use REQUESTS_CA_BUNDLE to point to cert

Publish released package

It would be nice to have a pip installable version of this available to make installation more seamless than the git variant.

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.