update get-git-lab-project

This commit is contained in:
Dmitry Afanasyev 2022-04-29 16:54:07 +03:00
parent c8780af4f6
commit e2218ddf30
5 changed files with 124 additions and 9 deletions

107
get-gitlab-projects/.gitignore vendored Normal file
View File

@ -0,0 +1,107 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.idea/
.vscode/

View File

@ -1 +0,0 @@
.env

View File

@ -1,13 +1,10 @@
import importlib.util import importlib.util
import logging import logging
import sys import sys
from decouple import AutoConfig
from pathlib import Path from pathlib import Path
current_dir = Path(__file__).parent.parent
config = AutoConfig(search_path=current_dir.joinpath('get_project_core'))
current_dir = Path(__file__).parent.parent
# use loguru if it is possible for color output # use loguru if it is possible for color output
if importlib.util.find_spec('loguru') is not None: if importlib.util.find_spec('loguru') is not None:

View File

@ -1,12 +1,15 @@
import json # noqa # pylint: disable=unused-import import json # noqa # pylint: disable=unused-import
import subprocess import subprocess
import sys
import time import time
import requests import requests
from get_project_core.settings import logger, config, current_dir from get_project_core.settings import current_dir, logger
headers = {'PRIVATE-TOKEN': config('X5_SCM_TOKEN', cast=str)} GITLAB_TOKEN = ''
headers = {'PRIVATE-TOKEN': GITLAB_TOKEN}
def create_repositories(group_id: int): def create_repositories(group_id: int):
@ -36,5 +39,13 @@ def update_submodules():
if __name__ == '__main__': if __name__ == '__main__':
create_repositories(group_id=3574) args = sys.argv[1:]
# update_submodules() try:
group = args[0]
logger.info(group)
create_repositories(group_id=int(group))
update_submodules()
except IndexError:
logger.error('Gitlab group id must be set')
except ValueError:
logger.error('Gitlab group id must be integer')

View File

@ -0,0 +1 @@
requests