Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
4089151791 | |||
211579f9d7 |
@@ -132,6 +132,19 @@ subrepo_new(){
|
|||||||
commit_jenkins_files "${PACKAGE}"
|
commit_jenkins_files "${PACKAGE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_team(){
|
||||||
|
local repo="$1" team=
|
||||||
|
case $repo in
|
||||||
|
*testing*|*staging*)
|
||||||
|
set_arch_repos false false false
|
||||||
|
team=$(find_repo "$srcpath")
|
||||||
|
team=${team%-*}
|
||||||
|
;;
|
||||||
|
*) team=${repo%-*} ;;
|
||||||
|
esac
|
||||||
|
echo $team
|
||||||
|
}
|
||||||
|
|
||||||
from_arch(){
|
from_arch(){
|
||||||
cd ${TREE_DIR_ARTIX}
|
cd ${TREE_DIR_ARTIX}
|
||||||
|
|
||||||
@@ -159,7 +172,7 @@ from_arch(){
|
|||||||
msg2 "Artix Version: %s" "$artixver"
|
msg2 "Artix Version: %s" "$artixver"
|
||||||
else
|
else
|
||||||
artixpath=${TREE_DIR_ARTIX}/$group/${PACKAGE}/trunk
|
artixpath=${TREE_DIR_ARTIX}/$group/${PACKAGE}/trunk
|
||||||
subrepo_new "${group}" "${repo%-*}"
|
subrepo_new "${group}" "$(get_team $repo)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "Sync (%s) from Arch [%s] to Artix [%s]" "${PACKAGE}" "${archpath##*archlinux/}" "${artixpath##*artixlinux/}"
|
msg "Sync (%s) from Arch [%s] to Artix [%s]" "${PACKAGE}" "${archpath##*archlinux/}" "${artixpath##*artixlinux/}"
|
||||||
|
@@ -27,16 +27,6 @@ create_repo() {
|
|||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_repo() {
|
|
||||||
local pkg="$1" org="$2"
|
|
||||||
local gitname=$(get_compliant_name "$pkg")
|
|
||||||
|
|
||||||
msg2 "Delete package repo [%s] in org (%s)" "${pkg}" "${org}"
|
|
||||||
|
|
||||||
curl -s -X DELETE "${GIT_URL}/api/v1/repos/$org/$gitname?access_token=${GIT_TOKEN}" \
|
|
||||||
-H "accept: application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
get_team_id() {
|
get_team_id() {
|
||||||
local org="$1" team="$2"
|
local org="$1" team="$2"
|
||||||
local id=$(curl -s -X GET "${GIT_URL}/api/v1/orgs/$org/teams/search?q=$team&access_token=${GIT_TOKEN}" \
|
local id=$(curl -s -X GET "${GIT_URL}/api/v1/orgs/$org/teams/search?q=$team&access_token=${GIT_TOKEN}" \
|
||||||
@@ -44,13 +34,6 @@ get_team_id() {
|
|||||||
echo $id
|
echo $id
|
||||||
}
|
}
|
||||||
|
|
||||||
list_team_repos() {
|
|
||||||
local id="$1"
|
|
||||||
local result=$(curl -X GET "${GIT_URL}/api/v1/teams/$id/repos?access_token=${GIT_TOKEN}" \
|
|
||||||
-H "accept: application/json" | jq '.[]' | jq -r '.name')
|
|
||||||
echo ${result[@]}
|
|
||||||
}
|
|
||||||
|
|
||||||
add_repo_to_team() {
|
add_repo_to_team() {
|
||||||
local pkg="$1" org="$2" team="$3"
|
local pkg="$1" org="$2" team="$3"
|
||||||
local id=$(get_team_id "$org" "$team")
|
local id=$(get_team_id "$org" "$team")
|
||||||
@@ -72,40 +55,3 @@ remove_repo_from_team() {
|
|||||||
curl -s -X DELETE "${GIT_URL}/api/v1/teams/$id/repos/$org/$gitname?access_token=${GIT_TOKEN}" \
|
curl -s -X DELETE "${GIT_URL}/api/v1/teams/$id/repos/$org/$gitname?access_token=${GIT_TOKEN}" \
|
||||||
-H "accept: application/json"
|
-H "accept: application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_user_to_team() {
|
|
||||||
local org="$1" team="$2" user="$3"
|
|
||||||
local id=$(get_team_id "$org" "$team")
|
|
||||||
|
|
||||||
msg2 "Adding [%s] to team (%s) in org (%s)" "$user" "$team" "$org"
|
|
||||||
|
|
||||||
curl -X PUT "${GIT_URL}/api/v1/teams/$id/members/$user?access_token=${GIT_TOKEN}" \
|
|
||||||
-H "accept: application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_user_from_team() {
|
|
||||||
local org="$1" team="$2" user="$3"
|
|
||||||
local id=$(get_team_id "$org" "$team")
|
|
||||||
|
|
||||||
msg2 "Removing [%s] from team (%s) in org (%s)" "$user" "$team" "$org"
|
|
||||||
|
|
||||||
curl -X DELETE "${GIT_URL}/api/v1/teams/$id/members/$user?access_token=${GIT_TOKEN}" \
|
|
||||||
-H "accept: application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
create_team() {
|
|
||||||
local org="$1" name="$2"
|
|
||||||
local json="{ \"can_create_org_repo\": true, \"description\": \"\", \"includes_all_repositories\": false, \"name\": \"$name\", \"permission\": \"write\", \"units\": [ \"repo.code\", \"repo.issues\", \"repo.ext_issues\", \"repo.wiki\", \"repo.pulls\", \"repo.releases\", \"repo.ext_wiki\" ]}"
|
|
||||||
|
|
||||||
curl -X POST "${GIT_URL}/api/v1/orgs/$org/teams?access_token=${GIT_TOKEN}" \
|
|
||||||
-H "accept: application/json" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$json"
|
|
||||||
}
|
|
||||||
|
|
||||||
delete_team() {
|
|
||||||
local org="$1" team="$2"
|
|
||||||
local id=$(get_team_id "$org" "$team")
|
|
||||||
curl -X DELETE "${GIT_URL}/api/v1/teams/$id?access_token=${GIT_TOKEN}" \
|
|
||||||
-H "accept: application/json"
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user