Bluemix 构建和部署管道不适用于 Maven

Bluemix Build & Deploy pipeline does not work with Maven

我正在尝试使用 MAVEN 在 Bluemix 中创建部署管道,而部署阶段总是遗漏在前一阶段(构建阶段)中生成的工件,即,它永远找不到 .war 包, 有任何想法吗?下面的日志。

构建:

[INFO] Packaging webapp [INFO] Assembling webapp [MyWebAppInBluemix] in [/home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/86d18f86-4ade-4e02-8282-171dc9757272/target/MyWebAppInBluemix] [INFO] Processing war project [INFO] Copying webapp webResources [/home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/86d18f86-4ade-4e02-8282-171dc9757272/src/main/webapp/WEB-INF] to [/home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/86d18f86-4ade-4e02-8282-171dc9757272/target/MyWebAppInBluemix] [INFO] Copying webapp resources [/home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/86d18f86-4ade-4e02-8282-171dc9757272/src/main/webapp] [INFO] Building jar: /home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/86d18f86-4ade-4e02-8282-171dc9757272/target/MyWebAppInBluemix/WEB-INF/lib/MyWebAppInBluemixBlueMix-1.0-SNAPSHOT.jar [INFO] Webapp assembled in [838 msecs] [INFO] Building war: /home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/86d18f86-4ade-4e02-8282-171dc9757272/target/MyWebAppInBluemix.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 44.417 s [INFO] Finished at: 2015-04-12T00:48:18+00:00 [INFO] Final Memory: 21M/36M [INFO] ------------------------------------------------------------------------ /home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/86d18f86-4ade-4e02-8282-171dc9757272 .. Uploading artifacts ... UPLOAD SUCCESSFUL Total time: 11 seconds Finished: SUCCESS

部署:

Started by user pipeline Building remotely on jenkins-deploy-slave-fe1b25615459 (.*Deploy) in workspace /home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/6f0d5c28-555a-4d9e-8207-7e5dfa978bbc Unable to access upstream artifacts area /opt2/jenkins/jobs/9b24c823-cdb0-2f05-7588-80df3afc1131/jobs/86d18f86-4ade-4e02-8282-171dc9757272/builds/2015-04-11_19-47-24/archive. Does source project archive artifacts? Downloading artifacts ... DOWNLOAD SUCCESSFUL Total time: 11 seconds ...

++ cf push MyWebAppInBluemix Updating app MyWebAppInBluemix in org marcelo@mail.com / space Development as marcelo@mail.com... OK

Uploading MyWebAppInBluemix... Uploading app files from: /home/jenkins/workspace/9b24c823-cdb0-2f05-7588-80df3afc1131/6f0d5c28-555a-4d9e-8207-7e5dfa978bbc Uploading 47.9M, 169 files

                          Done uploading OK

Stopping app MyWebAppInBluemix in org marcelo@mail.com / space Development as marcelo@mail.com... OK

Starting app MyWebAppInBluemix in org marcelo@mail.com / space Development as marcelo@mail.com... -----> Downloaded app package (85M) -----> Downloaded app buildpack cache (1.4M)

FAILED Server error, status code: 400, error code: 170003, message: An app was not successfully detected by any available buildpack

TIP: use 'cf logs MyWebAppInBluemix --recent' for more information Build step 'Execute shell' marked build as failure Finished: FAILURE

看起来您的构建任务正在 git 项目的基目录中构建 war 文件,而部署作业正在存档目录中查找它。

您可以通过修改构建或部署作业以在 war 文件的基目录或存档目录中查找来解决此问题。

在构建作业配置中,"Build Archive Directory" 描述了一个相对于工作目录的目录,用于在作业结束时保存工件。工件将保存在与 "Build Archive Directory" 相同的结构中。 请注意,如果构建存档目录留空,则默认为工作目录。 如果工作目录留空,则默认为项目的根目录。

当构建被用作下游阶段的输入时,下游阶段中的所有作业(例如,部署)都将引用来自构建的工件,其结构与它们存储的结构相同。 查看此结构的最佳方式是单击特定构建并单击 ARTIFACTS 选项卡。此选项卡上显示的工件将在与部署作业所示完全相同的结构中引用。

我在尝试将 NodeJS 推送到 Bluemix 时收到类似的错误。

FAILED Server error, status code: 400, error code: 170003, message: An app was not successfully detected by any available buildpack

当推送应用程序所需的文件不存在时,似乎会发生此错误。例如,如果您或您的脚本没有从 app 目录推送,或者您在该目录中还有其他应用程序,则会为您的应用程序推送错误的文件。我的目录结构如下:

/workspace/app1 /workspace/bluemix-node-mysql-uploader-master5 #my nodejs app

我正在从以下位置调用 CF 推送命令:

/workspace/cf push bluemix-node-mysql-uploader-master5

这给了我同样的错误。我通过从应用程序目录推送它可以找到 manifest.yml 文件来更正此问题。使用此命令一切都很好:

/workspace/bluemix-node-mysql-uploader-master5/cf push bluemix-node-mysql-uploader-master5

如果您没有构建管道,您可以使用此命令推送到 cf

cf push app-name -p target/app-name.jar

当您将此行添加到您的部署配置时,它不起作用。所以当我删除目标并再次尝试时,它通过了部署阶段。所以应该是像下面这行。

cf push app-name -p app-name.jar