【问题标题】:Gitlab runner: It is possible running an docker image that depends from anotherGitlab runner:可以运行依赖于另一个的 docker 镜像
【发布时间】:2016-07-25 21:44:24
【问题描述】:

场景如下:

在使用 docker 容器进行持续集成的过程中,我需要运行 grunt serve 在 localhost:9000 中为我的应用程序提供服务,然后我需要运行另一个容器,该容器使用在 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 中为我的应用程序提供服务,我希望第二个图像使用这个正在运行的应用程序来运行另一个脚本。

【问题讨论】:

    标签: docker protractor gitlab-ci grunt-contrib-connect


    【解决方案1】:

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

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

    【讨论】:

    • 谢谢,使用您的回答我终于明白我一直在用量角器和硒驱动程序测试我的应用程序的方法错误。 e2e 测试需要我的应用程序之前已部署!在此之前,我一直在尝试使用量角器框架运行我的应用程序。菜鸟错误:(。谢谢!
    • 这并不完全正确 - 您可以将其中一个容器定义为 service。所以理论上你可以有一个准备工作来构建grunt serve 容器并将其用作稍后阶段的服务。不是说这是个好主意;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-29
    • 1970-01-01
    • 2021-08-09
    • 2021-03-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多