change to migrate rather than fork

This commit is contained in:
Trevor Batley 2023-06-04 17:00:24 +10:00
parent 277035cf55
commit b497a00693

View File

@ -148,52 +148,61 @@ fi
#Fork e-smith-<pkg> into users repositories as smeserver-<pkg> #Fork e-smith-<pkg> into users repositories as smeserver-<pkg>
# - add bugzilla and wiki references # - 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 # create a Bugzilla URL
PRODUCTBUGZILLA="SME%20Server%2010.X" PRODUCTBUGZILLA="SME%20Server%2010.X"
BASEORCONTRIB="base"
if [[ "$SOURCEORG" == "smecontribs" ]]; then if [[ "$SOURCEORG" == "smecontribs" ]]; then
PRODUCTBUGZILLA="SME%20Contribs" PRODUCTBUGZILLA="SME%20Contribs"
BASEORCONTRIB="contrib"
fi fi
# grab WIKILINK from source package # grab WIKILINK from source package
WIKILINK=$(curl "$SILENT" -X 'GET' \ #WIKILINK=$(curl "$SILENT" -X 'GET' \
"$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG" \ # "$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG" \
-H 'accept: application/json' \ # -H 'accept: application/json' \
-H 'Content-Type: application/json' \ # -H 'Content-Type: application/json' \
-H "Authorization: token $SOURCEACCESSTOKEN" | \ # -H "Authorization: token $SOURCEACCESSTOKEN" | \
jq -r ' .external_wiki.external_wiki_url') # jq -r ' .external_wiki.external_wiki_url')
if [ $DEBUG ] ; then echo "WIKILINK=$WIKILINK" ; fi #if [ $DEBUG ] ; then echo "WIKILINK=$WIKILINK" ; fi
# Update the repo with the changed description, bugzilla url and wiki url # migrate the source package over to target with updated fields
if [ $DEBUG ] ; then echo "Updating Description, Bug and Wiki links" ; fi if [ $DEBUG ] ; then echo "Migrating $SOURCEORG/$SOURCEPKG as $TARGETORG/$1 on $TARGETHOST" ; fi
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'PATCH' \ RESPONSE=$(curl $SILENT -k -X 'POST' \
"$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \ "$TARGETHOST/api/v1/repos/migrate" \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H "Authorization: token $SOURCEACCESSTOKEN" \ -H "Authorization: token $TARGETACCESSTOKEN" \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-d '{ -d '{
"description": "'"SMEServer Koozali developed repo for $TARGETPKG base"'", "description": "'"SMEServer Koozali developed git repo for $TARGETPKG $BASEORCONTRIB"'",
"has_issues": true, "clone_addr": "'"$TARGETHOST/$TARGETORG/$TARGETPKG.git"'",
"repo_name": "'"$TARGETPKG"'",
"repo_owner": "'"$TARGETORG"'",
"external_tracker": { "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"'" "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 # Create the local Git repository
GITFiles=$WORKDIR/GITFiles/$TARGETORG GITFiles=$WORKDIR/GITFiles/$TARGETORG