Skip to content

CI: Don't swallow exceptions when checking GraphQL types

Peter Leitzen requested to merge pl-grahpql-check into master

What does this MR do and why?

If the check script fails having a full stacktrace is beneficial for debugging purposes.

In case of an error both versions of the script exit with error code 1.

This MR also stores artifacts for graphql-verify to make debugging easier.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Refs gitlab-org/quality/engineering-productivity/master-broken-incidents#5321 (comment 1778604877)

How to set up and validate locally

$ echo "{}" > tmp/tests/graphql/gitlab_schema.json

$ node scripts/frontend/graphql_possible_types_extraction.js --check
/home/peter/devel/gitlab/gdk/gitlab/scripts/frontend/graphql_possible_types_extraction.js:15
    schema.data.__schema.types
                ^

TypeError: Cannot read properties of undefined (reading '__schema')
    at extractTypes (/home/peter/devel/gitlab/gdk/gitlab/scripts/frontend/graphql_possible_types_extraction.js:15:17)
    at main (/home/peter/devel/gitlab/gdk/gitlab/scripts/frontend/graphql_possible_types_extraction.js:32:25)

$ bundle exec rake gitlab:graphql:schema:dump
Schema IDL dumped into /home/peter/devel/gitlab/gdk/gitlab/tmp/tests/graphql/gitlab_schema.graphql
Schema JSON dumped into /home/peter/devel/gitlab/gdk/gitlab/tmp/tests/graphql/gitlab_schema.json


$ node scripts/frontend/graphql_possible_types_extraction.js --check
$ echo $?
0
Edited by Peter Leitzen

Merge request reports