#!groovy library identifier: '3scale-toolbox-jenkins@master', retriever: modernSCM([$class: 'GitSCMSource', remote: 'https://github.com/nmasse-itix/3scale-toolbox-jenkins.git']) def service = null node() { stage('Checkout Source') { checkout scm } stage("Prepare") { service = toolbox.prepareThreescaleService( openapi: [filename: "testcase-01/swagger.json"], environment: [baseSystemName: toolbox.generateRandomBaseSystemName()], toolbox: [openshiftProject: params.NAMESPACE, destination: params.TARGET_INSTANCE, secretName: params.SECRET_NAME], service: [:] ) echo "toolbox version = " + service.toolbox.getToolboxVersion() } stage("Import OpenAPI") { service.importOpenAPI() echo "Service with system_name ${service.environment.targetSystemName} created !" } /* stage("Create an Application Plan") { openshift.withCluster() { openshift.withProject(params.NAMESPACE) { toolbox.applyApplicationPlan(openshift: openshift, destination: params.TARGET_INSTANCE, serviceSystemName: targetSystemName, planSystemName: "test_plan", planDisplayName: "Test Plan", toolboxConfig: toolboxConfig) } } } stage("Create an Application") { openshift.withCluster() { openshift.withProject(params.NAMESPACE) { testApplicationCredentials = toolbox.getDefaultApplicationCredentials(serviceSystemName: targetSystemName, applicationName: testApplicationName, toolboxConfig: toolboxConfig) toolbox.applyApplication(openshift: openshift, destination: params.TARGET_INSTANCE, serviceSystemName: targetSystemName, planSystemName: "test_plan", applicationName: testApplicationName, applicationDescription: "Test", applicationCredentials: testApplicationCredentials toolboxConfig: toolboxConfig) } } } stage("Run integration tests") { openshift.withCluster() { openshift.withProject(params.NAMESPACE) { // To run the integration tests when using APIcast SaaS instances, we need // to fetch the proxy definition to extract the staging public url def proxy = toolbox.readProxy(openshift: openshift, destination: params.TARGET_INSTANCE, serviceSystemName: targetSystemName, environment: "sandbox", toolboxConfig: toolboxConfig) sh '''set -xe curl ${proxy.sandbox_endpoint}/beers # TODO ''' } } } stage("Promote to production") { openshift.withCluster() { openshift.withProject(params.NAMESPACE) { toolbox.promoteToProduction(openshift: openshift, destination: params.TARGET_INSTANCE, serviceSystemName: targetSystemName, toolboxConfig: toolboxConfig) } } } */ }