retour en arrière
Cadoles/Jenkins/pipeline/head This commit looks good
Details
Cadoles/Jenkins/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a31b64b5b6
commit
63af3c7121
|
@ -1,23 +1,12 @@
|
||||||
import groovy.json.JsonOutput
|
import groovy.json.JsonOutput
|
||||||
|
|
||||||
def call() {
|
|
||||||
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 = 'pulp.cadoles.com'
|
||||||
) {
|
) {
|
||||||
def response = httpRequest authentication: credentials, url: "https://${params.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
|
||||||
def resource = jsonResponse.results.find { it -> it.name == resourceName}
|
def resource = jsonResponse.results.find { it -> it.name == resourceName}
|
||||||
if (resource) {
|
if (resource) {
|
||||||
|
@ -29,7 +18,7 @@ def call() {
|
||||||
def waitForTaskCompletion(
|
def waitForTaskCompletion(
|
||||||
String credentials,
|
String credentials,
|
||||||
String taskHREF,
|
String taskHREF,
|
||||||
String pulpHost
|
String pulpHost = 'pulp.cadoles.com'
|
||||||
) {
|
) {
|
||||||
def status = ''
|
def status = ''
|
||||||
def created_resources = []
|
def created_resources = []
|
||||||
|
@ -50,7 +39,7 @@ def call() {
|
||||||
def exportPackages(
|
def exportPackages(
|
||||||
String credentials,
|
String credentials,
|
||||||
List packages = [],
|
List packages = [],
|
||||||
String pulpHost
|
String pulpHost = 'pulp.cadoles.com'
|
||||||
) {
|
) {
|
||||||
def exportTasks = []
|
def exportTasks = []
|
||||||
packages.each {
|
packages.each {
|
||||||
|
@ -64,7 +53,7 @@ def call() {
|
||||||
def createRepository(
|
def createRepository(
|
||||||
String credentials,
|
String credentials,
|
||||||
String name,
|
String name,
|
||||||
String pulpHost
|
String pulpHost = 'pulp.cadoles.com'
|
||||||
) {
|
) {
|
||||||
def repositoryName = ["name": name]
|
def repositoryName = ["name": name]
|
||||||
def postBody = JsonOutput.toJson(repositoryName)
|
def postBody = JsonOutput.toJson(repositoryName)
|
||||||
|
@ -89,7 +78,7 @@ def call() {
|
||||||
String credentials,
|
String credentials,
|
||||||
List packagesHREF,
|
List packagesHREF,
|
||||||
String repositoryHREF,
|
String repositoryHREF,
|
||||||
String pulpHost
|
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)
|
||||||
|
@ -102,7 +91,7 @@ def call() {
|
||||||
String credentials,
|
String credentials,
|
||||||
String repositoryHREF,
|
String repositoryHREF,
|
||||||
String signing_service = null,
|
String signing_service = null,
|
||||||
String pulpHost
|
String pulpHost = 'pulp.cadoles.com'
|
||||||
) {
|
) {
|
||||||
def postContent = ["repository": repositoryHREF, "simple": true]
|
def postContent = ["repository": repositoryHREF, "simple": true]
|
||||||
if (signing_service) {
|
if (signing_service) {
|
||||||
|
@ -123,7 +112,7 @@ def call() {
|
||||||
String distributionName,
|
String distributionName,
|
||||||
String basePath,
|
String basePath,
|
||||||
String contentGuard = null,
|
String contentGuard = null,
|
||||||
String pulpHost
|
String pulpHost = 'pulp.cadoles.com'
|
||||||
) {
|
) {
|
||||||
def httpMode = ''
|
def httpMode = ''
|
||||||
def url = ''
|
def url = ''
|
||||||
|
@ -156,12 +145,10 @@ def call() {
|
||||||
def getDistributionURL(
|
def getDistributionURL(
|
||||||
String credentials,
|
String credentials,
|
||||||
String resourceHREF,
|
String resourceHREF,
|
||||||
String pulpHost
|
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
|
||||||
println(jsonResponse)
|
println(jsonResponse)
|
||||||
return jsonResponse.base_url
|
return jsonResponse.base_url
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue