Commit Graph

33 Commits

Author SHA1 Message Date
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
Sergi Blanch Torne
5873b3ac14 ci: run_n_monitor, sort by name when listing jobs
The job loops, w/o and explicit sort, are sorted by the job id. As they produce
logs, humans could feel an improvement by sorting by name.

Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29444>
2024-07-11 08:28:31 +00:00
Eric Engestrom
656e329fa2 ci_run_n_monitor: fix handling of optional jobs again
Looks like a recent rework broke this again, so let's add the existence check back.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27874>
2024-02-29 14:11:32 +00:00
Eric Engestrom
716ed7d62a gitlab_gql: print error returned by server in --print-merged-yaml
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27535>
2024-02-09 08:01:20 +00:00
Guilherme Gallo
708a26c607 bin/ci: Move get_token_from_default_dir to common
Moved the `get_token_from_default_dir` method to a common module for
shared use between `gitlab_gql.py` and `ci_run_n_monitor.py`. This
migration facilitates better code organization and potential future
reuse.

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
Eric Engestrom
759b68bf66 bin/gitlab_gql: print merged yaml as yaml instead of a python dict
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26074>
2023-12-14 12:06:39 +00:00
Eric Engestrom
db6541a41a bin/gitlab_gql: fix --print-merged-yaml when --rev != HEAD
Reading the local root config file and then asking gitlab to evaluate it
in the context of some other version will cause issues if they are not
identical.

Instead, the local document should be a simple include of whatever is
the root config file at that commit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26074>
2023-12-14 12:06:39 +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
Eric Engestrom
1cb3c349ff bin/gitlab_gql: give a better name to the --print-job-manifest argument value than PRINT_JOB_MANIFEST
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26143>
2023-11-13 20:03:44 +00:00
Eric Engestrom
22961fc45a bin/gitlab_gql: deduplicate fetch_merged_yaml() logic between print branches
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26143>
2023-11-13 20:03:44 +00:00
Eric Engestrom
ef63cc6017 bin/gitlab_gql: rename get_job_final_definition() to print_...() since that's what it actually does
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26143>
2023-11-13 20:03:44 +00:00
Eric Engestrom
c6ef161bc1 bin/gitlab_gql: only allow a single --print-* argument per invocation
Printing multiple things as the same time is not really usable, so let's
be explicit and only allow one at a time, which allows a few cleanups in
the code.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26143>
2023-11-13 20:03:44 +00:00
Eric Engestrom
f4f4d80096 bin/gitlab_gql: only get the pipeline when a pipeline is needed
Otherwise, options like --print-merged-yaml are broken when their
commit's push didn't create a pipeline.

Fixes: b87e092489 ("ci/bin: Fix gitlab_gql methods that uses needs DAG")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26142>
2023-11-11 06:19:44 +00:00
Eric Engestrom
656afd8ede bin/gitlab_gql: fix command in example
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26141>
2023-11-10 10:37:07 +00:00
Eric Engestrom
2cf031155b gitlab_gql: make --rev optional, defaulting to HEAD
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26073>
2023-11-10 10:05:46 +00:00
Eric Engestrom
cc37af8fbc bin/gitlab_gql: resolve sha locally to be able to use things like HEAD
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26073>
2023-11-10 10:05:46 +00:00
Guilherme Gallo
e74238af42 ci/bin: Fix mypy errors in gitlab_gql.py
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
b87e092489 ci/bin: Fix gitlab_gql methods that uses needs DAG
Some gitlab_gql.py features like `--print-dag` were affected by recent
changes. Update those functions with the refactored data.

Fixes: c7b67d8619
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
664e6addea ci/bin: gql: Implement pagination
Make query support pagination by supplying the paginated key.

In the following toy example, the paginated key is:
["levels", "cars"]

```graphql
query vehicle_store($location: ID!) {
  levels {
     cars {
        pageInfo {
          hasNextPage
          endCursor
        }
     ...
     }
  }
}
```

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
c4b8c03012 ci/bin: gql: Log the caching errors
When using cache and it fails, log the errors, clear the cache and retry
the query bypassing the cache

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
aa2586b315 ci/bin: gql: make the query cache optional
Make the caching optional, as it can fail in some complex queries where
the transport middleware uses non-pickle-able objects.

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
609b4bfef8 ci/bin: Replace AIOHTTPTransport with RequestsHTTPTransport
For some reason AIOHTTPTransport started to use MultiDict after doing
some adjustments in the GraphQL query, which made `filecache` fail
because MultiDict object are not pickle-able.

Changing the transport strategy from AIOHTTPTransport to
RequestsHTTPTransport, which dropped one requirement. We aren't doing
async anyway, all the calls were sync before.

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
ba4f6e87c7 ci/gitlab_gql: stop re-compiling regex now that all users pre-compile it
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26070>
2023-11-07 06:08:44 +00:00
Eric Engestrom
a5cb331c64 gitlab_gql: strip newline at the end of the token file
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26075>
2023-11-07 06:06:22 +00:00
Guilherme Gallo
969ede4521 ci/bin: Refactor create_job_needs_dag
The function is getting too big, let's add comments, docstrings to the
most important function, new type hints and extract methods from it to
make it easier to read.

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
Guilherme Gallo
4e4743ec0a ci/bin: Do not forget to add early-stage dependencies
In Mesa MR pipelines, we have the sanity job. This job is not an
explicit need for any one job, because only jobs with `- needs: []`
ignores previous jobs. If no `needs` is specified, the job will wait
until all the jobs of earlier stages are finished before starting.

See additional details section at:
https://docs.gitlab.com/ee/ci/yaml/index.html#stage-post

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10032
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
Guilherme Gallo
701b035179 bin/ci: Ensure that all jobs have nodes in DAG
Some automatic jobs, such as 'rustfmt' and 'clang-format', are skipped
during the graph sweep because their parents are already included in the
node set.

This commit ensures all visited jobs are in DAG and fixes iteration
modification using deepcopy.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9376

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24176>
2023-07-17 15:34:11 +00:00
Daniel Stone
b3c6cd0886 ci: Respect $HTTP_PROXY for ci_run_n_monitor
We need to explicitly tell AIOHTTP that it's OK to take the HTTP proxy
from the environment.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23341>
2023-06-02 02:45:36 +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
Harri Nieminen
fd767a4517 bin: Fix typos
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22189>
2023-03-30 21:37:00 +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