DEV Community

Discussion on: GitLab CI: Creating your own pipeline template library 👷

Collapse
 
tobiashochguertel profile image
Tobias Hochgürtel

I have few or one idea, as a follow up article, you could show how to make a a pipeline more generic, for example I have a pipeline for python which is also possible to do specific python projects like django, because there isn't to much difference. I use there often one-liner shell script steps like:

- "[ -f .env.ci ] && cp .env.ci .env"
- "[ -f manage.py ] && python manage.py test"
Enter fullscreen mode Exit fullscreen mode

and then also how a reusable template can be used look, and used. For example:

my Project pipeline looks like this:

include:
  - project: 'infrastructure-hochuertel.work/gitlab-ci.yml'
    ref: master
    file: '/python/Python-Projects.gitlab-ci.yml'

variables:
  PROJECT_DIRECTORY: 'mysite'
Enter fullscreen mode Exit fullscreen mode

I have only to overwrite one variable to select the correct directory which is to be used to test. That I have to set the variable has a repository structure semantic, I could also have all python project in the same directory of a new repository, but I do it like this. -because I will use the same template again for the same repository but with a different directory (to release python packages to pypi, we refactored some django-apps into python packages to reuse them).

the interesting thing which I have in mind is maybe this:
Another topic which is often not really clear is how to versioning with a pipeline, how can we trigger a release (manual by API, or by a specific trigger like changed file) in the way that we have not to do a change in the gitlab-ci.yml file (to activate release button, and then deactivate release button)...
Releasing and Versioning is often confusing topic when I look into development teams, mostly they have per project only one package which they "release" what they do is just deploy.

hmm, I could write more and more ideas, as I sit here and write down what I have in mind about what you could write, often topics which I have to cover myself, also.

  • Multi Pipeline Triggering,
  • How to release a new Documentation Version next to the already existing version of the documentation (think like the Java API documentation for each release), how could this be organized and done, maybe via gitlab pages feature, or different.