This commit is contained in:
Semyon Bezrukov 2024-09-11 16:51:37 +03:00
parent 4a3633f9d8
commit 0749080cb5

8
Jenkinsfile vendored
View File

@ -358,7 +358,8 @@ def printBranches(String repo) {
return sh (
label: "${repo}: branches list",
script: """
curl -X 'GET' \
set -o pipefail
curl -sv -X 'GET' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branches' \
-H 'accept: application/json' \
-H 'Authorization: \$GITEA_TOKEN' | \
@ -372,10 +373,11 @@ def protectBranch(String repo, String branch) {
return sh (
label: "${repo}: protect ${branch}",
script: """
set -o pipefail
echo '{
"branch_name": "master"
}' | \
curl -X 'POST' \
curl -sv -X 'POST' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections?token=\$GITEA_TOKEN' \
-H 'accept: application/json' \
-H 'Authorization: \$GITEA_TOKEN' \
@ -390,7 +392,7 @@ def unprotectBranch(String repo, String branch) {
return sh (
label: "${repo}: unprotect ${branch}",
script: """
curl -X 'DELETE' \
curl -sv -X 'DELETE' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections/${branch}?token=\$GITEA_TOKEN' \
-H 'accept: application/json' \
-H 'Authorization: \$GITEA_TOKEN'