The modern way to include our CI templates in your .gitlab-ci.yml

Ingo Klöcker kloecker at kde.org
Tue Oct 31 22:37:49 GMT 2023


Hi everybody,

TL,DR: Use include:project when including CI templates in your .gitlab-ci.yml, 
e.g.
```
include:
  - project: sysadmin/ci-utilities
    file:
      - /gitlab-templates/linux-qt6.yml
      - /gitlab-templates/freebsd-qt6.yml
      - /gitlab-templates/android-qt6.yml
      - /gitlab-templates/reuse-lint.yml
      - /gitlab-templates/flatpak.yml
```

Details

Some of our CI templates are making use of local includes (think a KDE 
Frameworks header that includes another header from the same framework with 
#include "other.h"). Unfortunately, local includes are incompatible with our 
old way to include the CI templates, i.e.
```
include:
  - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/
linux-qt6.yml
```

If you try this with the (still experimental) craft-android-apks.yml template, 
then GitLab will be very unhappy and tell you
| Unable to create pipeline
|
| * Local file `gitlab-templates/craft-android-base.yml` does not have project!

Therefore, we have to switch to the "modern" include:project [1]. This format 
also offers an intuitive way to include CI templates from a work branch if you 
are hacking on the CI templates and want to test them by adding a `ref`, e.g.
```
include:
  [...]
  - project: sysadmin/ci-utilities
    ref: work/kloecker/improve-craft-templates
    file:
      - /gitlab-templates/craft-android-apks.yml
```

More information about our CI system can be found at
https://community.kde.org/Infrastructure/Continuous_Integration_System

And a brief description of our CI/CD templates can be found at
https://invent.kde.org/sysadmin/ci-utilities/-/tree/master/gitlab-templates#our-gitlab-cicd-pipelines

Regards,
Ingo

[1] https://invent.kde.org/help/ci/yaml/index.md#includeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20231031/4028fc46/attachment.sig>


More information about the kde-devel mailing list