I'm facing issue when im running jenkins job to deploy api and config to apigee using the apigee-config-maven-plugin. Below are the details of the issue. The buils has been marked as failure but the deployment is happening to apigee. Not sure what is causing this issue. This is being a blocker for me to implement CICD. It would be great if you can help me resolve this issue.
Parsing POMs Modules changed, recalculating dependency graph Established TCP socket on 43665 maven35-agent.jar already up to date maven35-interceptor.jar already up to date maven3-interceptor-commons.jar already up to date [api] $ java -cp /datapower/slave/maven35-agent.jar:/datapower/slave/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5/boot/plexus-classworlds-2.5.2.jar:/datapower/slave/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5/conf/logging jenkins.maven3.agent.Maven35Main /datapower/slave/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5 /datapower/slave.jar /datapower/slave/maven35-interceptor.jar /datapower/slave/maven3-interceptor-commons.jar 43665 <===[JENKINS REMOTING CAPACITY]===>channel started Executing Maven: -B -f /datapower/slave/workspace/Apigee/Apigee_Proxy/api/shared-pom.xml install [INFO] Scanning for projects... [INFO] [INFO] -------------------------< apigee:parent-pom >-------------------------- [INFO] Building parent-pom 1.0 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.3:copy-resources (copy-resources-step) @ parent-pom --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /datapower/slave/workspace/Apigee/Apigee_Proxy/api/apiproxy
[INFO] [INFO] --- apigee-edge-maven-plugin:1.1.7:configure (configure-bundle-step) @ parent-pom --- [INFO] No config.json found. Skipping package configuration. [INFO] =============Checking for node.js app================ [INFO] =============Now zipping the App Bundle================ Started calculate disk usage of build Finished Calculation of disk usage of build in 0 seconds Started calculate disk usage of workspace Finished Calculation of disk usage of workspace in 0 seconds [INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.633 s [INFO] Finished at: 2020-03-31T06:36:39-04:00 [INFO] ------------------------------------------------------------------------ Waiting for Jenkins to finish collecting data [ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.1.7:configure (configure-bundle-step) on project parent-pom: /datapower/slave/workspace/Apigee/Apigee_Proxy/api/target/parent-pom-1.0.zip (No such file or directory) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [JENKINS] Archiving /datapower/slave/workspace/Apigee/Apigee_Proxy/api/shared-pom.xml to apigee/parent-pom/1.0/parent-pom-1.0.pom channel stopped [Apigee_Proxy] $ /bin/sh -xe /tmp/jenkins6846913514503603077.sh + cd api/HelloWorld + mvn install -Ptest -Dusername=------- -Dpassword=------ -Dapigee.config.options=create
[INFO] Scanning for projects... [INFO] [INFO] -------------------------< Apigee:HelloWorld >-------------------------- [INFO] Building HelloWorld 1.0 [INFO] --------------------------------[ pom ]---------------------------------
[INFO] [INFO] --- maven-resources-plugin:2.3:copy-resources (copy-resources-step) @ HelloWorld --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 5 resources [INFO] [INFO] --- apigee-edge-maven-plugin:1.1.7:configure (configure-bundle-step) @ HelloWorld ---
[INFO] ============= Reading the config file located at ================ /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/config.json [INFO] =============Checking for node.js app================ [INFO] =============Now zipping the App Bundle================ [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:specs (create-config-specs) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee Specs [INFO] The APIs used in this goal are preliminary and subject to change without notice!! [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Retrieving existing Specs
[INFO] Acquiring mgmt API token from https://login.apigee.com/oauth/token [INFO] MFA token not provided. Skipping.
[INFO] Request prepared for the server ************************** GET https://apigee.com/organizations/shivamkr-eval/specs/folder/home accept: [application/json] accept-encoding: [gzip] authorization: [Bearer [Not shown in log]
[INFO] API Spec "Petstore-v2" already exists. Skipping. [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:caches (create-config-cache) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee Cache [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Retrieving existing environment caches - test [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/environments/test/caches accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log] [INFO] Cache "echocache" already exists. Skipping. [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:targetservers (create-config-targetserver) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee Target Servers [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Retrieving existing environment Target Servers - test [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/environments/test/targetservers accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log]
[INFO] Target Server "HTTPBin" already exists. Skipping. [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ HelloWorld --- [INFO] Installing /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/pom.xml to /jenkins/m2/repository/Apigee/HelloWorld/1.0/HelloWorld-1.0.pom [INFO] [INFO] --- apigee-edge-maven-plugin:1.1.7:deploy (deploy-bundle) @ HelloWorld --- [INFO] =============Initializing Maven Deployment================ [INFO] =============Importing App================ [INFO] Request prepared for the server ************************** POST https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/apis?action=import&name=HelloWorld accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] content-type: application/octet-stream [Request body contains data, not shown] [INFO] Response returned by the server ************************** 201 Created accept-encoding: gzip content-length: 1221 content-type: application/json date: Tue, 31 Mar 2020 10:36:48 GMT server: [Apigee LB] access-control-allow-origin: [*] access-control-allow-methods: [GET, PUT, POST, DELETE] connection: [keep-alive] access-control-max-age: [3628800] access-control-allow-headers: [origin, x-requested-with, accept] { "configurationVersion": { "majorVersion": 4, "minorVersion": 0 }, "contextInfo": "Revision 18 of application -NA-, in organization -NA-", "createdAt": 1585651008829, "createdBy": "---------", "lastModifiedAt": 1585651008829, "lastModifiedBy": "-----------", "policies": [ "ResponseCache", "VerifyAPIKey" ], "proxyEndpoints": [ "default" ], "resources": [], "revision": "18", "targetEndpoints": [ "default" ], "targetServers": [], "type": "Application" } [INFO] =============Refresh Bundle================ [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/apis/HelloWorld/deployments accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] [INFO] De-activating Version: 17 For Env Profile: test [INFO] Request prepared for the server ************************** DELETE https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/environments/test/apis/HelloWorld/r... accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log]
[INFO] Response returned by the server ************************** 200 OK accept-encoding: gzip content-length: 1678 content-type: application/json date: Tue, 31 Mar 2020 10:36:50 GMT server: [Apigee LB] access-control-allow-origin: [*] access-control-allow-methods: [GET, PUT, POST, DELETE] connection: [keep-alive] access-control-max-age: [3628800] access-control-allow-headers: [origin, x-requested-with, accept] { "aPIProxy": "HelloWorld", "configuration": { "basePath": "/", "steps": [] }, "environment": "test", "name": "17", "organization": "shivamkr-eval", "revision": "17", "state": "undeployed", "server": [ { "status": "undeployed", "type": [ "message-processor" ], "uUID": "f1c36a62-69b1-4972-9d95-30212323f638" }, { "status": "undeployed", "type": [ "message-processor" ], "uUID": "5bde9a57-c9ea-434b-954c-27141831a293" }, { "status": "undeployed", "type": [ "message-processor" ], "uUID": "734f3787-1a57-4e73-9775-c93b573c0b05" }, { "status": "undeployed", "type": [ "message-processor" ], "uUID": "e4c8a797-b037-4a42-b517-81aa2d8db72e" }, { "status": "undeployed", "type": [ "router" ], "uUID": "762017a2-f483-431d-975f-a640222bcb9d" }, { "status": "undeployed", "type": [ "router" ], "uUID": "bc16d2bb-e39b-46e6-a47d-4635b9b47aa3" }, { "status": "undeployed", "type": [ "router" ], "uUID": "e481b46d-2dca-4241-866a-b5320d79d6ec" } ] } [INFO] Activating Version: 18 For Env Profile: test [INFO] Request prepared for the server ************************** POST https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/environments/test/apis/HelloWorld/r... accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] content-type: application/x-www-form-urlencoded; charset=UTF-8 [Request body] override=false
[INFO] Response returned by the server ************************** 200 OK accept-encoding: gzip content-length: 1824 content-type: application/json date: Tue, 31 Mar 2020 10:36:53 GMT server: [Apigee LB] access-control-allow-origin: [*] access-control-allow-methods: [GET, PUT, POST, DELETE] connection: [keep-alive] access-control-max-age: [3628800] access-control-allow-headers: [origin, x-requested-with, accept] { "aPIProxy": "HelloWorld", "configuration": { "basePath": "/", "steps": [] }, "environment": "test", "name": "18", "organization": "shivamkr-eval", "revision": "18", "state": "deployed", "server": [ { "status": "deployed", "type": [ "message-processor" ], "uUID": "f1c36a62-69b1-4972-9d95-30212323f638" }, { "status": "deployed", "type": [ "message-processor" ], "uUID": "5bde9a57-c9ea-434b-954c-27141831a293" }, { "status": "deployed", "type": [ "message-processor" ], "uUID": "734f3787-1a57-4e73-9775-c93b573c0b05" }, { "status": "deployed", "type": [ "message-processor" ], "uUID": "e4c8a797-b037-4a42-b517-81aa2d8db72e" }, { "status": "deployed", "type": [ "router" ], "uUID": "762017a2-f483-431d-975f-a640222bcb9d" }, { "status": "deployed", "type": [ "router" ], "uUID": "bc16d2bb-e39b-46e6-a47d-4635b9b47aa3" }, { "status": "deployed", "type": [ "router" ], "uUID": "e481b46d-2dca-4241-866a-b5320d79d6ec" } ] } [INFO] Deployed revision is: 18 [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:resourcefiles (create-config-resourcefiles) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee Resource File [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] No org scoped resourcefiles config found. [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/environments/test/resourcefiles accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log] [INFO] Env Resource File "test of type jsc" already exists. Skipping. [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] No API scoped Resource File config found. [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:apiproducts (create-config-apiproduct) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee API Product [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Retrieving existing API Products [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/apiproducts accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log]
[INFO] API Product "EchoProduct" already exists. Skipping. [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:developers (create-config-developer) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee Developer [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Retrieving existing Developers [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/developers accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log] [INFO] Developer "john@example.com" already exists. Skipping. [INFO] Developer "bill@unesco.com" already exists. Skipping. [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:apps (create-config-app) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee App [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Retrieving Apps of john@example.com [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/developers/john@example.com/apps accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log] [INFO] App "coolechoapp" already exists. Skipping. [INFO] Retrieving Apps of bill@unesco.com [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/developers/bill@unesco.com/apps accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log] [INFO] App "oneechoapp" already exists. Skipping. [INFO] [INFO] --- apigee-config-maven-plugin:1.3.8:reports (create-config-reports) @ HelloWorld --- [INFO] ************************************************************************ [INFO] Apigee Custom Report [INFO] ************************************************************************ [INFO] Retrieving config from /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/edge.json [INFO] Retrieving existing Custom Reports [INFO] Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/shivamkr-eval/reports accept: [application/json] accept-encoding: [gzip] authorization: [Basic [Not shown in log]
[INFO] Custom Report "Policy errors" already exists. Skipping. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 13.201 s [INFO] Finished at: 2020-03-31T06:36:54-04:00 [INFO] ------------------------------------------------------------------------ Started calculate disk usage of build Finished Calculation of disk usage of build in 0 seconds Started calculate disk usage of workspace Finished Calculation of disk usage of workspace in 0 seconds Finished: FAILURE
@Swapna Nandigam - Can you please share the pom files? Are you using the Maven modules here? Looks like the parent project is also set as a module and since that is failing, the job is marked as failure. If you have a parent pom that has all the build steps, then your pom.xml within the main project should call that parent-pom. Something like this
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>parent-pom</artifactId> <groupId>apigee</groupId> <version>1.0</version> <relativePath>../shared-pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <groupId>apigee</groupId> <artifactId>mock</artifactId> <version>1.0</version> <name>Mock-v1</name> <packaging>pom</packaging> </project>
Check out the samples here for more info
Hi @Sai Saran Vaidyanathan,
I have fixed the issue with with pom files by pointing to proper pom in jenkins. But after that im seeing the below error.
=============Initializing Maven Deployment================ [INFO] =============Importing App================ [ERROR] * * * * * * * * * * * This deployment could have failed for a variety of reasons. * * * * * * * * * * * Started calculate disk usage of build Finished Calculation of disk usage of build in 0 seconds Started calculate disk usage of workspace Finished Calculation of disk usage of workspace in 0 seconds [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.404 s [INFO] Finished at: 2020-04-01T03:42:12-04:00 [INFO] ------------------------------------------------------------------------ Waiting for Jenkins to finish collecting data [ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.1.7:deploy (deploy-bundle) on project HelloWorld: MojoExecutionException: NullPointerException -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [JENKINS] Archiving /datapower/slave/workspace/Apigee/Apigee_Proxy/api/HelloWorld/pom.xml to Apigee/HelloWorld/1.0/HelloWorld-1.0.pom channel stopped
Attached pom files for reference.
What is the command you are executing ? I dont see the configure goal being called so the target directory might not have the proxy bundle (zip)
Hi @Sai Saran Vaidyanathan
Below is the command i'm using.
mvn install -P$Env -Dusername=---------- -Dpassword=--------- -Dorg=$Org
configure goal is alreeady there in shared-pom.xml under apigee-edge-maven-plugin . Should it be included anywhere else.
Please suggest.
@Swapna Nandigam - Can you check if the target directory has the proxy code copied over?
@Swapna Nandigam - in your "copy-resources" goal call in your pom, can you change the phase to "package" instead of "prepare-package"
Hi @Sai Saran Vaidyanathan,
Yes target directory has the proxy code copied. And i have changed the phase to package from prepare-package but still facing the same error.
Not sure why its failing. Can you try the samples from the GitHub repo ? Just clone and go to the sample and test it out
Hi @Sai Saran Vaidyanathan,
Issue is fixed. Mistake was in jenkins the command was added in execute shell. Hence jenkins was failing to pick up the mvn command. So i added the command under build --> goals and options. The job ran successfully.
Thanks for your support.