Search code examples
jenkinsibm-cloud

CF push works nicely, automated deploy fails on Bluemix


I have a Java maven project that i deploy to Bluemix using cf push. Works like a charm. It has this manifest:

    applications:
    - services:
      - Monitoring and Analytics-gm
      - somedb
      disk_quota: 1024M
      hosts:
      - someapp
      name: someapp
      path: target/someapp-0.0.2.war
      domain: mybluemix.net
      instances: 1
      memory: 512M
    

However when I push my repository to hub.jazz.net and kick off build and deploy, the deploy step fails. I checked the artifacts in the build step and the war file got created.

The error message is: Server error, status code: 400, error code: 170004, message: App staging failed in the buildpack compile phase

What do I miss?

Update

The last lines from the successful build script:

    [INFO] Packaging webapp
    [INFO] Assembling webapp [someapp] in [/home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/0d82aa76-8fb2-463b-b1d6-6ec80a763706/target/someapp-0.0.2]
    [INFO] Processing war project
    [INFO] Copying webapp resources [/home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/0d82aa76-8fb2-463b-b1d6-6ec80a763706/src/main/webapp]
    [INFO] Webapp assembled in [56 msecs]
    [INFO] Building war: /home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/0d82aa76-8fb2-463b-b1d6-6ec80a763706/target/someapp-0.0.2.war
    [INFO] WEB-INF/web.xml already added, skipping
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 11.424 s
    [INFO] Finished at: 2015-09-15T10:59:52+00:00
    [INFO] Final Memory: 17M/27M
    [INFO] ------------------------------------------------------------------------
    Uploading artifacts ...
    UPLOAD SUCCESSFUL
    Total time: 2 seconds
    Finished: SUCCESS

As you can see the target/someapp-0.0.2.war is build which is the one referred to in the deploy script

The last lines from the failed deploy script

    cf --version
    /usr/bin/cf-orig/cf version 6.7.0-IDS-2014-12-04T10:56:46+00:00
    + echo 'Target: https://api.ng.bluemix.net'
    Target: https://api.ng.bluemix.net
    + source _deploy.sh
    ++ cf push someapp
    Updating app someapp in org [email protected] / space somespace as [email protected]...
    OK
    
    Uploading someapp...
    Uploading app files from: /home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/7c0cd4a8-8ecf-4020-ae82-fc567dd666e9
    Uploading 1.9M, 37 files
    
                                 
    Done uploading
    OK
    
    Stopping app app someapp in org [email protected] / space somespace as [email protected]...
    OK
    
    Starting app someapp in org [email protected] / space somespace as [email protected]...
    -----> Downloaded app package (3.9M)
    -----> Downloaded app buildpack cache (4.0K)
    
    FAILED
    Server error, status code: 400, error code: 170004, message: App staging failed in the buildpack compile phase
    
    TIP: use 'cf logs someapp --recent' for more information
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE

log from cf logs someapp --recent

    2015-09-15T22:53:49.75+0800 [API/5]      OUT Updated app with guid 0ac55e94-12b6-490c-99a9-22dfd96ef293 ({"name"=>"someapp"})
    2015-09-15T22:54:06.06+0800 [API/5]      OUT Updated app with guid 0ac55e94-12b6-490c-99a9-22dfd96ef293 ({"state"=>"STOPPED"})
    2015-09-15T22:54:09.68+0800 [DEA/3]      OUT Got staging request for app with id 0ac55e94-12b6-490c-99a9-22dfd96ef293
    2015-09-15T22:54:15.04+0800 [API/6]      OUT Updated app with guid 0ac55e94-12b6-490c-99a9-22dfd96ef293 ({"state"=>"STARTED"})
    2015-09-15T22:54:15.22+0800 [STG/3]      OUT -----> Downloaded app package (3.9M)
    2015-09-15T22:54:15.40+0800 [STG/3]      OUT -----> Downloaded app buildpack cache (4.0K)
    2015-09-15T22:54:15.84+0800 [STG/0]      OUT -----> Liberty Buildpack Version: v1.22-20150824-1104
    2015-09-15T22:54:15.84+0800 [STG/0]      ERR E, [2015-09-15T14:54:15.846523 #56] ERROR -- /var/vcap/data/dea_next/admin_buildpacks/b1841a6c-5f84-4c40-ac86-9f4d5e8f0643_e788f7b61c5fadd2fec138a1417cd3e1d345df32/lib/liberty_buildpack/buildpack.rb:50:in `rescue in drive_buildpack_with_logger': Compile failed with exception #<RuntimeError: No supported application type was detected>
    2015-09-15T22:54:15.84+0800 [STG/0]      ERR No supported application type was detected
    2015-09-15T22:54:15.85+0800 [STG/0]      OUT Staging failed: Buildpack compilation step failed
    2015-09-15T22:54:16.70+0800 [API/6]      ERR encountered error: App staging failed in the buildpack compile phase
    

I tried:

  • no path: in manifest.yml
  • path: target/someapp-0.0.2.war (that works on local cf push)
  • path: someapp-0.0.2.war

None of them worked


Solution

  • Aaarrgghh..... 5 hours of my life gone. I deleted the project and recreated it. When checking the Build Archive Directory it had the entry target (seems to get added when you select mvn). Despite the fact that I tried with path: someapp-0.0.2.war, that didn't work.

    Only after removing target and setting path: target/someapp-0.0.2.war the now clean project did build.

    So lesson learned: When switching to a mvn build, remove the target from the Build Archive Directory