BM8
This commit is contained in:
parent
e84c4788fc
commit
c8692d6186
10
Jenkinsfile
vendored
10
Jenkinsfile
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user