- Issue created by @longwave
- Merge request !304Swap to @gitlab-formatters/stylelint-formatter-gitlab. → (Merged) created by longwave
- 🇬🇧United Kingdom longwave UK
Works if I run the same commands locally, unsure how else to test.
- 🇬🇧United Kingdom jonathan1055
You say "this breaks the Stylelint formatter" but not every stylelint contrib job is broken. I guess it depends on what problems are reported.
Testing in experience_builder can be done using either a modified .gitlab-ci.yml or by running a pipeline manually and entering the values in the form. See https://project.pages.drupalcode.org/gitlab_templates/info/testing-mrs/
- 🇬🇧United Kingdom longwave UK
I think it will only break MRs that run against core 11.x where Stylelint was upgraded, this change has yet to land in 10.4.x.
- 🇬🇧United Kingdom jonathan1055
Maybe if you are running against 11.x dev? but the default gitlab templates use the stable core releases, and it is fine on 11.0.9 - because that is still using stylelint 15 - see https://git.drupalcode.org/issue/scheduler-3445052/-/jobs/3639614
We stopped testing against the dev core releases a few months ago, specifically to avoid this problem. So contrib jobs are not affected yet. Is the experience_builder pipeline running with a custom core version using -dev? Or maybe you are explictly upgrading to styleint 16?
- 🇬🇧United Kingdom jonathan1055
I have just looked and I can see you have pinned your gitlab templates release to
ref: 1.5.x-latest
. That was before we made the switch to using stable releases. - 🇬🇧United Kingdom longwave UK
Yeah, I just found out/remembered that Experience Builder is pinned to v1.5 of the templates, we need to upgrade in 📌 CI: update to 1.6.3 of the GitLab CI Template Active . Not sure if we are doing anything else on top to force use of 11.x.
But this issue will presumably hit other projects as soon as they start testing against 11.1.0, which is due this week.
- 🇪🇸Spain fjgarlin
Thanks for raising the issue and the MR. My question is whether we can merge this anyway.
Job in a downstream pipeline: https://git.drupalcode.org/project/decoupled_pages/-/jobs/3644529
My main question is whether we can just merge this, regardless of the Drupal version that it's running against. It's a formatted output applied to stylelint. Will it work with previous versions of stylelint? The above run seems to have worked, but there are no stylelint errors.
I think we can try/test the MR in another project, force some errors, and see what happens.
- 🇬🇧United Kingdom jonathan1055
@longwave I'd be happy to test this MR in experience_builder. I would use a separate branch in that issue fork, if you are ok with this idea?
- 🇬🇧United Kingdom longwave UK
@jonathan1055 The XB case is slightly more complicated by the fact we are still on v1.5 of the templates. I opened 📌 CI: update to 1.6.3 of the GitLab CI Template Active to solve that first, which is now green except for Stylelint. I then opened 📌 Fix CI for Stylelint 16 Active which is the changes from that MR plus a pointer to this MR to test the Stylelint fix, but the composer step fails and I'm not sure why.
- 🇬🇧United Kingdom longwave UK
You can see this job succeeding over at https://git.drupalcode.org/project/experience_builder/-/jobs/3648786
And failing with two deliberate mistakes added to the CSS at https://git.drupalcode.org/project/experience_builder/-/jobs/3649253
The CSS errors are correctly reported back in the pipeline "Code Quality" tab at https://git.drupalcode.org/project/experience_builder/-/pipelines/364499...
- 🇪🇸Spain fjgarlin
I somehow missed the notification for this. It needed rebasing, which I did (and I needed to revert a commit along the way).
Downstream pipelines: https://git.drupalcode.org/project/gitlab_templates/-/pipelines/370943
- 🇪🇸Spain fjgarlin
The code looks good to me and all downstream pipelines work well. We'd just need to test it in a project where the "current" is D10.
- 🇬🇧United Kingdom jonathan1055
sobki_profile_bootstrap → is pinned to
DRUPAL_CORE: "10.3.10"
(I knew I had seen this somewhere recently, so searched back through 'my issues' history)
https://git.drupalcode.org/project/sobki_profile_bootstrap/-/blob/10.0.x...I will ask over there if we can test this MR.
- 🇬🇧United Kingdom jonathan1055
@grimreaper is happy for us to test so I created a new branch on 📌 Fix CI Active and the pipeline to test MR303 is https://git.drupalcode.org/issue/sobki_profile_bootstrap-3436955/-/pipel...
The core version is 10.3 and it runs Stylelint version 15.11.0 and stylelint passes green, so I will introduce an error to force the formatter to be used. - 🇬🇧United Kingdom jonathan1055
Now with two forced errors
sobki_profile_bootstrap-3436955/-/pipelines/371348
The problems are reported as expected, they show in the 'quality' tab, and there is no error relating to the formatter, so this looks good. - 🇪🇸Spain fjgarlin
Thanks for the test. It's great and it works, but I think the output of the job can be improved.
Right now we have:
$ $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --config $CI_PROJECT_DIR/$_WEB_ROOT/core/.stylelintrc.json ./**/*.css --custom-formatter=@gitlab-formatters/stylelint-formatter-gitlab --output-file=$CI_PROJECT_DIR/gl-codequality.json $_STYLELINT_EXTRA [{"type":"issue","check_name":"length-zero-no-unit","description":"Unexpected unit (length-zero-no-unit)","content":{"body":"Error found in length-zero-no-unit. See https://stylelint.io/user-guide/rules/length-zero-no-unit for more details."},"categories":["Style"],"location":{"path":"modules/sobki_admin/assets/css/tabs.css","lines":{"begin":2,"end":2},"positions":{"begin":{"line":2,"column":18},"end":{"line":2,"column":20}}},"severity":"major","fingerprint":"f0019a3a5b3ffaedd4ab6fe3f08a1439"},{"type":"issue","check_name":"value-keyword-case","description":"Expected \"NO-REPEAT\" to be \"no-repeat\" (value-keyword-case)","content":{"body":"Error found in value-keyword-case. See https://stylelint.io/user-guide/rules/value-keyword-case for more details."},"categories":["Style"],"location":{"path":"modules/sobki_admin/assets/css/tabs.css","lines":{"begin":18,"end":18},"positions":{"begin":{"line":18,"column":47},"end":{"line":18,"column":48}}},"severity":"major","fingerprint":"a104c38322af0b689ac191cbd22f4639"}]
Whereas before we were capturing that output into a file and therefore there was no output:
$ $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --formatter verbose --config $CI_PROJECT_DIR/$_WEB_ROOT/core/.stylelintrc.json ./**/*.css --color --custom-formatter $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/stylelint-junit-formatter $_STYLELINT_EXTRA > $CI_PROJECT_DIR/junit.xml
So I wonder if we can make it not output anything? We can dump the output to "/dev/null" or to a file that we just ignore, as long as the artifact is correctly generated.
- 🇬🇧United Kingdom longwave UK
It seems that the output is written to stderr (not stdout) as well as the specified
--output-file
. This doesn't seem to be configurable that I can find.We could add
2>/dev/null
to hide the output but I wonder if that risks also hiding real error messages? - 🇬🇧United Kingdom jonathan1055
Could the output be wrapped in a collapsible section, like we do in show-environment-variables ? Probably not, but worth asking.
- 🇪🇸Spain fjgarlin
https://docs.gitlab.com/ee/ci/jobs/job_logs.html#custom-collapsible-sect...
That might be a good compromise. We can run the last command inside the collapsible section.
- 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium
Is this why this job is failing? https://git.drupalcode.org/project/group/-/jobs/3758589
- 🇪🇸Spain fjgarlin
It's due to a core update that shipped into 11.1.0. This issue should solve it, and see the related as well 🐛 Stylelint jobs are failing due to upstream updates Active
- 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium
Awesome, thanks for confirming.
- 🇪🇸Spain fjgarlin
I added the last run of stylelint in a collapsible section. Ready for review again.
- 🇬🇧United Kingdom longwave UK
I think an error has been introduced in the "show environment variables" section?
- 🇪🇸Spain fjgarlin
My bad. Probably a multicursor edit without noticing. Back to Needs review.
We can see it collapsed in here: https://git.drupalcode.org/project/keycdn/-/jobs/3759045
- 🇬🇧United Kingdom longwave UK
The collapsed output looks good to me - will have to remember we can do this for other jobs!
- 🇬🇧United Kingdom jonathan1055
Also re-tested with actual forced errors, so that the collapsed section contains something. LGTM & RTBC+1
https://git.drupalcode.org/issue/sobki_profile_bootstrap-3436955/-/pipel... -
fjgarlin →
committed 7e2f9f0a on main authored by
longwave →
Issue #3492697 by longwave, fjgarlin, jonathan1055: Update Stylelint...
-
fjgarlin →
committed 7e2f9f0a on main authored by
longwave →
- 🇪🇸Spain fjgarlin
Thanks all! Merged. As soon as we get the cspell issue ( 📌 Add new dictionary to cater for common words not in core dictionaries Active ) in, I'll do a new release and make it the default.