Distribution inconditionnelle
Cadoles/Jenkins/pipeline/head There was a failure building this commit
Details
Cadoles/Jenkins/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
331ba5fd6b
commit
4dfdb53bad
|
@ -103,8 +103,12 @@ pipeline {
|
||||||
)
|
)
|
||||||
|
|
||||||
// On publie chacun des paquets construits
|
// On publie chacun des paquets construits
|
||||||
|
def repositoriesMapping = ['unstable': 'Cadoles4MSE unstable',
|
||||||
|
'dev': 'Cadoles4MSE dev',
|
||||||
|
'staging': 'Cadoles4MSE staging',
|
||||||
|
'stable': 'Cadoles4MSE stable']
|
||||||
def credentials = '212d6dc7-f9a2-4d27-94d8-de7fc6cae0a1'
|
def credentials = '212d6dc7-f9a2-4d27-94d8-de7fc6cae0a1'
|
||||||
def repositoryHREF = pulp.getRepositoryHREF(credentials, result.env)
|
def repositoryHREF = pulp.getRepositoryHREF(credentials, repositoriesMapping[result.env])
|
||||||
def exportTasks = pulp.exportPackages(credentials, result.packages)
|
def exportTasks = pulp.exportPackages(credentials, result.packages)
|
||||||
def pulpPackages = []
|
def pulpPackages = []
|
||||||
exportTasks.each {
|
exportTasks.each {
|
||||||
|
@ -114,16 +118,16 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pulp.addToRepository(credentials, pulpPackages, repositoryHREF)
|
pulp.addToRepository(credentials, pulpPackages, repositoryHREF)
|
||||||
if (result.env == 'dev') {
|
def publicationHREF = pulp.publishRepository(credentials, repositoryHREF)
|
||||||
def publicationHREF = pulp.publishRepository(credentials, repositoryHREF)
|
def distributionName = repositoriesMapping[result.env]
|
||||||
def distributionHREF = pulp.distributePublication(credentials, publicationHREF[0], 'Cadoles4MSE_dev', 'Cadoles4MSE_dev')
|
def base_path = distributionName.replaceAll(' ', '_')
|
||||||
println(pulp.getDistributionURL(credentials, distributionHREF[0]))
|
def distributionHREF = pulp.distributePublication(credentials, publicationHREF[0], distributionName, base_path)
|
||||||
}
|
def distributionURL = pulp.getDistributionURL(credentials, distributionHREF[0]))
|
||||||
|
|
||||||
// On liste l'ensemble des paquets construits
|
// On liste l'ensemble des paquets construits
|
||||||
def publishedPackages = result.packages.collect { p ->
|
def publishedPackages = result.packages.collect { p ->
|
||||||
def file = new File(p)
|
def file = new File(p)
|
||||||
return "- Paquet `${file.getName()}`, Dépôt `${result.env}`, Distribution `${result.distrib}`"
|
return "- Paquet `${file.getName()}`, Dépôt `${result.env}`, Distribution `${result.distrib}`, URL `${distributionURL}`"
|
||||||
}
|
}
|
||||||
|
|
||||||
// On notifie le canal Rocket.Chat de la publication des paquets
|
// On notifie le canal Rocket.Chat de la publication des paquets
|
||||||
|
|
|
@ -28,21 +28,17 @@ def createRepository(
|
||||||
}
|
}
|
||||||
def getRepositoryHREF(
|
def getRepositoryHREF(
|
||||||
String credentials,
|
String credentials,
|
||||||
String repositoryLevel = 'dev',
|
String repository = 'Cadoles4MSE unstable',
|
||||||
String pulpHost = '192.168.30.3'
|
String pulpHost = '192.168.30.3'
|
||||||
) {
|
) {
|
||||||
def repositoriesMapping = ['unstable': 'Cadoles4MSE unstable',
|
|
||||||
'dev': 'Cadoles4MSE dev',
|
|
||||||
'staging': 'Cadoles4MSE staging',
|
|
||||||
'stable': 'Cadoles4MSE stable']
|
|
||||||
def response = httpRequest authentication: credentials, url: "https://${pulpHost}/pulp/api/v3/repositories/deb/apt/", httpMode: 'GET', ignoreSslErrors: true
|
def response = httpRequest authentication: credentials, url: "https://${pulpHost}/pulp/api/v3/repositories/deb/apt/", httpMode: 'GET', ignoreSslErrors: true
|
||||||
def jsonResponse = readJSON text: response.content
|
def jsonResponse = readJSON text: response.content
|
||||||
def repositories = jsonResponse.results
|
def repositories = jsonResponse.results
|
||||||
def repositoryHREF = repositories.find { it -> it['name'] == repositoriesMapping[repositoryLevel] }
|
def repositoryHREF = repositories.find { it -> it['name'] == repository }
|
||||||
if (repositoryHREF) {
|
if (repositoryHREF) {
|
||||||
return repositoryHREF.pulp_href
|
return repositoryHREF.pulp_href
|
||||||
} else {
|
} else {
|
||||||
return createRepository(credentials, repositoriesMapping[repositoryLevel])
|
return createRepository(credentials, repository])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue