简体   繁体   English

manbetx客户端打不开CI加速

[英]GitLab CI speed up

I'm trying to set GitLab CI process and found it very slooooow to start. 我正在尝试设置GitLab CI流程,发现启动过程非常缓慢。 Task can hang up in pending state for minutes. 任务可以挂起等待状态几分钟。 But main problem is very slow building. 但是主要问题是建造速度很慢。 We have a custom PHP docker image (with some modules built-in) and app. 我们有一个自定义的PHP docker映像(内置一些模块)和应用程序。 Deployment to CI can take up to 5-10 minutes. 部署到CI可能需要5到10分钟。

How is it possible: 这怎么可能:

  • minimize pending time? 最小化等待时间? Buy enterprise account? 购买企业帐户?
  • speed up image building and installation? 加快图像的建立和安装?
  • cache docker image? 缓存docker映像?
  • join base image from the file and ours php7? 从文件和我们的php7加入基本图片?

Though there're some unnecessary checks for version and time, they're not a problem - they are fast but they give iformation about precise version and run time. 尽管对版本和时间进行了一些不必要的检查,但它们不是问题-速度很快,但可以提供有关精确版本和运行时间的信息。

.gitlab-ci.yml : .gitlab-ci.yml

    image: "registry.gitlab.com/project/debianphp7:latest"

    services:
       - mariadb:10.1

    variables:
    #  CI_DEBUG_TRACE: "true"   # hard Gitlab CI debug
      MYSQL_HOST: mariadb
      MYSQL_DATABASE: dbname
      MYSQL_ROOT_PASSWORD: "password"
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      MYSQL_CMD: "mysql --user=root --password=$MYSQL_ROOT_PASSWORD --host=$MYSQL_HOST $MYSQL_DATABASE "

    before_script:
      - apt-get update && apt-get install mysql-client -y
      - echo "Load database fixtures"
      - mysql -V
      - echo $MYSQL_CMD
      - echo "SELECT 'OK', NOW(), VERSION();" | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb
      - echo "SELECT 'OK', NOW(), VERSION();" | $MYSQL_CMD
      - (find ./sql/*.sql -type f | while read f; do
             echo "Loading " $f;
             cat $f | $MYSQL_CMD;
         done);

    test:
      script:
        php -d short_open_tag=On src/execute_request_by_cron.php -- request=TestUnitTestRequest

Thx. 谢谢。

What is not clear to me is if you are using the free hosted version at gitlab.com or a self hosted version of gitlab. 对我来说不清楚的是,您使用的是gitlab.com上的免费托管版本还是gitlab的自托管版本。 But in general you can do following two things: 但总的来说,您可以做以下两件事:

First the completely free upgrade: All the things that do not change in your code shall best be moved to a pre built image. 首先是完全免费的升级:最好将代码中所有不变的内容移至预构建的映像中。 for example this line: 例如以下行:

apt-get update && apt-get install mysql-client -y

I would create an image from your source image that does have the mysql client pre-installed. 我将从您的源映像创建一个映像,该映像确实已预安装了mysql客户端。 All the things you need are anyway free, GitHub, Docker Hub and ... 无论如何,您需要的所有东西都是免费的,GitHub,Docker Hub和...

Then assuming you are using gitlab.com, you can either pay for dedicated runners or bring your own by activating private runners. 然后,假设您使用的是gitlab.com,则可以为专用跑步者付费,也可以通过激活私人跑步者自己带来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM