This commit is contained in:
Semyon Bezrukov 2024-09-11 17:35:30 +03:00
parent f08e80f131
commit 7247dbe4a4

6
Jenkinsfile vendored
View File

@ -358,7 +358,7 @@ def printBranches(String repo) {
return sh ( return sh (
label: "${repo}: branches list", label: "${repo}: branches list",
script: """ script: """
curl -sv -f -X 'GET' \ curl -sv -X 'GET' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branches' \ 'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branches' \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H 'Authorization: '"\$GITEA_TOKEN" | \ -H 'Authorization: '"\$GITEA_TOKEN" | \
@ -375,7 +375,7 @@ def protectBranch(String repo, String branch) {
echo '{ echo '{
"branch_name": "master" "branch_name": "master"
}' | \ }' | \
curl -sv -f -X 'POST' \ curl -sv -X 'POST' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections' \ 'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections' \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H 'Authorization: '"\$GITEA_TOKEN" \ -H 'Authorization: '"\$GITEA_TOKEN" \
@ -390,7 +390,7 @@ def unprotectBranch(String repo, String branch) {
return sh ( return sh (
label: "${repo}: unprotect ${branch}", label: "${repo}: unprotect ${branch}",
script: """ script: """
curl -sv -f -X 'DELETE' \ curl -sv -X 'DELETE' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections/${branch}' \ 'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections/${branch}' \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H 'Authorization: '"\$GITEA_TOKEN" -H 'Authorization: '"\$GITEA_TOKEN"