Origin/topic/gitlab ci improvements 01#38
Open
TorstenRobitzki wants to merge 2 commits intomasterfrom
Open
Conversation
…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
Collaborator
|
Which would be the goal of merging gitlab-ci? Can you run gitlab-ci while hosting on github ? |
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. |
Collaborator
|
Ok. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Does this work?