[Debian-salsa-ci] Salsa CI stats
Iñaki Malerba
ina at malerba.space
Fri Sep 27 10:20:38 BST 2024
Hey Otto!
On Wed, Sep 25, 2024 at 04:46:01PM -0700, Otto Kekäläinen wrote:
> Hi!
>
> Hopefully Iñaki is around to reply as he did something similar years ago...
>
> Now with all the recent extra effort put the n both improving and promoting
> Salsa and Salsa CI, it would be satisfying and informative to be able to
> look at stats about Salsa CI adoption, how many pipelines run, what
> pipelines run most frequently, at what rate do they pass/fail, what
> settings are most popular etc.
>
> Maybe we could re-introduce some http api call into the pipeline which
> could send some stats when jobs run?
>
> What do you think would be the best approach on doing stats?
>
> Otto
Last time I did this research I just used codesearch.debian.net, but at
that time the only way we had to configure the project was adding the
file in the repo, so I searched for our includes on projects.
Now that it's possible to directly point at the file from the project's
config, I'd suggest using the Graphql API for quering this. Graphql
would let us both know if the project is using our file directy or fetch
the content of it's own gitlab ci configuration.
The following query works for getting the configs:
```
query getSalsaCI($afterCursor: String) {
projects(first: 100, after: $afterCursor) {
nodes {
name
fullPath
ciConfigPathOrDefault
}
pageInfo {
endCursor
hasNextPage
}
}
}
```
Use your favourite language for handling the pagination :) You can test
it on salsa.debian.org/-/graphql-explorer
With a small modification we can also fetch the files' content:
```
query getSalsaCI($afterCursor: String) {
projects(first: 100, after: $afterCursor) {
nodes {
name
fullPath
ciConfigPathOrDefault
repository {
blobs(paths: [".gitlab-ci.yml", "debian/salsa-ci.yml"]) {
nodes {
rawBlob
}
}
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
```
As far as I know it's not possible to use 'subqueries' in graphql
to use the value of ciConfigPathOrDefault in the blob's path, so maybe
this needs to be split in two queries to only fetch the ones that point
to local files in the repo.
Hope this helps ! :)
> --
> Debian-salsa-ci mailing list
> Debian-salsa-ci at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-salsa-ci
More information about the Debian-salsa-ci
mailing list