From 59cac1a9672051a2b523f61a198b1707a74ec0fd Mon Sep 17 00:00:00 2001
From: Dylan Wheeler <dwheeler@Dylans-MacBook-Pro.local>
Date: Wed, 8 Jan 2025 14:57:15 -0600
Subject: [PATCH] adding scripts file to allow copying of variables from
 established project to a peronsal copy

---
 scripts/gitlab_script.py | 23 +++++++++++++++++++++++
 scripts/requirements.txt |  7 +++++++
 2 files changed, 30 insertions(+)
 create mode 100644 scripts/gitlab_script.py
 create mode 100644 scripts/requirements.txt

diff --git a/scripts/gitlab_script.py b/scripts/gitlab_script.py
new file mode 100644
index 0000000..1a0f044
--- /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 0000000..9d9e96f
--- /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
-- 
GitLab