Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
datadump
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSUG
RESIF
datadump
Commits
638ab314
Commit
638ab314
authored
3 years ago
by
Jonathan Schaeffer
Browse files
Options
Downloads
Patches
Plain Diff
GIT projects dump
parent
7e2cd342
Loading
Loading
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/git_dump.sh
+15
-19
15 additions, 19 deletions
src/git_dump.sh
with
15 additions
and
19 deletions
src/git_dump.sh
+
15
−
19
View file @
638ab314
...
...
@@ -5,7 +5,7 @@
username
=
"ccdump"
# token for ccdump
TOKEN
=
"
RQP7ixWoMVk6fxnxfypr
"
TOKEN
=
"
emN7szEu-hchxv-eYS6D
"
# url prefix in children.json file
PREFIX
=
"http_url_to_repo"
...
...
@@ -16,28 +16,24 @@ per_page=50
# les repertoires git de OSUG/RESIF/ se trouvent dans le fichier children.json
url_repositories
=
"https://gricad-gitlab.univ-grenoble-alpes.fr/api/v4/groups/192/projects?simple=true&include_subgroups=true&per_page=
$per_page
"
############ function #################
git_clone
()
{
# project list creation
project_list
=
$(
curl
-s
--header
"PRIVATE-TOKEN:
$TOKEN
"
$url_repositories
"&page="
$page
|
grep
-o
"
\"
$PREFIX
\"
:[^ ,]
\+
"
| xargs
-n
1 |
sed
's/http_url_to_repo:https:\/\///'
)
# project git clone creation on local host
for
project
in
${
project_list
[@]
}
do
git clone
--bare
https://
$username
:
$TOKEN
@
$project
done
}
############ script ##################
# total number of projects
total
=
$(
curl
-i
-s
--header
"PRIVATE-TOKEN:
$TOKEN
"
"
$url_repositories
"
|
awk
'/x-total:/ {printf "%.0f\n", $2}'
)
# max page calculation
max_page
=
$((
$total
/
$per_page
+
1
))
for
page
in
`
seq
$max_page
`
do
git_clone
for
page
in
`
seq
$max_page
`
;
do
# project list creation
project_list
=
$(
curl
-s
--header
"PRIVATE-TOKEN:
$TOKEN
"
$url_repositories
"&page="
$page
|
grep
-o
"
\"
$PREFIX
\"
:[^ ,]
\+
"
| xargs
-n
1|sed
-e
's/http_url_to_repo:https:\/\///'
)
for
url
in
${
project_list
[@]
}
;
do
# ygricad-gitlab.univ-grenoble-alpes.fr/OSUG/RESIF/ws-availability-k8s.git
pattern
=
"^.*
\/
OSUG
\/
RESIF
\/
(.*
\/
){0,1}(.+.git)$"
if
[[
"
$url
"
=
~
$pattern
]]
;
then
destdir
=
$RESIFDD_WORKDIR
/projetcs/
${
BASH_REMATCH
[1]
}
project
=
${
BASH_REMATCH
[2]
}
echo
"Cloning
$url
in
$destdir
/
$project
"
mkdir
-p
$destdir
git clone
-q
--bare
https://
$username
:
$TOKEN
@
$url
$destdir
/
$project
fi
done
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment