File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [ -z " ${GITLAB_TOKEN} " ]; then
4
+ echo ' Please provide the environment variable $GITLAB_TOKEN'
5
+ exit 1
6
+ fi
7
+
8
+ if [ $# -lt 2 ]; then
9
+ echo " Usage: $0 <gitlab_host> <gitlab_namespace> [</path/to/target.config>]"
10
+ exit 1
11
+ fi
12
+
13
+ prefix=" $( pwd) "
14
+ gitlab_host=" ${1} "
15
+ namespace=" ${2} "
16
+ config_file=" ${3:- ./ vcspull.yaml} "
17
+
18
+ current_namespace_path=" "
19
+
20
+ curl --silent --show-error --header " Authorization: Bearer ${GITLAB_TOKEN} " " https://${gitlab_host} /api/v4/groups/${namespace} /projects?include_subgroups=true&per_page=100" \
21
+ | jq -r ' .[]|.namespace.full_path + " " + .path' \
22
+ | LC_ALL=C sort \
23
+ | while read namespace_path reponame; do
24
+ if [ " ${current_namespace_path} " != " ${namespace_path} " ]; then
25
+ current_namespace_path=" ${namespace_path} "
26
+
27
+ echo " ${prefix} /${current_namespace_path} :"
28
+ fi
29
+
30
+ # simplified config not working - https://github.com/vcs-python/vcspull/issues/332
31
+ # echo " ${reponame}: 'git+ssh://git@${gitlab_host}/${current_namespace_path}/${reponame}.git'"
32
+
33
+ echo " ${reponame} :"
34
+ echo " url: 'git+ssh://git@${gitlab_host} /${current_namespace_path} /${reponame} .git'"
35
+ echo " remotes:"
36
+ echo " origin: 'ssh://git@${gitlab_host} /${current_namespace_path} /${reponame} .git'"
37
+ done \
38
+ | tee " ${config_file} "
You can’t perform that action at this time.
0 commit comments