Add json api endpoint that provides CI linting
What does this MR do?
Provides a json formatted API endpoint for CI linting.
Example Invalid Config Response
curl 'http://host.docker.internal:3000/root/retries/-/ci/lint.json' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' -H 'Upgrade-Insecure-Requests: 1' -H 'Origin: http://host.docker.internal:3000' -H 'Content-Type: application/x-www-form-urlencoded' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36' -H 'Referer: http://host.docker.internal:3000/root/retries/-/ci/lint' -H 'Accept-Language: en-US,en;q=0.9' -H 'Cookie: ' --compressed --insecure | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 219 100 71 100 148 268 560 --:--:-- --:--:-- --:--:-- 829
{
"config" : null,
"errors" : [
"Invalid configuration format"
],
"valid" : false
}
Example Valid Config Response
curl 'http://localhost:3000/root/when-always-with-no-workflow-rules-2/-/ci/lint.json' \
-H 'Connection: keep-alive' \
-H 'Cache-Control: max-age=0' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'Origin: http://localhost:3000' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Sec-Fetch-User: ?1' \
-H 'Sec-Fetch-Dest: document' \
-H 'Referer: http://localhost:3000/root/when-always-with-no-workflow-rules-2/-/ci/lint.json' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Cookie: ' \
--compressed | json_pp
{
"jobs" : [
{
"allow_failure" : false,
"except" : null,
"when" : "on_success",
"before_script" : [],
"stage" : "test",
"script" : [
"echo"
],
"only" : null,
"name" : "job",
"environment" : null,
"tag_list" : [],
"after_script" : []
}
],
"valid" : true,
"warnings" : [],
"errors" : []
}
See Issue: #196032 (closed)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team