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: """
|
script: """
|
||||||
HTTP_CODE=\$(curl -s -X 'GET' \
|
HTTP_CODE=\$(curl -s -X 'GET' \
|
||||||
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branches' \
|
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branches' \
|
||||||
-H 'Authorization: '"\$GITEA_TOKEN" \
|
-H 'Authorization: token '"\$GITEA_TOKEN" \
|
||||||
-w '%{http_code}' \
|
-w '%{http_code}' \
|
||||||
-o output.json)
|
-o output.json)
|
||||||
test \$HTTP_CODE -eq 200
|
test \$HTTP_CODE -eq 200
|
||||||
@ -375,13 +375,17 @@ def protectBranch(String repo, String branch) {
|
|||||||
return sh (
|
return sh (
|
||||||
label: "${repo}: protect ${branch}",
|
label: "${repo}: protect ${branch}",
|
||||||
script: """
|
script: """
|
||||||
echo '{
|
HTTP_CODE=\$(echo '{
|
||||||
"branch_name": "${branch}"
|
"branch_name": "${branch}"
|
||||||
}' | \
|
}' | \
|
||||||
curl -s -X 'POST' \
|
curl -s -X 'POST' \
|
||||||
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections' \
|
'https://'"\$GIT_SERVER"'/api/v1/repos/${repo}/branch_protections' \
|
||||||
-H 'Authorization: token '"\$GITEA_TOKEN" \
|
-H 'Authorization: token '"\$GITEA_TOKEN" \
|
||||||
-d @-
|
-w '%{http_code}' \
|
||||||
|
-o output.json \
|
||||||
|
-d @-)
|
||||||
|
test \$HTTP_CODE -eq 201
|
||||||
|
jq '.' output.json
|
||||||
""",
|
""",
|
||||||
returnStatus: true
|
returnStatus: true
|
||||||
) == 0
|
) == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user