DO-143 code freeze (#11)
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-shared-lib/pulls/11 Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
committed by
Aleksandr Vodyanov
parent
2c65da730e
commit
5642ea8b96
@@ -43,4 +43,38 @@ class Gitea implements Serializable {
|
||||
|
||||
return result[res.status.toString()]
|
||||
}
|
||||
|
||||
/**
|
||||
* create new tag
|
||||
* @param targetBranch String - target branch
|
||||
* @param tagName String - tag name
|
||||
* @param message String - message for tag
|
||||
* @return Boolean - True success create False - already exists
|
||||
*/
|
||||
public Boolean createTag(String targetBranch, String tagName, String message = '') {
|
||||
Map body = [
|
||||
message: message,
|
||||
tag_name: tagName,
|
||||
target: targetBranch
|
||||
]
|
||||
|
||||
Object bodyRequest = JsonOutput.toJson(body)
|
||||
|
||||
Object res = script.httpRequest(
|
||||
url: "${projectURL}/tags",
|
||||
ignoreSslErrors: true,
|
||||
httpMode: 'POST',
|
||||
validResponseCodes: '201,409',
|
||||
authentication: creds,
|
||||
contentType: 'APPLICATION_JSON',
|
||||
requestBody: bodyRequest
|
||||
)
|
||||
/* groovylint-disable-next-line DuplicateMapLiteral */
|
||||
Map result = [
|
||||
'409': false,
|
||||
'201': true
|
||||
]
|
||||
|
||||
return result[res.status.toString()]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user