This commit is contained in:
Semyon Bezrukov 2024-09-11 17:08:10 +03:00
parent e84c4788fc
commit c8692d6186

10
Jenkinsfile vendored
View File

@ -361,7 +361,7 @@ def printBranches(String repo) {
curl -sv -X 'GET' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branches' \
-H 'accept: application/json' \
-H 'Authorization: \$GITEA_TOKEN' | \
-H 'Authorization: '"\$GITEA_TOKEN" | \
jq -r '.[] | [.name, .protected] | @tsv'
""",
returnStatus: true
@ -376,9 +376,9 @@ def protectBranch(String repo, String branch) {
"branch_name": "master"
}' | \
curl -sv -X 'POST' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections?token=\$GITEA_TOKEN' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections' \
-H 'accept: application/json' \
-H 'Authorization: \$GITEA_TOKEN' \
-H 'Authorization: '"\$GITEA_TOKEN" \
-H 'Content-Type: application/json' \
-d -
""",
@ -391,9 +391,9 @@ def unprotectBranch(String repo, String branch) {
label: "${repo}: unprotect ${branch}",
script: """
curl -sv -X 'DELETE' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections/${branch}?token=\$GITEA_TOKEN' \
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections/${branch}' \
-H 'accept: application/json' \
-H 'Authorization: \$GITEA_TOKEN'
-H 'Authorization: '"\$GITEA_TOKEN"
""",
returnStatus: true
) == 0