lab ci lint and includes
Hi, seems to me that included yml (using "local" style) files are not found:
$ lab ci lint
2019/10/02 16:03:06 ci_lint.go:30: ci yaml invalid: Local file ci/lab_basic.yml does not have project!
.gitlab-ci.yml:
include:
- 'ci/lab_basic.yml'
stages:
- test
ci/lab_basic.yml
.base:
variables:
MYVAR: "some stupid string"
test includes:
extends: .base
stage: test
script:
- echo ${MYVAR}
image: registry.gitlab.com/project/gitlab-cli:latest
+1 I observed this behavior too.
I'm not sure if this is something we can support, the API at least only accepts the .gitlab-ci.yml contents and validates from there (essentially the same as the web version)
https://docs.gitlab.com/ee/api/lint.html
If anybody knows better I'd be interested to know. It'd be fairly involved, but in theory if lab were to follow the includes and prepend the file contents it should work about the same
I reproduced with another error message:
$ lab ci lint
2021/02/12 10:55:11 ci_lint.go:32: ci yaml invalid: POST https://my.private.gitlab.yoyo/api/v4/ci/lint: 401 {message: 401 Unauthorized}
(lab version: 0.19.0)
@MartinDelille I do not think this is the same issue. We have two inhouse gitlab-instances, one running 13.8.4, where I get above message even for projects without any includes and the other 13.7.6 where this still works fine. My guess would be, that this is https://gitlab.com/gitlab-org/gitlab/-/issues/321290
Indeed. This is fixed: I know have the include issue described in the first place.
While inspecting the auth issue I detected that there are two API resources for linting. One which is project specific and one stand alone one. I guess lab must use the project specific one (https://docs.gitlab.com/ee/api/lint.html#validate-a-ci-yaml-configuration-with-a-namespace), so GitLab is able to deduce the local include. (Including stuff via URL or the project/ref/file syntax works fine with stand alone resource)