Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitlab Pipeline Templates

Stages

Validation

Necessary checks. Available jobs: testing, testing-with-postgres, is-buildable.

Quality

Run code quality checks. Informational only. Available jobs: lint, fmt and static-type-check.

Build

Build image and push it to the registry. Available jobs: build, build-only-amd and build-merge.

Tag

Bump version and create a tag. Available jobs: tag, tag-and-stamp and tag-and-stamp-tail.

Release

Create gitlab release. Available jobs: release and release-from-changelog.

Publish

Publish the package. Available jobs: publish.

🔎 How to Use

Job Declaration

All jobs are hidden by default. To activate a job (here testing-with-postgres) in your project set the following content in your .gitlab-ci.yml file:

test: # replace with the job name you want to see in the gitlab GUI.
  extends: .testing-with-postgres

⚡️Shared Jobs

  • is-buildable
    • check if the image is buildable.
  • build
    • builds (amd and arm) and pushes to iqvia's registry.
  • build-only-amd
    • builds (amd only) and pushes to iqvia's registry.
  • build-merge
    • builds and pushes the image from a merge request (for testing: i.e the built image could be run on dubu.)
  • release
    • creates a gitlab release on the repository.
  • release-from-changelog
    • creates a gitlab release on the repository.
    • uses the changelog to fill the release description. (changelog shoud be located at the root of the repository and named CHANGELOG.md and follow this convention).

🎻 Poetry Based Project

Jobs

  • testing
    • performs tests using pytest,
    • outputs coverage score,
    • creates two artifacts:
      • .reports/testing.xml
      • .reports/coverage.xml
  • testing-with-postgres
    • same as test but can use a postgres service for integration testing.
  • lint
    • checks code with ruff,
    • creates a code quality report : gl-code-quality-report.json.
  • fmt
    • checks code format with ruff.
  • static-type-check
    • checks code type with mypy,
    • creates an artifact .reports/typing.xml.
  • tag
    • bumps the app version according to the branch name's prefix,
    • exports requirements files,
    • creates a tag and push it to the repository.
  • tag-and-stamp
    • same as tag but also write a __version__ = "x.y.z" line in the init.py file located at the root of your package.
  • tag-and-stamp-tail
    • same as tag-and-stamp but write the __version__ = "x.y.z" line at the end (see it as a >> instead of a >).
  • publish
    • builds the package and publish it to IQVIA's nexus.

Poetry Groups

  • test and test-with-postgres jobs require a group named testing containing at least pytest and coverage.
  • lint and format jobs require a group named quality containing at least ruff.
  • type-check job requires a group named typing containing at least mypy.

Additional Variables

the test-with-postgres job needs the following variables:

variables:
  ...
  POSTGRES_VERSION: "16.2" # replace with your own value

🌐 Node Based Project

Jobs

  • testing
    • performs tests using vitest,
    • outputs coverage score.
  • tag
    • bumps the app version,
    • creates a tag and push it to the repository.

Workflow

Open a MR targetting your repo's default branch from a branch prefixed by a semver word i.e minor/new-markets-router. Once ready, run the necessary jobs (is-buildable and tests), additionaly run the facultative ones (lint, fmt, static-type-check, build-merge).

Upon success the branch will be merged and the CI will bump the version accordingly to the branch prefix, create a tag and rexport the requirements files. Right after this tag and commit are pushed, the test wil re-run and a gitlab release will be created.

You cannot control when a job is ran. If you activate it in your .gitlab-ci.yml file it will show up based on it's associated workflow. If you think something is wrong contact the owner of this repo or update it yourself but do not forget to let the team know as everything you do here will impact all of our projects.

About

Gitlab CI templates.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors