Skip to content

GitLab CI .artifacts.reports.annotations is not supported #439

@dmytro-golovchenko-luminartech

Description

Issue:

Hook check-gitlab-ci is not able to handle .artifacts.reports.annotations because it is missing the schema

Explanation

  1. GitLab doc is supporting it, see: https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsannotations
  2. check-gitlab-ci is using schema from https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json that is missing it

Steps to reproduce:

  1. Create new git repo:
mkdir test-gitlab; cd test-gitlab; git init .
  1. Setup check-gitlab-ci in pre-commit config. Create .pre-commit-config.yaml with a content below:
default_stages: [commit]
default_install_hook_types: [pre-commit, prepare-commit-msg]

repos:
  - repo: https://github.com/python-jsonschema/check-jsonschema
    rev: 0.28.4
    hooks:
      - id: check-gitlab-ci
        files: ^.*\.gitlab
  1. Commit it
git add .pre-commit-config.yaml
git commit -a -m 'Add .pre-commit-config.yaml'
  1. Install pre-commit:
pre-commit install
  1. Add dummy GitLab job definition in .gitlab-ci.yml:
foo:
  stage: build
  tags:
    - bar
  script:
    - echo "test"
  artifacts:
    reports:
      annotations: upload_report.json
  1. Try to commit changes in .gitlab-ci.yml, would get error like below:
git add .gitlab-ci.yml
git commit .gitlab-ci.yml -m 'Add .gitlab-ci.yml'

Output:

Validate GitLab CI config................................................Failed
- hook id: check-gitlab-ci
- exit code: 1

Schema validation errors were encountered.
  .gitlab-ci.yml::$.foo.artifacts.reports: Additional properties are not allowed ('annotations' was unexpected)

Reference

Filed issue on gitlab site: https://gitlab.com/gitlab-org/gitlab/-/issues/465876

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions