0

场景如下:

在使用 docker 容器进行持续集成的过程中,我需要在 localhost:9000 中运行grunt serve为我的应用程序提供服务,然后我需要运行另一个容器,该容器使用在 localhost:9000 中提供的应用程序执行集成测试:

我的 gitlab.yml 文件

unit-testing:
  image: karma-testing
  script:
    - npm install && bower install && karma start && grunt serve
  cache:
    paths:
    - node_modules/
    - bower_components/

behavior-testing:
  image: protractor-ci
  script:
    - npm install protractor-cucumber-framework cucumber && xvfb-run --server-args='-screen 0 1280x1024x24' protractor protractor.conf.js
  cache:
    paths:
    - node_modules/
    - bower_components/

第一个图像运行grunt serve在 localhost:9000 中为我的应用程序提供服务的任务,我希望第二个图像使用这个正在运行的应用程序来运行另一个脚本。

4

1 回答 1

1

不,你不能那样做。作业可以在不同的运行器上运行,您无法确定它们是并行运行还是串行运行。

您可以并且应该在与使用它的任务相同的任务中运行 grunt 服务器。准备好的 docker 镜像或特殊的 YAML 功能在这里可能很有用。

于 2016-07-25T22:03:29.257 回答