【问题标题】:Jenkins crashs on concurrent grunt taskJenkins 在并发 grunt 任务上崩溃
【发布时间】:2015-03-22 12:52:05
【问题描述】:

我正在尝试在 Jenkins 中构建运行一个基于 grunt 的构建任务,该任务是使用 yeoman 生成器创建的。

Jenkins 能够成功运行 npm installbower install

问题:当我运行grunt Jenkins 崩溃时:无法通过浏览器访问它,它丢失了构建任务的条目,必须重新启动。

如果我在任务运行时观察控制台输出,我在服务器崩溃之前收到的最后一条消息是:

[4mRunning "concurrent:dist" (concurrent) task[24m [32m>>
[39mWarning: There are more tasks than your concurrency limit. After
this limit[32m
>> [39mis reached no further tasks will be run until the current tasksare[32m
>> [39mcompleted. You can adjust the limit in the concurrent task options

到目前为止我尝试了什么:

  1. 我尝试将 Jenkins 设置为允许 4 个构建过程。
  2. 我还尝试将其限制为 1 个构建过程。两者都没有改变任何东西。
  3. 我无法真正更改 grunt 任务,因为我必须在 30 多个项目中执行此操作。

问题:有没有办法可以在不崩溃的情况下运行并发的 grunt 任务?

Gruntfile.js 的一部分:

// Run some tasks in parallel to speed up the build process
concurrent: {
  server: [
    'compass:server'
  ],
  test: [
    'compass'
  ],
  dist: [
    'compass:dist',
    'imagemin',
    'svgmin'
  ]
},

【问题讨论】:

    标签: concurrency jenkins gruntjs yeoman


    【解决方案1】:

    虽然阿德本的回答是对的,但他没有解释在哪里设置limit。它在您的 Gruntfile 中,这就是它应该如何查找具有 2 个并发任务的示例:

    grunt.initConfig({
        concurrent: {
            target: {
                tasks: [ 'watch', 'nodemon:run' ],
                options: {
                    limit: 2,
                    logConcurrentOutput: true
                }
            },
        }
    });
    

    这里是grunt concurrent的文档

    【讨论】:

      【解决方案2】:

      您可以声明要使用的 CPU 内核数,即:

      options:
            limit: 2
            logConcurrentOutput: true
      

      【讨论】:

      • 我应该把这个限制放在哪里?在 Grunt 中还是在 Jenkins 中?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多