问题描述
我们不断使用Jenkins构建我们的应用程序,并将其部署到我们的不同空间:
we continuously build our apps with Jenkins and deploy them to our different spaces:
...
cf login -a https://api.lyra-836.appcloud.swisscom.com -u ...
cf target -s development
cf push scs-flux-monitoring-development
...
现在,我们意识到推送有时会占用错误的空间来安装应用程序.我们认为这是因为另一个Jenkins Job进行了并行推送.到目前为止,我们可以看到.cf/config.json存储了Space的名称,并且在调用另一个cf目标时,所有推送都使用该新目标.
Now we recognized that the push is sometimes taking a wrong space to install the app. We think this is because of another Jenkins Job doing a parallel push. As far we can see the .cf/config.json stores the name of the Space and when another cf target is called all pushes are using that new target.
任何人也认识到这种行为吗?有什么建议可以解决吗?
Anyone who recognized that behaviour also? Any suggestions to solve that?
亲切的问候
约瑟夫
推荐答案
您可以使用以下几种选择:
There are a couple options you could go with:
-
请勿使用允许不同作业之间共享状态的CI解决方案.就像Cloud Foundry使用容器隔离应用程序一样,也有一些CI解决方案使用容器隔离构建.一个很好的例子是 Concourse CI ,它实际上是核心Cloud Foundry开发团队使用的主要解决方案.
Don't use a CI solution that allows shared state between different jobs. Just as Cloud Foundry uses containers to isolate apps, there are CI solutions out there that use containers to isolate builds. One great example is Concourse CI which is actually the main solution used by the core Cloud Foundry development teams.
让每个Jenkins作业都为CF_HOME
使用不同的位置,这样他们就不会共享~jenkins/.cf
:
Have every Jenkins job use a different location for CF_HOME
so they don't all share ~jenkins/.cf
:
$ cf help | grep CF_HOME
CF_HOME=path/to/dir/ Override path to default config directory
这篇关于詹金斯(Jenkins)将应用推向错误的目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!