BM4
This commit is contained in:
parent
22d656691c
commit
5927174278
10
Jenkinsfile
vendored
10
Jenkinsfile
vendored
@ -361,7 +361,7 @@ def printBranches(String repo) {
|
||||
script: """
|
||||
HTTP_CODE=\$(curl -s -X 'GET' \
|
||||
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branches' \
|
||||
-H 'Authorization: '"\$GITEA_TOKEN" \
|
||||
-H 'Authorization: token '"\$GITEA_TOKEN" \
|
||||
-w '%{http_code}' \
|
||||
-o output.json)
|
||||
test \$HTTP_CODE -eq 200
|
||||
@ -375,13 +375,17 @@ def protectBranch(String repo, String branch) {
|
||||
return sh (
|
||||
label: "${repo}: protect ${branch}",
|
||||
script: """
|
||||
echo '{
|
||||
HTTP_CODE=\$(echo '{
|
||||
"branch_name": "${branch}"
|
||||
}' | \
|
||||
curl -s -X 'POST' \
|
||||
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections' \
|
||||
-H 'Authorization: token '"\$GITEA_TOKEN" \
|
||||
-d @-
|
||||
-w '%{http_code}' \
|
||||
-o output.json \
|
||||
-d @-)
|
||||
test \$HTTP_CODE -eq 201
|
||||
jq '.' output.json
|
||||
""",
|
||||
returnStatus: true
|
||||
) == 0
|
||||
|
Loading…
Reference in New Issue
Block a user