Add release type to make-release, add WIP list of repos
Update email address
This commit is contained in:
parent
6e9f8dddb9
commit
477ecb7c4d
121
git-list-all-org-repos.sh
Executable file
121
git-list-all-org-repos.sh
Executable file
@ -0,0 +1,121 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Pull in parameters from a ini file
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifilename or /etc/smegit.ini"
|
||||||
|
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release] [cloneurl] [zipurl]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
inifilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
NOISY=
|
||||||
|
EXTRAPARAMS=
|
||||||
|
DEBUG=
|
||||||
|
for param in $2 $3 $4 $5 $6 $7 $8 $9 $10; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
noisy )
|
||||||
|
NOISY=true ;;
|
||||||
|
release )
|
||||||
|
SHOWRELEASE=true;SHOWPRERELEASE=false;SHOWDRAFT=false ;;
|
||||||
|
draftrelease )
|
||||||
|
SHOWRELEASE=true;SHOWPRERELEASE=false;SHOWDRAFT=true ;;
|
||||||
|
prerelease )
|
||||||
|
SHOWRELEASE=true;SHOWPRERELEASE=true;SHOWDRAFT=false ;;
|
||||||
|
allreleases )
|
||||||
|
SHOWRELEASE=true;SHOWPRERELEASE=true;SHOWDRAFT=true ;;
|
||||||
|
cloneurl )
|
||||||
|
SHOWCLONEURL=true ;;
|
||||||
|
zipurl )
|
||||||
|
SHOWZIPURL=true ;;
|
||||||
|
id )
|
||||||
|
SHOWID=true ;;
|
||||||
|
* )
|
||||||
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release] [cloneurl] [zipurl]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
ORG_NAME="$1"
|
||||||
|
PAGE_COUNTER=1
|
||||||
|
REPO_LIST=""
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
REPO_PAGE=$(curl -s -H "Authorization: token $GITEAACCESSTOKEN" "$GITEAHOST/api/v1/orgs/$ORG_NAME/repos?page=$PAGE_COUNTER")
|
||||||
|
if [[ $(echo $REPO_PAGE | jq length) -eq 0 ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
REPO_LIST="$REPO_LIST $(echo $REPO_PAGE | jq -r .[].full_name | cut -d / -f 2 )"
|
||||||
|
PAGE_COUNTER=$((PAGE_COUNTER+1))
|
||||||
|
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
|
||||||
|
#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 [ $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)";
|
||||||
|
else line="$line\tnone";fi
|
||||||
|
if [ $SHOWCLONEURL ] ; then
|
||||||
|
URL=$(echo $RESPONSE | jq -r '.[0].url')
|
||||||
|
if [ "$URL" ] ; then line="$line\t$URL"; fi
|
||||||
|
fi
|
||||||
|
if [ $SHOWZIPURL ] ; then
|
||||||
|
URL=$(echo $RESPONSE | jq -r '.[0].zipball_url')
|
||||||
|
if [ "$URL" ] ; then line="$line\t$URL"; fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo -e $line;
|
||||||
|
done
|
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
if [[ -z $1 ]] ; then
|
if [[ -z $1 ]] ; then
|
||||||
echo "************make-release <modulename> <organization> <release> [local] [debug] [noisy]"
|
echo "git-make-release <modulename> <organization> <release> [local] [debug] [noisy] [draft] [prerelease]"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ if [ ! -e $inifilename ] ; then
|
|||||||
# Not here, look at system default
|
# Not here, look at system default
|
||||||
if [ ! -e /etc/smegit.ini ] ; then
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
echo "No ini file found $inifiename or /etc/smegit.ini"
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
echo "make-release <modulename> <organization> <release> [local] [debug] [noisy]"
|
echo "git-make-release <modulename> <organization> <release> [local] [debug] [noisy] [draft] [prerelease]"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
initfilename="/etc/smegit.ini"
|
initfilename="/etc/smegit.ini"
|
||||||
@ -48,6 +48,8 @@ GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
|||||||
GITEAHOST=${remote_GITEAHOST}
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
NOISY=
|
NOISY=
|
||||||
EXTRAPARAMS=
|
EXTRAPARAMS=
|
||||||
|
MAKEPRE=false
|
||||||
|
MAKEDRAFT=false
|
||||||
for param in $4 $5 $6; do
|
for param in $4 $5 $6; do
|
||||||
if [ $param ] ; then
|
if [ $param ] ; then
|
||||||
case $param in
|
case $param in
|
||||||
@ -60,6 +62,10 @@ for param in $4 $5 $6; do
|
|||||||
DEBUG=true ;;
|
DEBUG=true ;;
|
||||||
noisy )
|
noisy )
|
||||||
NOISY=true ;;
|
NOISY=true ;;
|
||||||
|
draft )
|
||||||
|
MAKEDRAFT=true ;;
|
||||||
|
prerelease )
|
||||||
|
MAKEPRE=true ;;
|
||||||
* )
|
* )
|
||||||
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
esac
|
esac
|
||||||
@ -134,9 +140,9 @@ if [[ -z "$ID" ]]; then
|
|||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"body": "'"1st Release of rpm built from git - `date` "'",
|
"body": "'"1st Release of rpm built from git - `date` "'",
|
||||||
"draft": true,
|
"draft": "'"$MAKEDRAFT"'",
|
||||||
"name": "'"$1"'",
|
"name": "'"$1"'",
|
||||||
"prerelease": true,
|
"prerelease": "'"$MAKEPRE"'",
|
||||||
"tag_name": "'SME"$3"'",
|
"tag_name": "'SME"$3"'",
|
||||||
"target_commitish": ""
|
"target_commitish": ""
|
||||||
}')
|
}')
|
||||||
|
Loading…
Reference in New Issue
Block a user