Distribution inconditionnelle
Some checks failed
Cadoles/Jenkins/pipeline/head There was a failure building this commit
Some checks failed
Cadoles/Jenkins/pipeline/head There was a failure building this commit
This commit is contained in:
parent
331ba5fd6b
commit
4dfdb53bad
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@ -103,8 +103,12 @@ pipeline {
|
||||
)
|
||||
|
||||
// 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 repositoryHREF = pulp.getRepositoryHREF(credentials, result.env)
|
||||
def repositoryHREF = pulp.getRepositoryHREF(credentials, repositoriesMapping[result.env])
|
||||
def exportTasks = pulp.exportPackages(credentials, result.packages)
|
||||
def pulpPackages = []
|
||||
exportTasks.each {
|
||||
@ -114,16 +118,16 @@ pipeline {
|
||||
}
|
||||
}
|
||||
pulp.addToRepository(credentials, pulpPackages, repositoryHREF)
|
||||
if (result.env == 'dev') {
|
||||
def publicationHREF = pulp.publishRepository(credentials, repositoryHREF)
|
||||
def distributionHREF = pulp.distributePublication(credentials, publicationHREF[0], 'Cadoles4MSE_dev', 'Cadoles4MSE_dev')
|
||||
println(pulp.getDistributionURL(credentials, distributionHREF[0]))
|
||||
}
|
||||
def publicationHREF = pulp.publishRepository(credentials, repositoryHREF)
|
||||
def distributionName = repositoriesMapping[result.env]
|
||||
def base_path = distributionName.replaceAll(' ', '_')
|
||||
def distributionHREF = pulp.distributePublication(credentials, publicationHREF[0], distributionName, base_path)
|
||||
def distributionURL = pulp.getDistributionURL(credentials, distributionHREF[0]))
|
||||
|
||||
// On liste l'ensemble des paquets construits
|
||||
def publishedPackages = result.packages.collect { 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
|
||||
|
@ -28,21 +28,17 @@ def createRepository(
|
||||
}
|
||||
def getRepositoryHREF(
|
||||
String credentials,
|
||||
String repositoryLevel = 'dev',
|
||||
String repository = 'Cadoles4MSE unstable',
|
||||
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 jsonResponse = readJSON text: response.content
|
||||
def repositories = jsonResponse.results
|
||||
def repositoryHREF = repositories.find { it -> it['name'] == repositoriesMapping[repositoryLevel] }
|
||||
def repositoryHREF = repositories.find { it -> it['name'] == repository }
|
||||
if (repositoryHREF) {
|
||||
return repositoryHREF.pulp_href
|
||||
} else {
|
||||
return createRepository(credentials, repositoriesMapping[repositoryLevel])
|
||||
return createRepository(credentials, repository])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user