“序列化”竹子建造?

发布于 2024-12-12 03:42:16 字数 666 浏览 0 评论 0原文

我们使用 Bamboo v3.1.1 作为我们的持续集成构建服务器,并且它在大多数情况下都运行良好。

我们遇到的一个问题是我们正在进行大量面向数据库的测试,例如构建在共享数据库实例上进行一些单元和集成测试。

当我们碰巧同时运行同一个构建计划的多个 Bamboo 构建时,这会导致问题 - 它们互相绊倒并导致死锁,通常,所有涉及的构建都会因此而失败。

因此,虽然并行构建在理论上很棒,但我们确实希望能够定义一个构建计划来“序列化”构建,例如,永远不要并行执行多个构建。

有谁知道我们该怎么做?是否有一个设置告诉 Bamboo“不要并行化此构建计划 - 仅以串行方式一次执行一个构建”

更新:

我的构建过程当前有两个阶段:

  • 核心构建(构建VS 解决方案,将测试数据库更新为最新脚本)
  • 测试(NUnit 2.4)

“核心构建”可以轻松并行运行多次 - 没有问题。然而,“测试”阶段不能运行多次,因为其中一些测试访问唯一的共享“单元测试”数据库;如果超过 1 个“测试”阶段进程正在运行,它们最终会彼此陷入僵局。

那么我如何告诉 Bamboo 可以并行化“核心构建”阶段,但对于“测试”,无论运行多少个构建,始终一次只运行一个实例

We are using Bamboo v3.1.1 as our continuous integration build server, and it works quite well - most of the time.

One issue we're having is that we're doing a fair amount of database-oriented testing, e.g. the builds do some of their unit and integration tests on a shared database instance.

This causes issues when we happen to have multiple Bamboo builds for the same build plan running at the same time - they're stumbling over each other's feet and cause deadlocks and usually, all builds involved will fail due to this.

So while parallel builds are great - in theory - we'd really like to be able to define a build plan to "serialize" the builds, e.g. never execute more than one build in parallel.

Does anyone know how can we do this?? Is there a setting to tell Bamboo "don't parallelize this build plan - just do one build at a time, in a serial fashion"

Update:

My build process currently has two stages:

  • core build (building VS solution, updating test database to latest scripts)
  • testing (NUnit 2.4)

The "core build" can easily be run multiple times in parallel - no problems there. However, the "Testing" stage cannot be run more than once since some of those tests access the one and only shared "unit test" database; if more than 1 "testing" stage process are running, they'll end up deadlocking each other.

So how do I tell Bamboo it's OK to parallelize the "core build" stage, but for the "testing", always only run one instance at a time, no matter how many builds are running??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

东北女汉子 2024-12-19 03:42:16

我的方法是将核心构建放在一个计划中,并将测试放在另一个计划中。 核心构建将触发测试计划作为子计划。

然后,一旦核心构建完成,测试计划就会产生。

核心构建计划大概可以设置为在许多机器上并行运行多个实例。 测试计划将仅限于同时运行的计划的单个实例。

我唯一的困惑是你说:

  • 核心构建

    (构建 VS 解决方案,将测试数据库更新为最新脚本

更新测试数据库不会导致正在运行的测试计划出现问题?

My approach would be to put the core build in one plan, and the testing in another plan. The core build would trigger the testing plan as a child plan.

Then as soon as the core build finishes, a testing plan would spawn.

The core build plan presumably could be set to run multiple instances in parallel on many machines. The testing plan would be limited to a single instance of the plan running at once.

My only confusion is that you said:

  • core build

    (building VS solution, updating test database to latest scripts)

Doesn't updating the test database cause a problem for a running testing plan?

随遇而安 2024-12-19 03:42:16

是啊。有两种方法可以做到这一点:任务和阶段。我的猜测是你想要阶段。

要使构建并行运行,您必须在一个阶段内运行多个作业。如果您将无法并行运行的作业放在单独的阶段中,它们将串行运行。例如,如果您有:

Test Foo Stage:
    Init Foo Database Job
    Hammer Foo Database Job
    Smash Foo Database Job
Test Baz Stage:
    Init Baz Database Job
    Bamboozle Baz Database Job
    Befuddle Baz Database Job

那么 foo 阶段的 Init/Hammer/Smash 并行运行将会出现问题。但是,您可以将每个任务放在自己的阶段中:

Test Foo Init Stage:
    Init Foo Database Job
Test Foo Hammer Stage:
    Hammer Foo Database Job
Test Foo Smash Stage:
    Smash Foo Database Job
Test Baz Init Stage:
    Init Baz Database Job
Test Baz Bamboozle Stage:
    Bamboozle Baz Database Job
Test Baz Befuddle Stage:
    Befuddle Baz Database Job

然后,每个任务将串行运行,而不是并行运行。当然,这实际上限制了您只能使用一个有用的代理。

如果您确实只想使用单个代理,则始终可以禁用除一个代理之外的所有代理,但这会影响所有构建,因此如果您希望任何东西并行运行,这不是一个好主意。

作为最后的评论,也可以通过任务而不是阶段到达你想要的地方。连接每个作业中的任务,它们将由单个代理串行运行。当然,每个任务都会看到前一个任务中更改的文件和状态,因此您需要确保它们不会干扰。

Aye. There are two ways to do this: tasks and stages. My guess is that you want stages.

To have your builds running in parallel, you must have several jobs running inside one stage. If you take the jobs that can't be run in parallel and put them in separate stages, they will run serially. For example, if you have:

Test Foo Stage:
    Init Foo Database Job
    Hammer Foo Database Job
    Smash Foo Database Job
Test Baz Stage:
    Init Baz Database Job
    Bamboozle Baz Database Job
    Befuddle Baz Database Job

Then the Init/Hammer/Smash of the foo stage will run problematically in parallel. However, you can put each in its own stage:

Test Foo Init Stage:
    Init Foo Database Job
Test Foo Hammer Stage:
    Hammer Foo Database Job
Test Foo Smash Stage:
    Smash Foo Database Job
Test Baz Init Stage:
    Init Baz Database Job
Test Baz Bamboozle Stage:
    Bamboozle Baz Database Job
Test Baz Befuddle Stage:
    Befuddle Baz Database Job

Then, each task will run in serial, not parallel. Of course, this effectively limits you to a single useful agent.

If you really want to only use a single agent, you can always disable all but one agent, but that will affect all the builds, so that wouldn't be a good idea if you want anything to run in parallel.

And as a last comment, it is also possible to get where you want with tasks instead of stages. Concatenate the tasks from each Job and they will be run in serial by a single agent. Of course, each task will see the changed files and state from the previous task, so you'll want to make sure they won't interfere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文