Commit Graph

40 Commits

Author SHA1 Message Date
Eric Engestrom
5758a5d660 ci_run_n_monitor: add some types for gitlab objects
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27499>
2024-02-08 22:22:54 +00:00
Eric Engestrom
044c51b6bf ci_run_n_monitor: warn user if they forgot to push the branch
Only perform this check if they set `--rev HEAD` (or don't specify it);
let's assume if they select another commit, they know what they're
doing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26969>
2024-02-08 21:38:21 +00:00
Eric Engestrom
5d293f01cc ci_run_n_monitor: avoid spamming a ton of "new status: created" for all the jobs at the beginning
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27419>
2024-02-02 15:25:22 +00:00
Guilherme Gallo
8eabdb3909 bin/ci: Refactor read_token function
Make `read_token` utilize the `get_gitlab_pipeline_from_url` to reuse
code from `gitlab_gql.py`.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27206>
2024-01-26 00:37:05 -03:00
Guilherme Gallo
50fcea9c34 bin/ci: Propagate the token to GitlabGQL
Fix an issue in `ci_run_n_monitor.py` where the token was not
being correctly propagated to the GitlabGQL abstraction. This addresses
misbehavior in scenarios like running pipelines in a private fork,
ensuring proper functionality.

Also document `find_dependencies` function.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27206>
2024-01-26 00:37:03 -03:00
Eric Engestrom
6825c67c99 ci_run_n_monitor: allow passing multiple targets
When generating the list of targets from a script, being able to just
pass `--target "${list[@]}"` is very convenient.

The list of targets is simply converted to an "or" regex, matching any
of the `--target`s given.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27252>
2024-01-25 21:16:13 +00:00
Eric Engestrom
eeba409c54 ci_run_n_monitor: drop always-true condition
`--target` is mandatory.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27252>
2024-01-25 21:16:13 +00:00
Helen Koike
9e8cbc8e91 ci/ci_run_n_monitor: move get_gitlab_pipeline_from_url() to gitlab_common
Move this code to gitlab_common since it can be re-used by other
scripts.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25793>
2024-01-17 13:10:07 +00:00
Eric Engestrom
76be39ca6d ci_run_n_monitor: allow picking a pipeline by its MR
It picks the latest pipeline from the MR; if you want another pipeline,
use `--pipeline-url`.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26381>
2023-12-03 11:28:49 +00:00
Helen Koike
2999091287 ci/ci_run_n_monitor: abort when target gets skipped
when a target receives skipped state it is because some of the
dependencies failed, abort the script and print the reason

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26155>
2023-11-20 13:03:09 +00:00
Eric Engestrom
a5e20a5c31 ci_run_n_monitor: require user to add an explicit .* at the end if jobs like *-full are wanted
Most of the time, these jobs are not wanted, so let's make this a full
match instead of prefix match so that users only get what they ask for.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26066>
2023-11-17 08:12:31 +00:00
Guilherme Gallo
f8b8352022 ci/bin: Print a summary list of dependency and target jobs
We already print all the detected target jobs from regex and its
dependencies. But for more complex regexes the list can be cumbersome,
and an aggregate list of dependencies and targets can be more value, so
add these prints as well.

This is what looks like:

```
Running 10 dependency jobs:
 alpine/x86_64_lava_ssh_client, clang-format, debian-arm64,
 debian-testing, debian/arm64_build, debian/x86_64_build,
 debian/x86_64_build-base, kernel+rootfs_arm64, kernel+rootfs_x86_64,
 rustfmt

Running 15 target jobs:
 a618_gl 1/4, a660_gl 1/2, intel-tgl-skqp, iris-amly-egl, iris-apl-deqp
 1/3, iris-cml-deqp 1/4, iris-glk-deqp 1/2, iris-kbl-deqp 1/3,
 lima-mali450-deqp:arm64, lima-mali450-piglit:arm64 1/2,
 panfrost-g52-gl:arm64 1/3, panfrost-g72-gl:arm64 1/3,
 panfrost-t720-gles2:arm64, panfrost-t860-egl:arm64, zink-anv-tgl
```

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-08 02:18:17 +00:00
Guilherme Gallo
278fc1c22a ci/bin: gql: Improve queries for jobs/stages retrieval
Modify the GraphQL query used to fetch all jobs within a pipeline,
transitioning from fetching data via stage nodes to a direct job
retrieval approach.

The prior method was not paginated, potentially overloading the server
and complicating result parsing due to the structure of stage nodes. The
new approach simplifies data interpretation and handles job lists
exceeding 100 elements by implementing pagination with helper functions
to concatenate paginated results.

- Transitioned from extracting jobs from stage nodes to a direct query
  for all jobs in the pipeline, improving data readability and server
  performance.
- With the enhanced data clarity from the updated query, removed the
  Dag+JobMetadata tuple as it's now redundant. The refined query
  provides a more comprehensive job data including job name, stage, and
  dependencies.
- The previous graph query relied on a graph node that will (or should)
  be paginated anyway.

Closes: #10050
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-08 02:18:17 +00:00
Guilherme Gallo
46b033a9bf ci/bin: Fix find_dependency function calls
`find_dependency` signature changed, so we need to update their callings
correctly.

Fixes: 94655ff811

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25940>
2023-11-08 02:18:17 +00:00
Eric Engestrom
94655ff811 ci_run_n_monitor: compile target_jobs_regex only once
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26070>
2023-11-07 06:08:44 +00:00
Guilherme Gallo
c7b67d8619 ci/bin: Use iid instead of SHA in gitlab_gql
We were using sha to fetch the pipeline from GraphQL, but that leads to
wrong results when MR and branch pipelines exist. For example,
using pipeline-url as the MR pipeline:
- https://gitlab.freedesktop.org/gallo/mesa/-/pipelines/1017182
This would lead into the branch pipeline:
- https://gitlab.freedesktop.org/gallo/mesa/-/pipelines/1013189

Also simplify the GQL query, it had lots of unused data.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25858>
2023-10-27 00:36:48 +00:00
Eric Anholt
74315051a9 ci_run_n_monitor: Always resolve --rev arguments for looking up pipelines.
Otherwise you'd loop forever never finding it with --rev <paste from
gitlab UI> or --rev <branch name>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25824>
2023-10-25 01:48:18 +00:00
Helen Koike
663ad191ca ci/ci_run_n_monitor: print job duration time
If the job is running, it prints the elapsed time so far, if it finished
already, it prints the time it took.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25822>
2023-10-24 12:57:14 +00:00
Helen Koike
9f4f52f4f3 ci/ci_run_n_monitor: keep monitoring if a job is still running
When running multiple targets, the script was returning if any of the
targets failed.
But sometimes some of the targets are still running and we want to
monitor it until it finishes, even if some of the targets failed.

So check if any targeted jobs are in pending or running before deciding
to finish.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25826>
2023-10-22 09:30:56 +00:00
Eric Anholt
fb95f1d55c ci_run_n_monitor: Poll mesa/mesa and user/mesa for pipelines at the same time.
Now you don't fail if you're trying to test a mesa/mesa MR pipeline and
gitlab takes more than 10s to create it.  And you don't have to wait 10
seconds to get things started (aka see if your regex was right) if you're
testing a user/mesa fork pipeline.

Fixes: 941d92408e ("bin/ci_run_n_monitor: automatically pick MR pipelines when they exist")
Closes: #9894
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25810>
2023-10-20 08:23:24 +00:00
Eric Engestrom
d3e96aa02e ci_run_n_monitor: dependency jobs must always be started
Fixes: 6b49b477ac ("ci/ci_run_n_monitor: simplify enable/cancel logic in monitor_pipeline()")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25715>
2023-10-13 18:37:56 +00:00
Helen Koike
51521e1f9d ci/ci_run_n_monitor: limit repetitions on --stress
--stress options now receives the number of repetitions or -1 to behave
as before.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:58 +00:00
Helen Koike
57fa35f19c ci/ci_run_n_monitor: allow <user>/<project> in --project
Allow to monitor pipelines in any <user>/<project> on gitlab.fdo.

If developers want to monitor MR pipelines, they can run with
--project mesa/mesa to force it to be picked from mesa username.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:58 +00:00
Helen Koike
6b49b477ac ci/ci_run_n_monitor: simplify enable/cancel logic in monitor_pipeline()
leave to enable_job() and cancel_job() to do the right thing according
to the job status.

let target canceled jobs to be re-runned.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:58 +00:00
Helen Koike
17843ad7c6 ci/ci_run_n_monitor: merge enable_job with retry_job
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:58 +00:00
Helen Koike
90da4a6845 ci/ci_run_n_monitor: make --target mandatory
There is no point running without a target, just make it mandatory and
simplify the script.

Use ".*" to run all targets.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:58 +00:00
Helen Koike
633c08688b ci/ci_run_n_monitor: merge print_job_status_change with print_job_status
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:57 +00:00
Helen Koike
7f6c339740 ci/ci_run_n_monitor: simplify with defaultdict
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:57 +00:00
Helen Koike
f838499901 ci/ci_run_n_monitor: print stress test results per job
Since we can monitor multiple jobs, print the result of the stress test
per job name.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
2023-10-11 21:50:57 +00:00
Helen Koike
fa884141dc ci/ci_run_n_monitor: add docs for multiple targets
clarify how multiple targets can be used with the pipe character.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25472>
2023-09-29 09:50:53 -03:00
Eric Engestrom
7eabe9bb40 ci_run_n_monitor: add comment to explain "MR > fork" logic
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25186>
2023-09-12 18:37:40 +00:00
Eric Engestrom
941d92408e bin/ci_run_n_monitor: automatically pick MR pipelines when they exist
When an MR has been created, we usually want to run the jobs in the MR
pipeline so that reviewers see that things work as expected.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25153>
2023-09-12 17:42:34 +00:00
Eric Engestrom
8366d77e4c bin/ci_run_n_monitor: error out if both --project and --pipeline-url are passed
Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24937>
2023-08-29 19:27:22 +00:00
Helen Koike
67147a3c5c ci: add --project option to ci_run_n_monitor.py
Now that we have drm-ci, add --project, so the script can also be used
to linux (and any other projects).

Let the default to "mesa" so it can keep behaving as before when the
option is not given.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24912>
2023-08-29 16:54:31 +00:00
Eric Engestrom
42021b4d13 bin/ci_run_n_monitor: get git sha from pipeline if specified, instead of requiring --rev to match
Fixes: 9ce717ab31 ("ci_run_n_monitor: add ability to specify the pipeline to use, instead of auto-detecting it")
Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24366>
2023-07-28 13:10:41 +00:00
David Heidelberg
b3b883ca00 bin/ci: mention requirements.txt
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22078>
2023-05-28 15:19:42 +02:00
Eric Engestrom
9ce717ab31 ci_run_n_monitor: add ability to specify the pipeline to use, instead of auto-detecting it
The auto-detection code currently looks for a repo called "mesa" in the
current user's fork (ie. the user providing the api token), which is great for
the common use case, but sometimes needs to be able to be overridden, such as
when running a pipeline in another fork than one's own, when working with
someone else in their fork.

Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23230>
2023-05-26 00:12:03 +00:00
David Heidelberg
26dc5b3737 ci/ci_run_n_monitor: while we usually disable many jobs, print them inline
Saving scrolling time...

Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21713>
2023-03-06 01:51:59 +01:00
Eric Engestrom
a6e487e367 ci_run_n_monitor.py: automatically retry on transient errors
This morning a GitLab update was deployed, leading to a few moments
where the API returned an error.

python-gitlab is actually able to handle a number of those and retry
automatically, so let's enable that:
https://python-gitlab.readthedocs.io/en/stable/api-usage-advanced.html#transient-errors

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20094>
2023-01-06 19:28:55 +00:00
David Heidelberg
a04720dc1c ci: move the CI handling scripts into bin/ci
Any change in .gitlab-ci/ directory triggers an entire CI run,
which is unnecessary for just changing the developers' scripts.

Added symlink to `.gitlab-ci/bin` to keep original invocation compatibility.

Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20371>
2022-12-19 16:36:19 +01:00