[med-svn] [Git][med-team/community/helper-scripts][master] allow running on existing repos that weren't fully setup

Michael R. Crusoe gitlab at salsa.debian.org
Mon Jan 14 09:34:28 GMT 2019


Michael R. Crusoe pushed to branch master at Debian Med / community / helper-scripts


Commits:
85d1b05d by Michael R. Crusoe at 2019-01-14T09:34:25Z
allow running on existing repos that weren't fully setup 
- - - - -


1 changed file:

- inject-into-salsa-git


Changes:

=====================================
inject-into-salsa-git
=====================================
@@ -36,17 +36,32 @@ if [ "$SALSA_GROUP_ID" = "" ] ; then
     exit 1
 fi
 
+# Did we already push to salsa?
 set -x
-RESPONSE=$(curl "$SALSA_URL/projects?private_token=$SALSA_TOKEN" \
-     --data "path=${DEBPKGNAME}&namespace_id=${SALSA_GROUP_ID}&description=${SHORTDESC}&visibility=public")
+RESPONSE=$(curl "$SALSA_URL/projects?search=${DEBPKGNAME}")
+echo $RESPONSE | jq --exit-status "map(select(.path == \"${DEBPKGNAME}\")) | .[0].id" > /dev/null
+set +x
+if [ $? -ne 0 ]; then
+    # Seems like not, lets create a project
+    set -x
+    RESPONSE=$(curl "$SALSA_URL/projects?private_token=$SALSA_TOKEN" \
+        --data "path=${DEBPKGNAME}&namespace_id=${SALSA_GROUP_ID}&description=${SHORTDESC}&visibility=public")
 
-echo $RESPONSE | jq --exit-status .id > /dev/null
-check_return_code
+    echo $RESPONSE | jq --exit-status .id > /dev/null
+    check_return_code
 
-PROJECT_ID=$(echo $RESPONSE | jq '.id')
-set +x
+    PROJECT_ID=$(echo $RESPONSE | jq '.id')
+    set +x
+else
+    set -x
+    PROJECT_ID=$(echo $RESPONSE | jq "map(select(.path == \"${DEBPKGNAME}\")) | .[0].id")
+    set +x
+fi
 
-git remote add origin git at salsa.debian.org:${SALSA_GROUP}/${DEBPKGNAME}.git
+git remote show origin
+if [ $? -ne 0 ] ; then
+    git remote add origin git at salsa.debian.org:${SALSA_GROUP}/${DEBPKGNAME}.git
+fi
 git push origin master
 git push --all --set-upstream
 git push --tags



View it on GitLab: https://salsa.debian.org/med-team/community/helper-scripts/commit/85d1b05d244bb2eaab0a050eb1bbb3039cffd352

-- 
View it on GitLab: https://salsa.debian.org/med-team/community/helper-scripts/commit/85d1b05d244bb2eaab0a050eb1bbb3039cffd352
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190114/65e3c562/attachment-0001.html>


More information about the debian-med-commit mailing list