Update list-all-ord-repos to include all releases

This commit is contained in:
Brian Read 2023-07-19 13:20:02 +01:00
parent ee106a077c
commit 307a492847
2 changed files with 35 additions and 7 deletions

View File

@ -131,6 +131,7 @@ Does:
Create a release and upload the rpm (src and bin) as attachments to that release
* \<repository\> repository (package) to be editted (e.g. smeserver-yum)
* \<draft | prerelease> create draft or prerelease else it will create full stable release
* \<organisation\> can be any organisation or user on the remote or local GITEA instance
* \<release-tag\> will have "SME" added to the front of it (so e.g. 10.2 -> SME10.2)
@ -149,3 +150,23 @@ Does:
Create the release (deleting one that is the same tag),
Then uploads the .src.rpm and .rpm as an attachment (deleting any one of the same name)
## git-list-all-org-repos.sh
List the repos in any one organisation and optionally show the release and some associated fields
* \<organisation\> can be any organisation or user on the remote or local GITEA instance
optional: (in any order)
* \<local\> used with org= and will use local GITEA instance, default remote - will be passed to \<script\>
* \<noisy\> show line being executed
* \<debug\> run in debug mode
* \<draftrelease\> Show all draft releases
* \<prerelease\> Show all prereleases
* \<release\> Show all full releases
* \<allreleases\> Show all releases
* \<cloneurl\> Show the url to use to clone this repo
* \<zipurl\> Show the url to get the zipped contents of the repo
Does:
Display a "table" of each repo and the optional extras requested.

View File

@ -55,7 +55,7 @@ for param in $2 $3 $4 $5 $6 $7 $8 $9 $10; do
prerelease )
SHOWRELEASE=true;SHOWPRERELEASE=true;SHOWDRAFT=false ;;
allreleases )
SHOWRELEASE=true;SHOWPRERELEASE=true;SHOWDRAFT=true ;;
SHOWRELEASE=true;SHOWALLRELEASES=true ;;
cloneurl )
SHOWCLONEURL=true ;;
zipurl )
@ -90,22 +90,29 @@ done
REPO_LIST=$(echo $REPO_LIST | tr -s '[:space:]' '\n' | sort)
for item in $REPO_LIST ; do
line=$item
if [[ $SHOWID || $SHOWRELEASE || $SHOWCLONEURL || $ZIPURL ]] ; then
if [[ $SHOWID || $SHOWRELEASE || $SHOWCLONEURL || $ZIPURL || $SHOWALLRELEASES ]] ; then
#Find and show releases
# echo "$GITEAHOST/api/v1/repos/$ORG_NAME/$item/releases?draft=true&pre-release=true&limit=100" \
# -H 'accept: application/json' \
# -H "Authorization: token $GITEAACCESSTOKEN"
RESPONSE=$(curl -s -X 'GET' \
"$GITEAHOST/api/v1/repos/$ORG_NAME/$item/releases?draft=$SHOWDRAFT&pre-release=SHOWPRERELEASE&limit=100" \
-H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN")
if [ $SHOWALLRELEASES ] ; then
RESPONSE=$(curl -s -X 'GET' \
"$GITEAHOST/api/v1/repos/$ORG_NAME/$item/releases" \
-H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN");
else
RESPONSE=$(curl -s -X 'GET' \
"$GITEAHOST/api/v1/repos/$ORG_NAME/$item/releases?draft=$SHOWDRAFT&pre-release=$SHOWPRERELEASE&limit=100" \
-H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN");
fi
if [ $DEBUG ] ; then echo "$RESPONSE"; fi
if [ $SHOWRELEASE ] ; then
# Will need to use " jq 'map(.name)'" once we have more than one release.
REL=$(echo $RESPONSE | jq -r '.[0].tag_name')
ID=$(echo $RESPONSE | jq -r '.[0].id')
if [ $DEBUG ] ; then echo $REL; fi
if [ "$REL" ] ; then line="$line\t$REL($ID)";
if [ "$REL" ] ; then line="$line\t\t\t$REL($ID)";
else line="$line\tnone";fi
if [ $SHOWCLONEURL ] ; then
URL=$(echo $RESPONSE | jq -r '.[0].url')