Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin/topic/gitlab ci improvements 01 #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TorstenRobitzki
Copy link
Owner

Does this work?

obruns and others added 2 commits June 26, 2018 21:47
…nd GCC

While Travis CI still seems to support only Ubuntu Precise or Trusty [1]
GitLab CI is much more flexible by using Docker (however, inside the
Travis VMs one seems to be able to make use of Docker which seems
cumbersome [2]).

A side effect of that limitation seems to be that almost all Travis runs
initially pull some dependencies (`apt install ...`) which can entirely
be skipped by providing a suitable Docker image to the GitLab registry.

Travis CI allows to configure a "build matrix" [3] which has a lot of
duplicated lines. The "anchor" feature of .gitlab-ci.yml allows to
inherit from templates. Both result in parallel builds.

While merging multiple templates works fine, merging multiple templates
with variables does not. In the following example, *clang overwrites all
variables set in the *debug template that is referenced before:

  .clang_template: &clang
      variables:
          COMPILER: clang++-6.0

  .gcc_template: &gcc
      variables:
          COMPILER: g++

  .debug_template: &debug
      variables:
          MODE: Debug

  .release_template: &release
      variables:
          MODE: Release

  clang-debug:
      <<: *build_definition
      <<: *debug                # MODE is unset/does not exist
      <<: *clang                # COMPILER is set

Build and push the image using the following commands

  docker build -t registry.gitlab.com/obruns/bluetoe/ubuntu-build:1.0 - < Dockerfile
  docker push registry.gitlab.com/obruns/bluetoe/ubuntu-build:1.0

Making use of stages [5] does not make sense in this context because
stages allow parallel execution of steps that result in artifacts that
are later combined. This requires that the stages deploy or publish the
artifacts for later consumption because each stage is a separate
container instance.

[1] https://docs.travis-ci.com/user/reference/overview/#Virtualisation-Environment-vs-Operating-System
[2] https://docs.travis-ci.com/user/reference/trusty
[3] https://docs.travis-ci.com/user/languages/cpp/#GCC-on-Linux
[4] https://docs.gitlab.com/ce/ci/yaml/README.html#anchors
[5] https://docs.gitlab.com/ee/ci/yaml/#stages
…luetoe into origin/topic/gitlab-ci-improvements-01
@xnlcasad
Copy link
Collaborator

Which would be the goal of merging gitlab-ci? Can you run gitlab-ci while hosting on github ?

@TorstenRobitzki
Copy link
Owner Author

Sorry, for the confusion. I created that branch just to test if this is sufficient to get it build by gitlab. But of cause, it's not.

@xnlcasad
Copy link
Collaborator

Ok. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants