2

I'm trying to set GitLab CI process and found it very slooooow to start. 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. Deployment to CI can take up to 5-10 minutes.

How is it possible:

  • minimize pending time? Buy enterprise account?
  • speed up image building and installation?
  • cache docker image?
  • join base image from the file and ours 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:

    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.

Eugene Lisitsky
  • 12,113
  • 5
  • 38
  • 59

1 Answers1

2

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. 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. All the things you need are anyway free, GitHub, Docker Hub and ...

Then assuming you are using gitlab.com, you can either pay for dedicated runners or bring your own by activating private runners.

mohamnag
  • 2,709
  • 5
  • 27
  • 40
  • Right now I'm using free hosted version. I want to build and test a whole workflow on it. And then make a decision is it worth migrating on it. Thanks for recommendation. I'll try to simplify process. What else can I do? – Eugene Lisitsky Dec 15 '16 at 09:40
  • ok, then try to build better docker images with everything pre installed. I have been using a self hosted version and obviously there you dont have any kind of waiting time and builds are faster if CI runner and the GitLab are on a local network. – mohamnag Dec 15 '16 at 09:45
  • And if you have your own private machine for runners, then docker images are cached and you will have much faster time to start tests. – mohamnag Dec 15 '16 at 09:45
  • Also if you want, you can keep using the gitlab.com's free version but register your own runners per project. If you had self hosted gitlab, you could register a runner as global one, but here it should be done per project. Just go to project's options ~> runners for details – mohamnag Dec 15 '16 at 09:51
  • Yes. Have you tested their Paid Gitlab Hosted ? At a moment I like idea not to be tied to much specific workspace, so avoid hassle with it's updates and so on. – Eugene Lisitsky Dec 15 '16 at 10:04
  • there is no generic CI protocol, so one way or the other you will be tied to a solution. Also GitLab has a very smooth update process, I have been using a self hosted instance for nearly 2 years and updated each single month with not even one minor problem – mohamnag Dec 15 '16 at 14:50
  • no, I have never tried the paid version, neither hosted nor self hosted – mohamnag Dec 15 '16 at 14:51