Last active
June 3, 2021 04:25
-
-
Save prem0132/cdcfe8e6f5241650e727bbe2b41429eb to your computer and use it in GitHub Desktop.
migrate gitlab vars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gitlab | |
| gl = gitlab.Gitlab('https://gitlab.com', private_token='************') | |
| src_project = gl.projects.get('1111111') | |
| dst_project = gl.groups.get('22222222') | |
| variables = src_project.variables.list(all=True) | |
| for variable in variables: | |
| attrs=variable.__dict__ | |
| var=attrs["_attrs"] | |
| d_var=dst_project.variables.create(var) | |
| d_var.save() | |
| variables = dst_project.variables.list(all=True) | |
| print("\n\n\n\n",variables) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment