test déclaration des paramètres de manière globale
Cadoles/Jenkins/pipeline/head There was a failure building this commit Details

This commit is contained in:
vfebvre 2022-06-07 10:43:42 +02:00
parent c0bc85f860
commit 5112fc5d88
1 changed files with 9 additions and 2 deletions

View File

@ -3,13 +3,20 @@ import groovy.json.JsonOutput
def call() { def call() {
pipeline { pipeline {
parameters {
string(
name: 'pulpHost',
description: 'Nom de domaine pour le serveur Pulp',
defaultValue: ''
}
def getResourceHREF( def getResourceHREF(
String credentials, String credentials,
String resourceEndpoint, String resourceEndpoint,
String resourceName, String resourceName,
String pulpHost // String pulpHost
) { ) {
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://${params.pulpHost}/pulp/api/v3/${resourceEndpoint}", httpMode: 'GET', ignoreSslErrors: true, validResponseCodes: "200"
def jsonResponse = readJSON text: response.content def jsonResponse = readJSON text: response.content
def resource = jsonResponse.results.find { it -> it.name == resourceName} def resource = jsonResponse.results.find { it -> it.name == resourceName}
if (resource) { if (resource) {