Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dwheel7/hpc-factory
  • rc/hpc-factory
  • louistw/hpc-factory
  • jpr/hpc-factory
  • krish94/hpc-factory
  • atlurie/hpc-factory
6 results
Show changes
You will need to create a config.json file in the scripts directory containing the following fields:
{
access_token - this will be your personal access token as a string
from_project_id - this will be the project id you are copying from
to_project_id - this will be the project id that you are copying to
}
\ No newline at end of file
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
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