[DO-273] shared libs update (#12)
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-shared-lib/pulls/12 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
5642ea8b96
commit
bc24016ef4
@@ -8,9 +8,9 @@ class Nexus implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@param script Script - context pointer on step in Pipelines
|
@param script Script - context pointer on step in Pipelines
|
||||||
@param host String - Nexus host name
|
@param host String - Nexus host name
|
||||||
@param credentials String - User's name and pass in Nexus
|
@param credentials String - User's name and pass in Nexus
|
||||||
*/
|
*/
|
||||||
Nexus(Script script, String host, String credentials) {
|
Nexus(Script script, String host, String credentials) {
|
||||||
this.script = script
|
this.script = script
|
||||||
@@ -28,7 +28,7 @@ class Nexus implements Serializable {
|
|||||||
@param repository String - Name of Nexus repository
|
@param repository String - Name of Nexus repository
|
||||||
@param path String - Path in Nexus repository
|
@param path String - Path in Nexus repository
|
||||||
@param artifactName String - Name of artifact in Nexus (optional). Common calculate from artifactPath
|
@param artifactName String - Name of artifact in Nexus (optional). Common calculate from artifactPath
|
||||||
@param type String - type of repository
|
@param type String - type of repository
|
||||||
@return String - artifact url in Nexus
|
@return String - artifact url in Nexus
|
||||||
*/
|
*/
|
||||||
public String upload(Map args = [:], String type = "raw") {
|
public String upload(Map args = [:], String type = "raw") {
|
||||||
@@ -48,9 +48,9 @@ class Nexus implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Method get artifacts' urls from nexus repository
|
* Method get artifacts' urls from nexus repository
|
||||||
@param repository String - Repository name in Nexus.
|
@param repository String - Repository name in Nexus.
|
||||||
@param type String - type of repository
|
@param type String - type of repository
|
||||||
@return List - list of artifacts' urls
|
@return List - list of artifacts' urls
|
||||||
*/
|
*/
|
||||||
public List search(String repository, String type = "raw") {
|
public List search(String repository, String type = "raw") {
|
||||||
String newUrl = ""
|
String newUrl = ""
|
||||||
@@ -96,7 +96,31 @@ class Nexus implements Serializable {
|
|||||||
return urls
|
return urls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Download artifact from Nexus repo
|
||||||
|
*
|
||||||
|
@param url String - URL, откуда будет скачан файл
|
||||||
|
@param outputFile String - Путь с именем файла, по которому будет сохранен(optional).
|
||||||
|
* По умолчанию с именем сохраняется в текущей директории с именем файла
|
||||||
|
@return Srting - Возвращает имя загруженного файла
|
||||||
|
*/
|
||||||
|
String download(String url, String outputFile = '') {
|
||||||
|
String artifactName = url.split('/').last()
|
||||||
|
String artifact = outputFile ?: "${this.script.pwd()}/${artifactName}"
|
||||||
|
|
||||||
|
this.script.httpRequest(
|
||||||
|
url: url,
|
||||||
|
authentication: this.credentials,
|
||||||
|
httpMode: "GET",
|
||||||
|
quiet: true,
|
||||||
|
outputFile: artifact
|
||||||
|
)
|
||||||
|
|
||||||
|
return artifact
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Method get artifact's info from nexus
|
* Method get artifact's info from nexus
|
||||||
@param repository String - Repository name in Nexus.
|
@param repository String - Repository name in Nexus.
|
||||||
@param name String - Artifact path in Nexus.
|
@param name String - Artifact path in Nexus.
|
||||||
|
|||||||
Reference in New Issue
Block a user