#!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: [:], applicationPlans: [ [ systemName: "test", name: "Test", defaultPlan: true, published: true ], [ systemName: "silver", name: "Silver" ], [ systemName: "gold", name: "Gold" ], ] ) 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") { service.applyApplicationPlans() } stage("Create an Application") { def testApplication = [ name: "my-test-app", description: "This is used for tests" ] def testApplicationCredentials = toolbox.getDefaultApplicationCredentials(service, testApplication.name) service.applyApplication(testApplication + testApplicationCredentials) } stage("Run integration tests") { // 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 = service.readProxy() sh '''set -xe curl ${proxy.sandbox_endpoint}/beers # TODO ''' } stage("Promote to production") { service.promoteToProduction() } }