CF push运行良好,Bluemix上的自动部署失败

时间:2015-09-15 03:07:53

标签: jenkins ibm-cloud

我有一个Java maven项目,我使用cf push部署到Bluemix。奇迹般有效。它有这个表现:

    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

然而,当我将我的存储库推送到hub.jazz.net并启动构建和部署时,部署步骤失败。我检查了构建步骤中的工件,并创建了war文件。

错误消息是: Server error, status code: 400, error code: 170004, message: App staging failed in the buildpack compile phase

我想念什么?

更新

成功构建脚本的最后几行:

    [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

正如您所见,target/someapp-0.0.2.war是build,这是部署脚本中引用的那个

部署脚本失败的最后几行

    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 someuser@ibm.com / space somespace as someuser@ibm.com...
    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 someuser@ibm.com / space somespace as someuser@ibm.com...
    OK

    Starting app someapp in org someuser@ibm.com / space somespace as someuser@ibm.com...
    -----> 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

从cf记录日志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

我试过了:

    manifest.yml 中的
  • no path:
  • path: target/someapp-0.0.2.war(适用于本地cf push
  • path: someapp-0.0.2.war

他们都没有工作

2 个答案:

答案 0 :(得分:5)

Aaarrgghh ......我生命中的5个小时消失了。 我删除了项目并重新创建了它。检查构建存档目录时,它有条目target(似乎在选择mvn时添加)。尽管我尝试使用path: someapp-0.0.2.war,但这不起作用。

只有在删除 target并设置path: target/someapp-0.0.2.war之后才能构建现在干净的项目。

经验教训:切换到mvn版本时,从构建存档目录

中删除target

答案 1 :(得分:1)

是的,通常你得到的错误意味着如果找不到你的应用的来源或应用的来源是错误的......你也可以尝试将以下行添加到manifest.yml

buildpack: liberty-for-java

你的新证明就是。

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