# dest project does not exist: create (disable MR and issues as they are cloned projects)
log_info "... destination project not found: create with visibility \\e[33;1m${dest_visibility}\\e[0m"
dest_project_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X POST "$DEST_GITLAB_API/projects"\
dest_project_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X POST "$DEST_GITLAB_API/projects"\
dest_project_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/projects/$dest_project_id"\
dest_project_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/projects/$dest_project_id"\
--data"{
\"name\": $(echo"$src_project_json" | jq .name),
\"visibility\": \"$dest_visibility\"
}")
else
dest_project_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/projects/$dest_project_id"\
dest_project_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/projects/$dest_project_id"\
dest_project_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"--form"avatar=@$avatar_filename"-X PUT "$DEST_GITLAB_API/projects/$dest_project_id")
dest_project_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"--form"avatar=@$avatar_filename"-X PUT "$DEST_GITLAB_API/projects/$dest_project_id")
curl ${INSECURE+-k}-sS-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"-X POST "$DEST_GITLAB_API/projects/$dest_project_id/protected_branches?name=$src_default_branch"> /dev/null
curl ${INSECURE:+-k}-sS-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"-X POST "$DEST_GITLAB_API/projects/$dest_project_id/protected_branches?name=$src_default_branch"> /dev/null
fi
fi
}
@@ -236,7 +236,7 @@ function sync_group() {
local dest_group_full_path=$4
local dest_group_name=${dest_group_full_path//\//%2f}
log_info "Synchronizing group \\e[33;1m${src_group_full_path}\\e[0m (parent group ID \\e[33;1m${dest_parent_id:-none (dry run)}\\e[0m)"
log_info "... destination group not found: create with visibility \\e[33;1m${dest_visibility}\\e[0m"
dest_group_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X POST "$DEST_GITLAB_API/groups"\
dest_group_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X POST "$DEST_GITLAB_API/groups"\
--data"{
\"path\": $(echo"$src_group_json" | jq .path),
\"name\": $(echo"$src_group_json" | jq .name),
@@ -263,13 +263,13 @@ function sync_group() {
log_info "... destination group found: synchronize"
if[["${GROUP_DESCRIPTION_DISABLED}"=="true"]]
then
dest_group_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/groups/$dest_group_name"\
dest_group_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/groups/$dest_group_name"\
--data"{
\"name\": $(echo"$src_group_json" | jq .name),
\"visibility\": \"$dest_visibility\"
}")
else
dest_group_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/groups/$dest_group_name"\
dest_group_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"-H"Content-Type: application/json"-X PUT "$DEST_GITLAB_API/groups/$dest_group_name"\
--data"{
\"name\": $(echo"$src_group_json" | jq .name),
\"visibility\": \"$dest_visibility\",
@@ -285,10 +285,10 @@ function sync_group() {
local dest_group_id=$(echo"$dest_group_json" | jq -r .id)
log_info "... set TBC_NAMESPACE group variable ($DEST_SYNC_PATH)"
curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"--form"key=TBC_NAMESPACE"--form"value=$DEST_SYNC_PATH"-X POST "$DEST_GITLAB_API/groups/$dest_group_id/variables"
curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"--form"key=TBC_NAMESPACE"--form"value=$DEST_SYNC_PATH"-X POST "$DEST_GITLAB_API/groups/$dest_group_id/variables"
if curl ${INSECURE+-k}-sSfL--output"$avatar_filename""$src_avatar_url"
if curl ${INSECURE:+-k}-sSfL--output"$avatar_filename""$src_avatar_url"
then
dest_group_json=$(curl ${INSECURE+-k}-sSf-H"${DEST_TOKEN+PRIVATE-TOKEN:$DEST_TOKEN}"--form"avatar=@$avatar_filename"-X PUT "$DEST_GITLAB_API/groups/$dest_group_id")
dest_group_json=$(curl ${INSECURE:+-k}-sSf-H"${DEST_TOKEN:+PRIVATE-TOKEN:$DEST_TOKEN}"--form"avatar=@$avatar_filename"-X PUT "$DEST_GITLAB_API/groups/$dest_group_id")