Skip to content

Conversation

ilovelinux
Copy link

Fixes #595

@ilovelinux ilovelinux force-pushed the feat/ilovelinux-595-add-yaml-files-to-gitlab-ci branch from ea76699 to 5178514 Compare September 2, 2025 09:42
@sirosen
Copy link
Member

sirosen commented Sep 3, 2025

Thanks for filing the issue and PR! I had been under the impression that GitLab only supports the .yml suffix -- that's what's in their docs, and they do not mention support for .gitlab-ci.yaml.

Can you confirm that GitLab supports the .yaml suffix and will execute pipelines from configs with this extension?

There are a couple of things which need to be tweaked for this to merge:

  • CI tests confirm that .yaml is rejected by the regex -- that needs to be updated
  • per the comment in the .pre-commit-hooks.yaml file, that hook is autogenerated, so the config which generates it needs to be updated

@andrew-rowson-lseg
Copy link

The root gitlab pipeline config can be customised per repo

Personally, I like .gitlab/.gitlab-ci.yaml. The .yml-only restriction I think only applies to pipelines that gitlab loads from external URLs.

@sirosen
Copy link
Member

sirosen commented Sep 10, 2025

Personally, I like .gitlab/.gitlab-ci.yaml.

Yeah, that makes total sense to me. If I used GitLab more actively, I could see adopting something similar.

If you customize the path at which the file is found, my initial thought is that it makes sense for the check-gitlab-ci pre-commit hook to need to be parametrized extra, e.g.

repos:
  - repo: https://github.com/python-jsonschema/check-jsonschema
    rev: 0.33.0
    hooks:
      # match any YAML files in .gitlab/ ending in '-ci'
      - id: check-gitlab-ci
        files: ^\.gitlab/.*-ci\.(yaml|yml)$

This PR is changing the default rule to match on .gitlab-ci.yaml (in the repo root), which is fine but doesn't seem like it has a strong rationale as the only exceptional case if .gitlab/* is also interesting.

I looked at schemastore, and they have some very permissive globs for gitlab-ci. Perhaps the correct solution is to follow their rule, which is to accept \.gitlab-ci\.(yaml|yml) anywhere in the repo, not just the root.

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.

GitLab CI Hook ignores .yaml files
3 participants