ajout groovy pour pulp.cadoles.com
Cadoles/Jenkins/pipeline/head There was a failure building this commit Details

This commit is contained in:
vfebvre 2022-06-01 16:29:02 +02:00
parent 71f5fbfe78
commit 0314146633
1 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ def getResourceHREF(
String credentials, String credentials,
String resourceEndpoint, String resourceEndpoint,
String resourceName, String resourceName,
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def response = httpRequest authentication: credentials, url: "https://${pulpHost}/pulp/api/v3/${resourceEndpoint}", httpMode: 'GET', ignoreSslErrors: true, validResponseCodes: "200" def response = httpRequest authentication: credentials, url: "https://${pulpHost}/pulp/api/v3/${resourceEndpoint}", httpMode: 'GET', ignoreSslErrors: true, validResponseCodes: "200"
def jsonResponse = readJSON text: response.content def jsonResponse = readJSON text: response.content
@ -18,7 +18,7 @@ def getResourceHREF(
def waitForTaskCompletion( def waitForTaskCompletion(
String credentials, String credentials,
String taskHREF, String taskHREF,
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def status = '' def status = ''
def created_resources = [] def created_resources = []
@ -39,10 +39,10 @@ def waitForTaskCompletion(
def exportPackages( def exportPackages(
String credentials, String credentials,
List packages = [], List packages = [],
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def exportTasks = [] def exportTasks = []
packages.each { packages.each {
def response = httpRequest authentication: credentials, url: "https://${pulpHost}/pulp/api/v3/content/deb/packages/", httpMode: 'POST', ignoreSslErrors: true, multipartName: "file", timeout: 900, uploadFile: "${it}", validResponseCodes: "202" def response = httpRequest authentication: credentials, url: "https://${pulpHost}/pulp/api/v3/content/deb/packages/", httpMode: 'POST', ignoreSslErrors: true, multipartName: "file", timeout: 900, uploadFile: "${it}", validResponseCodes: "202"
def jsonResponse = readJSON text: response.content def jsonResponse = readJSON text: response.content
exportTasks << jsonResponse['task'] exportTasks << jsonResponse['task']
@ -53,7 +53,7 @@ def exportPackages(
def createRepository( def createRepository(
String credentials, String credentials,
String name, String name,
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def repositoryName = ["name": name] def repositoryName = ["name": name]
def postBody = JsonOutput.toJson(repositoryName) def postBody = JsonOutput.toJson(repositoryName)
@ -78,7 +78,7 @@ def addToRepository(
String credentials, String credentials,
List packagesHREF, List packagesHREF,
String repositoryHREF, String repositoryHREF,
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def packagesHREFURL = ["add_content_units": packagesHREF.collect { "https://$pulpHost$it" }] def packagesHREFURL = ["add_content_units": packagesHREF.collect { "https://$pulpHost$it" }]
def postBody = JsonOutput.toJson(packagesHREFURL) def postBody = JsonOutput.toJson(packagesHREFURL)
@ -91,7 +91,7 @@ def publishRepository(
String credentials, String credentials,
String repositoryHREF, String repositoryHREF,
String signing_service = null, String signing_service = null,
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def postContent = ["repository": repositoryHREF, "simple": true] def postContent = ["repository": repositoryHREF, "simple": true]
if (signing_service) { if (signing_service) {
@ -112,7 +112,7 @@ def distributePublication(
String distributionName, String distributionName,
String basePath, String basePath,
String contentGuard = null, String contentGuard = null,
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def httpMode = '' def httpMode = ''
def url = '' def url = ''
@ -145,7 +145,7 @@ def distributePublication(
def getDistributionURL( def getDistributionURL(
String credentials, String credentials,
String resourceHREF, String resourceHREF,
String pulpHost = '192.168.30.3' String pulpHost = 'pulp.cadoles.com'
) { ) {
def response = httpRequest authentication: credentials, url: "https://${pulpHost}${resourceHREF}", httpMode: 'GET', ignoreSslErrors: true, validResponseCodes: "200" def response = httpRequest authentication: credentials, url: "https://${pulpHost}${resourceHREF}", httpMode: 'GET', ignoreSslErrors: true, validResponseCodes: "200"
def jsonResponse = readJSON text: response.content def jsonResponse = readJSON text: response.content