Commit Graph

170 Commits

Author SHA1 Message Date
Guilherme Gallo
e5105a8852 ci: Add some unit tests for the duration field
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Vignesh Raman <vignesh.raman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34478>
2025-04-15 13:04:11 +00:00
Juan A. Suarez Romero
dd3cad2201 ci: include duration in the CustomLogger
Include the difference between start and end times, so it is easy to
check how much time it took.

This can be used for things like ensuring the test phase is under 10
minutes, as suggested in the documentation.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Vignesh Raman <vignesh.raman@collabora.com>
Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34478>
2025-04-15 13:04:11 +00:00
Guilherme Gallo
b3b1e120a1 ci/update_tag: fix linter errors
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33863>
2025-03-12 20:04:20 +00:00
Guilherme Gallo
82073f7be3 ci/bin: update_tag: improve tag load
Replace global path variables with ProjectPaths dataclass
- Add explicit file existence check before loading YAML
- Enhance tag retrieval by checking environment variables first
- Add logging for better debugging of tag selection process
- Remove redundant file existence check in main function
- Improve error handling for missing conditional tags file

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33863>
2025-03-12 20:04:20 +00:00
Guilherme Gallo
5798f5d05f Revert "ci: setup-test-env: Prefer functions over aliases"
This reverts commit 1cc2c738bb

We originally changed some aliases into functions so scripts could use
them without needing to be sourced, keeping the environment cleaner.

However, this broke `x_off`, which is supposed to stop debug logs
(xtrace output) from showing in the console. The function version still
triggered xtrace before disabling it, while the alias correctly
redirected the logs to `/dev/null`.

It also fixes the `bin/ci/update_tag.py` script to be able to reuse the
aliases via double sourcing the setup-test-env.sh and the respective
build script.

Reported-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33863>
2025-03-12 20:04:20 +00:00
Guilherme Gallo
47659ddf70 ci: Simplify LAVA farm detection
Refactor the LAVA farm detection to use a simpler environment
variable-based approach:
- Remove the complex regex-based farm detection
- Replace LavaFarm enum with a simple string-based farm identification
- Update related tests and job definition logic
- Remove hypothesis testing dependency

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33888>
2025-03-08 02:45:02 +00:00
Guilherme Gallo
f13b95ad5c ci: add support for structural tagging
Make structural tagging functions available for both test and build
scripts.

Introduces the update_tag.sh helper for listing, checking, and updating
deterministic tags.

Also adds the ci_tag_build_time_check and ci_tag_test_time_check
functions to validate tags during build and test phases, ensuring
consistent component versioning.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33421>
2025-02-28 01:33:34 +00:00
Eric Engestrom
8364782222 docs: update gitlab docs urls
GitLab finally dropped the split between "docs for paid users" and
"docs for free users", and in the process re-shuffled some things.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33694>
2025-02-23 00:31:59 +01:00
Leonard Göhrs
db2a10150f ci/lava: update lavacli from version 1.5.2 to 2.2.0
The lavacli version 1.5.2 has been released in December 2022.
Use the most recent version 2.2.0, released in October 2023, instead.

Notable changes since 1.5.2:

  - Authentication tokens are now stripped from exceptions when HTTP
    requests fail. (1.6)

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33266>
2025-01-29 22:45:53 +00:00
Valentine Burley
a0de5e7d02 ci: Fix trace update script reading GitLab token from default location
Update the trace update script to use get_token_from_default_dir for
reading the GitLab token from the default location (~/.config/gitlab-token),
fixing the script and aligning it with our other tools.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33061>
2025-01-17 02:13:05 +00:00
Deborah Brouwer
3c441191d9 ci: pipeline_message: reset empty errors
Currently marge will ignore an error message if it is just the word
"error" without any further information. However, if she never finds a
more informative message, then she will just print that meaningless
error message.

Instead of an empty error message, just leave the message blank.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32773>
2025-01-07 05:08:10 +00:00
Deborah Brouwer
011a867fbe ci: pipeline_message: parse fatal messages
Currently marge only parses a failed job log for error messages, which can
cause her to miss fatal messages.

Example:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32557#note_2696196
https://gitlab.freedesktop.org/mesa/mesa/-/pipelines/1327177

If a `fatal` message is in the error log, add it to the pipeline message.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32773>
2025-01-07 05:08:09 +00:00
Deborah Brouwer
3bcb29cfcc ci: pipeline_message: ignore generated errors
Currently marge does not ignore the word `generated` when she is searching
the logs for a relevant error message. So, marge's comments on a failed
pipeline say something unhelpful like "errors generated"

Example:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32687#note_2706792
https://gitlab.freedesktop.org/mesa/mesa/-/pipelines/1332129

Ignore the word `generated` so marge will provide more useful comments.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32773>
2025-01-07 05:08:09 +00:00
Deborah Brouwer
6dc094decd ci: pipeline_message: ignore harmless build logs
Currently marge gets confused when parsing a build log and mistakes
innocuous lines that have the word "error" in them as actual issues.

Example:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31093#note_2705442
https://gitlab.freedesktop.org/mesa/mesa/-/pipelines/1331453

Ignore lines with the word `error` in them that are not actual issues,
so that marge can provide more useful comments.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32773>
2025-01-07 05:08:09 +00:00
Deborah Brouwer
2a477f7df2 ci: pipeline_message: ignore error_type errors
Currently marge only ignores `error_type` when the type is None.
But other error_types are equally uninteresting e.g. `error_type: Jobs`.

Example:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32677#note_2711470
https://gitlab.freedesktop.org/mesa/mesa/-/pipelines/1333563

Ignore the phrase `error_type` so marge will provide more useful comments.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32773>
2025-01-07 05:08:09 +00:00
Deborah Brouwer
6ad2abc661 ci: pipeline_message: add test to parse error logs
If marge doesn't find deqp-runner results or trace errors, she will parse
a failed job log for error messages. The parsing ignores certain phrases
in an attempt to find more relevant errors.

Add a test to check marge's error log parsing to make sure that we don't
create regressions when adding new phrases to ignore.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32773>
2025-01-07 05:08:09 +00:00
Deborah Brouwer
5707083c8c ci: update_traces_checksum: fix E501 line too long
Currently the update_traces_checksum script prints a label verification
request with a line that is 167 characters long.

Split the long line to make it more readable. Update the flake8
configuration to enforce a maximum line length of 159 characters to ensure
consistency.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32602>
2024-12-23 20:47:16 +00:00
Deborah Brouwer
7994a3b17a ci: add .flake8 linting to ci scripts and tests
Currently the ci scripts and tests don't have any linting checks. Add
.flake8 linting to start adding some consistency to the scripts. Ignore
most of the existing errors until they can be addressed on an individual
basis.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32602>
2024-12-23 20:47:16 +00:00
Deborah Brouwer
6331de400b ci: update token retrieval method for gantt charts
When the gantt chart service was first implemented, the read_token()
function would attempt to read from the default token file if the token
argument was missing.

Now it's necessary to call a separate function to look in the default
token file, so if the token argument is not provided, expressly call
get_token_from_default_dir().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
0366eebe3e ci: add pytests for the gantt chart scripts
Add some initial pytests to test new options and to prevent future
regressions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
fd7423b38e ci: add --ci-timeout option for gantt scripts
The gantt charts have a vertical line indicating the time when marge-bot
stops waiting for CI to finish. Currently the ci-timeout is hard-coded at
60 minutes. But marge-bot's timeout is configurable, so allow this value
to be configured as well.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
55f452530a ci: gantt chart: include in-progress jobs
If a job is still running when the gantt chart is generated, the job's
phases won't be represented as a bar on the chart.

To show these jobs on the gantt chart, introduce a new phase "In-Progress"
to capture the current status of these jobs.  Rename the "Running" phase
as "Time spent running" to emphasize that the running phase is complete.

This provides a more complete picture of the pipeline jobs when CI times
out.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
45ef1221a3 ci: post gantt: ignore pipeline_summary message
The gantt chart script currently expect the pipeline url to be the last
line of marge-bot's comment on a failed pipeline. The pipeline summary
hook now adds additional information that was preventing the gantt chart
script from finding the pipeline url.

Change the regex for finding the pipeline url to account for pipeline
summary comments.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
4ae2105fcb ci: post gantt: add pipeline-id to gantt filename
Add a pipeline-id to the gantt filename so that the filename is unique.
Reduce the additional info provided in the gantt comments since the tool
is now more familiar to developers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
127a8aa9c3 ci: post gantt: add --project-id option
Currently the gantt chart script will post a comment to any project that
uses the default marge bot user id. Although the gantt chart is flexible
enough to work for any project, restrict it to mesa/mesa by default. Add
the --project-id option to add a custom project or list of projects to
analyze.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
db62fa626b ci: post gantt: add --marge-user-id option
The gantt chart currently hard-codes the marge user id, but since the
script can be used for any marge-bot user, add an option to specify the
marge-bot user id. If no option is specified, the default marge-bot user
id is still used.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
1404fb5481 ci: make the gantt scripts available as modules
Instead of running the gantt scripts only from the command line, make
them available as modules also. This allows the scripts to be imported for
testing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
cb74034517 ci: add some static typing to the gantt scripts
Add some static typing where possible so that tools like mypy can be used
to avoid any future code errors.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
9671de71a3 ci: post gantt: use logging instead of print
Replace the print statements with logging to take advantage of the
built-in logging formatting and levels.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32637>
2024-12-19 16:56:30 -08:00
Deborah Brouwer
caa6ccd7d6 ci: move pipeline_summary tool to .marge/hooks
Move the tool to summarize a failed pipeline to a generic .marge/hooks
directory. This will allow the fdo-bots repo to handle all marge hooks in
a consistent way across repositories that use this service.

Add a symlink to the bin/ci directory so that the pipeline summary tool
can still be run locally as well.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32413>
2024-12-02 19:22:59 -08:00
Deborah Brouwer
4c8ff06449 ci/pipeline_message: add unit tests for tool
Add initial unit tests for pipeline_summary.py

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32151>
2024-11-22 19:42:32 +00:00
Deborah Brouwer
76648a60bb ci: add a tool to summarize a failed pipeline
pipeline_summary.py generates a markdown summary of the reasons why a
gitlab pipeline failed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32151>
2024-11-22 19:42:32 +00:00
Guilherme Gallo
f4301626cd ci/lava: Uprev freezegun
The former version was presenting some bugs running fixtures in parallel
testing.
With the new version, we need to change the side effects on mocks a
little bit and fix a start time to make the tests reproducible.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32163>
2024-11-21 04:10:52 +00:00
Daniel Stone
9f21e90a0c ci: Make token parsing more robust
Start by finding our known prefix, stripping only that off, then
validating that the rest of the data makes sense. This fixes certain
tokens which were erroneously getting rejected.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31270>
2024-09-20 11:03:50 +00:00
Daniel Stone
4ad94366c3 ci: Add Python requirements include
Make it so we can install everything we need with just
pip3 -r bin/ci/test/requirements.txt.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31151>
2024-09-12 18:17:52 +00:00
Daniel Stone
cc4db4bc36 ci: Run pytest once for both LAVA and bin/ci
There's no need for these to be totally separate, and also for the LAVA
tests to have been disabled for months.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30978>
2024-09-09 16:27:07 +00:00
Daniel Stone
eae6e122ab ci/lava: Fix path to structured logger
Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30978>
2024-09-09 16:27:07 +00:00
Mike Blumenkrantz
1e17f49baf ci: add --pipeline-url to trace update script
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31070>
2024-09-07 12:15:35 +00:00
Mike Blumenkrantz
f944c18fad ci: fix trace update script
this was broken by various things

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31070>
2024-09-07 12:15:35 +00:00
Daniel Stone
2a20cdfb31 ci/run_n_monitor: Add --dry-run argument
This will just print out the target jobs and their dependencies, then
exit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30784>
2024-08-22 15:35:19 +00:00
Daniel Stone
ad5f4d0270 ci/run_n_monitor: Remove --force-manual
Now that we can exclude by stages instead, we don't need --force-manual.
Having mandatory arguments which also do the wrong thing is not great.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30784>
2024-08-22 15:35:19 +00:00
Daniel Stone
99cd56a684 ci/run_n_monitor: Add --exclude-stage filtering
Add an argument to ci_run_n_monitor specifying certain stages to be
excluded from consideration, defaulting to the one with post-merge and
performance jobs. This allows, e.g., to run all Panfrost pre-merge jobs:
./ci_run_n_monitor.py --target 'panfrost.*'

or to run all Freedreno pre-merge jobs:
./ci_run_n_monitor.py --target '.*' --include-stage freedreno

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30784>
2024-08-22 15:35:19 +00:00
Daniel Stone
3ffe733214 ci/run_n_monitor: Add --include-stage argument
Add basic filtering by stages, starting with stage inclusion.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30784>
2024-08-22 15:35:18 +00:00
Guilherme Gallo
ae15b656ef bin/ci: crnm: Use frozen set for statuses
Let's be defensive and use `frozenset` from Python to avoid changing
global variables during the runtime (or any static part of code).

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30526>
2024-08-07 17:25:46 +00:00
Guilherme Gallo
24d64102fe bin/ci: crnm: Don't overwrite the global sets
The skip_follow_statuses variable, used to check if we need to stay
monitoring the pipeline instead of jumping to the target job traces, is
based on COMPLETED_STATUSES set. But, in Python, we do shallow copies by
default, and changes on skip_follow_statuses reflected on
COMPLETED_STATUSES, which was making manual dependencies stop playing
when --force-manual was not given.

Fixes: 84d401aebf0832741716f947dd7e2e9aac1221ac

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30526>
2024-08-07 17:25:46 +00:00
Guilherme Gallo
0acc31a001 bin/ci: crnm: Reduce trace cluttering
Some recurrent messages are only cluttering the ci_run_n_monitor's logs,
so let's use the easily provided @cache decorator to print stuff that
the user will only needs to see once.

Also removes some junk that can happen during the pipeline monitoring
loop, like the "----" line break, and newlines.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30361>
2024-07-29 18:04:21 +00:00
Guilherme Gallo
ff18d1ec23 bin/ci: crnm: Fix pipeline monitoring skipping
We stop monitoring pipeline changes when we find out that the target job
is already running, or is in a complete state.

But when we `--force-manual` we should consider that the job is not
complete and we should iterate a little more in the monitor pipeline
stage until it gets ready for trace following.

Closes: #11552

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30361>
2024-07-29 18:04:21 +00:00
Guilherme Gallo
3975366a88 bin/ci: crnm: Deal with created status
Jobs that we want to run can get the `created` status when its
dependencies are still running.

So let's gather this information and ensure that we will wait these jobs
to reach the `manual` or `running` status before jumping to monitor
target jobs trace.

Closes: #11517

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30361>
2024-07-29 18:04:21 +00:00
Eric Engestrom
1f70af7e9f bin/ci: update python-gitlab to 4.x
Quite a few fixes that we want were in the 4.x releases, so let's bump it.

See the list of breaking changes here:
https://python-gitlab.readthedocs.io/en/stable/changelog.html#v4-0-0-2023-10-17

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30019>
2024-07-29 10:08:01 +00:00
Eric Engestrom
2c6e8b2dd5 Revert "bin/ci_run_n_monitor: explain that the 'Universal Recycling symbol' ♲ emoji means these jobs were cancelled"
This reverts commit 032d4a20f9.

The `if not to_cancel: return` was a red herring as what actually matters
is the job status, which is checked in each cancel_job() call, so we
can't know in advance whether anything will be cancelled, so let's just
drop this text explanation.

In the meantime we've also improved the emoji next to cancelled jobs, so
let's hope there is no longer any need to explain what this long list of
job names means.

Fixes: 032d4a20f9 ("bin/ci_run_n_monitor: explain that the 'Universal Recycling symbol' ♲ emoji means these jobs were cancelled")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30265>
2024-07-19 16:03:24 +00:00