如何使用Jenkins将更新部署到OpenShift Mono应用程序?

时间:2014-07-20 13:44:37

标签: deployment jenkins mono openshift

我使用社区卡带here在OpenShift上创建了一个单声道应用程序。

现在,我正在阅读如何通过jenkins here设置连续构建。

默认的单声道应用程序似乎没有任何必要的脚本来构建,恢复NuGet包等。相反,git repo似乎有DLL二进制文件,这似乎不可持续。< / p>

在开放班次上部署单声道的最佳方法是什么?

1 个答案:

答案 0 :(得分:0)

如果我开始工作,我会改进这个答案......

您是否首先点击OpenShift应用程序页面上的盒式磁带下面的“持续集成 - 启用Jenkins”链接?

完成此操作后,我的git push输出已更改为:

remote: CLIENT_MESSAGE: Stopping Apache+mod_mono HTTPD server
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Stopping Postgres cartridge
remote: Building git ref 'master', commit 8da79f2
remote: Preparing build for deployment
remote: Deployment id is 05e8d1d8
remote: Activating deployment
remote: Starting Postgres cartridge
remote: Postgres started
remote: CLIENT_MESSAGE: Starting Apache+mod_mono HTTPD server
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success

要:

remote: Executing Jenkins build.
remote:
remote: You can track your build at https://jenkins-[you].rhcloud.com/job/mono-build
remote:
remote: Waiting for build to schedule...........Done
remote: Waiting for job to complete...............Done
remote: SUCCESS
remote: New build has been deployed.
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Deployment completed with status: success

但是,如果我从源代码中删除bin目录,那么即使构建“成功”,该网站也不再有效。很明显,它只是盲目地从git中复制文件。

接下来,我在Package Manager控制台中执行了Update-Package -reinstall -ProjectName OpenShift,然后右键单击解决方案并选择“启用NuGet包还原”,并提交/推送这些更改。

在Jeninks经理中,我去配置构建并在“执行shell”区域中的xbuild OpenShift.sln行之后添加了gear build

现在它实际尝试进行真正的构建,但失败并出现错误:

+ xbuild OpenShift.sln
XBuild Engine Version 3.0.7.0
Mono, Version 3.0.7.0
Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.

Build started 01/13/2015 20:56:29.
__________________________________________________
/var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.sln:  warning : /var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.csproj: /var/lib/openshift/[my ID]/mono/mono/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets: Project file could not be imported, it was being imported by /var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.csproj: Access to the path "/var" is denied.
Project "/var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.sln" (default target(s)):
    Target ValidateSolutionConfiguration:
        Building solution configuration "Debug|Any CPU".
    Target Build:
/var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.csproj: error : /var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.csproj: /var/lib/openshift/[my ID]/mono/mono/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets: Project file could not be imported, it was being imported by /var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.csproj: Access to the path "/var" is denied.
    Task "MSBuild" execution -- FAILED
    Done building target "Build" in project "/var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.sln".-- FAILED
Done building project "/var/lib/openshift/[my ID]/app-root/runtime/repo/OpenShift.sln".-- FAILED

Build FAILED.

看起来可能是this problem所以我将以下手册差异化为OpenShift.csproj:

-   <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
-   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
+   <Import Project="$(SolutionDir)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" />

并从Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications复制到我本地项目的上述路径中。

提交/推送后,现在我得到了这个新的构建错误:

Project "/var/lib/openshift/[my id]/app-root/runtime/repo/OpenShift.sln" (default target(s)):
    Target ValidateSolutionConfiguration:
        Building solution configuration "Debug|Any CPU".
    Target Build:
        Project "/var/lib/openshift/54b5dc8efcf933bb7300001f/app-root/runtime/repo/OpenShift.csproj" (default target(s)):
            Target RestorePackages:
                Executing: mono --runtime=v4.0.30319 "/var/lib/openshift/[my id]/app-root/runtime/repo/.nuget/NuGet.exe" install "/var/lib/openshift/[my id]/app-root/runtime/repo/packages.config" -source ""   -RequireConsent -solutionDir "/var/lib/openshift/[my id]/app-root/runtime/repo/"
                Cannot open assembly '/var/lib/openshift/[my id]/app-root/runtime/repo/.nuget/NuGet.exe': File does not contain a valid CIL image.

看起来运行NuGet.exe时出现问题 - 可能会this