Page MenuHomePhabricator

Add linting of research landing-page to gitlab CI
Closed, ResolvedPublic

Description

For the gerrit repo of the research landing-page, there was a linting step as part of the CI. Info:

When migrating from gerrit to gitlab, the blubber config and the linting files were included, but no job was added to the .gitlab-ci.yml file.

Details

ReferenceSource BranchDest BranchAuthorTitle
repos/sre/miscweb/research-landing-page!9add-test-job-cimasterjeltorun existing lint job in gitlab-ci
Customize query in GitLab

Event Timeline

fkaelin moved this task from Backlog to Support Needed on the Research board.
LSobanski moved this task from Incoming to Backlog on the collaboration-services board.

I think I managed to run the tests which where configured in the old Gerrit repo for jenkins:

DOCKER_BUILDKIT=1 docker build --target npm-run -f .pipeline/blubber.yaml .
docker run -it --entrypoint /bin/bash sha256:<hash>
somebody@a8392283616e:/srv/app$ cd html
somebody@a8392283616e:/srv/app/html$ npm install
somebody@a8392283616e:/srv/app/html$ npm test

> wikimedia-research-landing-page@0.1.0 test /srv/app/html
> grunt && npm run eslint

Running "stylelint:src" (stylelint) task
>> Linted 1 files without errors

Running "postcss:dist" (postcss) task
>> 1 processed stylesheet created.

Running "cssmin:target" (cssmin) task
>> 1 file created. 34.44 kB → 16.96 kB

Done.

> wikimedia-research-landing-page@0.1.0 eslint /srv/app/html
> eslint --max-warnings 0 --ext .js ./js/

Does the output look somehow familiar with the old CI config @fkaelin ? Unfortunately the logs for the old CI jobs are no longer available in Jenkins.

I'll try to put that into the .gitlab-ci.yml.

@Jelto Unfortunately I also don't know either how these logs looked, and I am not familiar with npm/js. Looking at the pipeline output, it says only 1 file was tested. But eslint is for javascript, and there is only a single js file in this project. From my perspective this is a good start, we can refine this as needed in the future.

@DDeSouza - do you have any more insight on this?

@dduvall or @dancy could you take a look at the MR? How can tests like npm test executed properly with .kokkuri:build-and-run-image?

I don't have familiarity with the repo before the migration but it looks like the test actions are working as expected. Current practices are a bit different but upgrading wouldn't be trivial.

There is a test job for the research-landing-page now: https://gitlab.wikimedia.org/repos/sre/miscweb/research-landing-page/-/jobs/168533

#18 npm test
#18 0.359 
#18 0.359 > wikimedia-research-landing-page@0.1.0 test /srv/app
#18 0.359 > npm run lint:grunt && npm run lint:js
#18 0.359 
#18 0.601 
#18 0.601 > wikimedia-research-landing-page@0.1.0 lint:grunt /srv/app
#18 0.601 > grunt --gruntfile html/Gruntfile.js
#18 0.601 
#18 1.317 Running "stylelint:src" (stylelint) task
#18 1.811 >> Linted 1 files without errors
#18 1.814 
#18 1.814 Running "postcss:dist" (postcss) task
#18 1.934 >> 1 processed stylesheet created.
#18 1.935 
#18 1.935 Running "cssmin:target" (cssmin) task
#18 2.042 >> 1 file created. 34.44 kB → 16.96 kB
#18 2.042 
#18 2.042 Done.
#18 2.302 
#18 2.302 > wikimedia-research-landing-page@0.1.0 lint:js /srv/app
#18 2.302 > eslint --max-warnings 0 --ext .js html/js
#18 2.302 
#18 DONE 2.9s

The job should contain the same commands as the old jenkins job. @DDeSouza also adeded a grunt command. My understanding and knowledge for testing static web apps is a bit limited here. So I guess that makes sense and I resolve the task optimistically. But feel free to reopen if something is missing.