change to migrate rather than fork
This commit is contained in:
parent
277035cf55
commit
b497a00693
@ -148,52 +148,61 @@ fi
|
||||
#Fork e-smith-<pkg> into users repositories as smeserver-<pkg>
|
||||
# - add bugzilla and wiki references
|
||||
|
||||
if [ $DEBUG ] ; then echo "Forking $SORCEORG/$SOURCEPKG into $TARGETORG/$TARGETPKG!" ; fi
|
||||
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'POST' \
|
||||
"$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG/forks" \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: token $SOURCEACCESSTOKEN" \
|
||||
-d '{
|
||||
"name": "'"$TARGETPKG"'"
|
||||
}')
|
||||
|
||||
# create a Bugzilla URL
|
||||
PRODUCTBUGZILLA="SME%20Server%2010.X"
|
||||
BASEORCONTRIB="base"
|
||||
if [[ "$SOURCEORG" == "smecontribs" ]]; then
|
||||
PRODUCTBUGZILLA="SME%20Contribs"
|
||||
BASEORCONTRIB="contrib"
|
||||
fi
|
||||
|
||||
# grab WIKILINK from source package
|
||||
WIKILINK=$(curl "$SILENT" -X 'GET' \
|
||||
"$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG" \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: token $SOURCEACCESSTOKEN" | \
|
||||
jq -r ' .external_wiki.external_wiki_url')
|
||||
if [ $DEBUG ] ; then echo "WIKILINK=$WIKILINK" ; fi
|
||||
#WIKILINK=$(curl "$SILENT" -X 'GET' \
|
||||
# "$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG" \
|
||||
# -H 'accept: application/json' \
|
||||
# -H 'Content-Type: application/json' \
|
||||
# -H "Authorization: token $SOURCEACCESSTOKEN" | \
|
||||
# jq -r ' .external_wiki.external_wiki_url')
|
||||
#if [ $DEBUG ] ; then echo "WIKILINK=$WIKILINK" ; fi
|
||||
|
||||
# Update the repo with the changed description, bugzilla url and wiki url
|
||||
if [ $DEBUG ] ; then echo "Updating Description, Bug and Wiki links" ; fi
|
||||
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'PATCH' \
|
||||
"$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
||||
-H 'accept: application/json' \
|
||||
-H "Authorization: token $SOURCEACCESSTOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"description": "'"SMEServer Koozali developed repo for $TARGETPKG base"'",
|
||||
"has_issues": true,
|
||||
# migrate the source package over to target with updated fields
|
||||
if [ $DEBUG ] ; then echo "Migrating $SOURCEORG/$SOURCEPKG as $TARGETORG/$1 on $TARGETHOST" ; fi
|
||||
RESPONSE=$(curl $SILENT -k -X 'POST' \
|
||||
"$TARGETHOST/api/v1/repos/migrate" \
|
||||
-H 'accept: application/json' \
|
||||
-H "Authorization: token $TARGETACCESSTOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"description": "'"SMEServer Koozali developed git repo for $TARGETPKG $BASEORCONTRIB"'",
|
||||
"clone_addr": "'"$TARGETHOST/$TARGETORG/$TARGETPKG.git"'",
|
||||
"repo_name": "'"$TARGETPKG"'",
|
||||
"repo_owner": "'"$TARGETORG"'",
|
||||
"external_tracker": {
|
||||
"external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
|
||||
"external_tracker_style": "numeric",
|
||||
"external_tracker_url": "'"https://bugs.koozali.org/buglist.cgi?component=$TARGETPKG&product=$PRODUCTBUGZILLA"'"
|
||||
},
|
||||
"has_wiki": true,
|
||||
"external_wiki": {
|
||||
"external_wiki_url": "'"$WIKILINK"'"
|
||||
}
|
||||
}'
|
||||
)
|
||||
}'
|
||||
)
|
||||
# Update the repo with the changed description, bugzilla url and wiki url
|
||||
#if [ $DEBUG ] ; then echo "Updating Description, Bug and Wiki links" ; fi
|
||||
#RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'PATCH' \
|
||||
# "$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
||||
# -H 'accept: application/json' \
|
||||
# -H "Authorization: token $SOURCEACCESSTOKEN" \
|
||||
# -H 'Content-Type: application/json' \
|
||||
# -d '{
|
||||
# "description": "'"SMEServer Koozali developed repo for $TARGETPKG base"'",
|
||||
# "has_issues": true,
|
||||
# "external_tracker": {
|
||||
# "external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
|
||||
# "external_tracker_style": "numeric",
|
||||
# "external_tracker_url": "'"https://bugs.koozali.org/buglist.cgi?component=$TARGETPKG&product=$PRODUCTBUGZILLA"'"
|
||||
# },
|
||||
# "has_wiki": true,
|
||||
# "external_wiki": {
|
||||
# "external_wiki_url": "'"$WIKILINK"'"
|
||||
# }
|
||||
# }'
|
||||
# )
|
||||
|
||||
# Create the local Git repository
|
||||
GITFiles=$WORKDIR/GITFiles/$TARGETORG
|
||||
|
Loading…
Reference in New Issue
Block a user