diff --git a/scripts/gitlab_script.py b/scripts/gitlab_script.py new file mode 100644 index 0000000000000000000000000000000000000000..1a0f044aa84297b18d24eb32024e211c651b8744 --- /dev/null +++ b/scripts/gitlab_script.py @@ -0,0 +1,23 @@ +import gitlab +import json + +config_json = [] + +with open('config.json','r') as file: + config_json = json.load(file) + +gl = gitlab.Gitlab( url='https://gitlab.rc.uab.edu', private_token=config_json["access_token"]) + + +hpc_project_main = gl.projects.get(config_json["from_project_id"]) +personal_hpc_project = gl.projects.get(config_json["to_project_id"]) + +from_variables = hpc_project_main.variables.list(get_all=True) + + +for vars in from_variables: + print(vars.key) + if vars.environment_scope == '*' or vars.environment_scope == 'dev': + personal_hpc_project.variables.create({'key':vars.key,'value':vars.value, 'environment_scope':vars.environment_scope}) + +print(personal_hpc_project.variables.list(get_all=True).count) \ No newline at end of file diff --git a/scripts/requirements.txt b/scripts/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d9e96faa52ca294f63e1af67102c90981b6207f --- /dev/null +++ b/scripts/requirements.txt @@ -0,0 +1,7 @@ +certifi==2024.12.14 +charset-normalizer==3.4.1 +idna==3.10 +python-gitlab==5.3.1 +requests==2.32.3 +requests-toolbelt==1.0.0 +urllib3==2.3.0