feat: add more fields for Pipeline,Job and Project types

Summary

Adds new display fields and nested object rendering for Pipeline, Job, and Project sources, with the goal of giving more info to the data analyst. I don't think these are must-haves for GA, but still worth adding.

Pipeline

  • Nested objects: user (single user), stages (connection with name/status), commit (id, shortId, title, authorName, webUrl)
  • New scalars: refPath, commitPath

Job

  • Nested object: pipeline (id, iid, path, status via ... on Pipeline inline fragment)
  • New scalars: browseArtifactsPath, playPath, retryPath, commitPath, refPath, queuedDuration, exitCode, scheduledAt, createdByTag, canPlayJob

Project

  • New scalars: avatarUrl

Other improvements

  • normalize_node_ids now automatically normalizes GIDs in nested objects (recursive)

How to test

1. Pipeline nested fields (user, stages, commit)

GLQL='type = Pipeline and project = "gitlab-org/gitlab-shell" and status = success' && \
FIELDS='ref, status, user, stages, commit' && \
echo "q = Glql.compile('${GLQL}', { fields: '${FIELDS}' })[\"output\"]; puts '== GLQL Query =='; puts '${GLQL}'; puts; puts '== Generated GraphQL =='; puts q; File.write('/tmp/glql_query.json', { query: q, variables: { limit: 2 } }.to_json); exit" \
| bundle exec rake console && \
echo "== GitLab API Response ==" && \
curl -s -X POST https://gitlab.com/api/graphql -H "Content-Type: application/json" -d @/tmp/glql_query.json | python3 -m json.tool
Result
{
    "data": {
        "project": {
            "pipelines": {
                "nodes": [
                    {
                        "id": "gid://gitlab/Ci::Pipeline/2426306844",
                        "iid": "5910",
                        "path": "/gitlab-org/gitlab-shell/-/pipelines/2426306844",
                        "status": "SUCCESS",
                        "ref": "refs/workloads/8b410debfe6",
                        "user": {
                            "id": "gid://gitlab/User/32742185",
                            "avatarUrl": "/uploads/-/system/user/avatar/32742185/fix-pipeline-flow.png",
                            "username": "duo-fix-ci-cd-pipeline-gitlab-org",
                            "name": "Duo Fix CI/CD Pipeline",
                            "webUrl": "https://gitlab.com/duo-fix-ci-cd-pipeline-gitlab-org"
                        },
                        "stages": {
                            "nodes": [
                                { "name": "build", "status": "success" }
                            ]
                        },
                        "commit": {
                            "id": "gid://gitlab/Commit/257edc2f1e33f1bac5919143c62b28255b2a34d6",
                            "shortId": "257edc2f",
                            "title": "Move logging field validator to Makefile",
                            "authorName": "Matias Alvarez",
                            "webUrl": "https://gitlab.com/gitlab-org/gitlab-shell/-/commit/257edc2f1e33f1bac5919143c62b28255b2a34d6"
                        }
                    }
                ]
            }
        }
    }
}

2. Pipeline new scalars

GLQL='type = Pipeline and project = "gitlab-org/gitlab-shell" and status = success' && \
FIELDS='ref, refPath, commitPath' && \
echo "q = Glql.compile('${GLQL}', { fields: '${FIELDS}' })[\"output\"]; puts '== GLQL Query =='; puts '${GLQL}'; puts; puts '== Generated GraphQL =='; puts q; File.write('/tmp/glql_query.json', { query: q, variables: { limit: 2 } }.to_json); exit" \
| bundle exec rake console && \
echo "== GitLab API Response ==" && \
curl -s -X POST https://gitlab.com/api/graphql -H "Content-Type: application/json" -d @/tmp/glql_query.json | python3 -m json.tool
Result
{
    "data": {
        "project": {
            "pipelines": {
                "nodes": [
                    {
                        "id": "gid://gitlab/Ci::Pipeline/2426306844",
                        "iid": "5910",
                        "path": "/gitlab-org/gitlab-shell/-/pipelines/2426306844",
                        "status": "SUCCESS",
                        "ref": "refs/workloads/8b410debfe6",
                        "refPath": "refs/workloads/8b410debfe6",
                        "commitPath": "/gitlab-org/gitlab-shell/-/commit/257edc2f1e33f1bac5919143c62b28255b2a34d6"
                    }
                ]
            }
        }
    }
}

3. Job nested pipeline + new scalars

GLQL='type = Job and project = "gitlab-org/gitlab-shell" and status = success' && \
FIELDS='stage, pipeline, browseArtifactsPath, refPath, canPlayJob' && \
echo "q = Glql.compile('${GLQL}', { fields: '${FIELDS}' })[\"output\"]; puts '== GLQL Query =='; puts '${GLQL}'; puts; puts '== Generated GraphQL =='; puts q; File.write('/tmp/glql_query.json', { query: q, variables: { limit: 2 } }.to_json); exit" \
| bundle exec rake console && \
echo "== GitLab API Response ==" && \
curl -s -X POST https://gitlab.com/api/graphql -H "Content-Type: application/json" -d @/tmp/glql_query.json | python3 -m json.tool
Result
{
    "data": {
        "project": {
            "jobs": {
                "nodes": [
                    {
                        "id": "gid://gitlab/Ci::Build/13763381271",
                        "name": "workload",
                        "status": "SUCCESS",
                        "webPath": "/gitlab-org/gitlab-shell/-/jobs/13763381271",
                        "stage": { "name": "build" },
                        "pipeline": {
                            "id": "gid://gitlab/Ci::Pipeline/2426306844",
                            "iid": "5910",
                            "path": "/gitlab-org/gitlab-shell/-/pipelines/2426306844",
                            "status": "SUCCESS"
                        },
                        "browseArtifactsPath": "/gitlab-org/gitlab-shell/-/jobs/13763381271/artifacts/browse",
                        "refPath": "/gitlab-org/gitlab-shell/-/commits/refs/workloads/8b410debfe6",
                        "canPlayJob": false
                    }
                ]
            }
        }
    }
}

4. Job additional scalars

GLQL='type = Job and project = "gitlab-org/gitlab-shell" and status = success' && \
FIELDS='stage, exitCode, scheduledAt, createdByTag, queuedDuration, playPath, retryPath, commitPath' && \
echo "q = Glql.compile('${GLQL}', { fields: '${FIELDS}' })[\"output\"]; puts '== GLQL Query =='; puts '${GLQL}'; puts; puts '== Generated GraphQL =='; puts q; File.write('/tmp/glql_query.json', { query: q, variables: { limit: 2 } }.to_json); exit" \
| bundle exec rake console && \
echo "== GitLab API Response ==" && \
curl -s -X POST https://gitlab.com/api/graphql -H "Content-Type: application/json" -d @/tmp/glql_query.json | python3 -m json.tool
Result
{
    "data": {
        "project": {
            "jobs": {
                "nodes": [
                    {
                        "id": "gid://gitlab/Ci::Build/13763381271",
                        "name": "workload",
                        "status": "SUCCESS",
                        "webPath": "/gitlab-org/gitlab-shell/-/jobs/13763381271",
                        "stage": { "name": "build" },
                        "exitCode": null,
                        "scheduledAt": null,
                        "createdByTag": false,
                        "queuedDuration": 0.151316,
                        "playPath": "/gitlab-org/gitlab-shell/-/jobs/13763381271/play",
                        "retryPath": "/gitlab-org/gitlab-shell/-/jobs/13763381271/retry",
                        "commitPath": "/gitlab-org/gitlab-shell/-/commit/257edc2f1e33f1bac5919143c62b28255b2a34d6"
                    }
                ]
            }
        }
    }
}

5. Project new scalars

GLQL='type = Project and namespace = "gitlab-org"' && \
FIELDS='name, avatarUrl' && \
echo "q = Glql.compile('${GLQL}', { fields: '${FIELDS}' })[\"output\"]; puts '== GLQL Query =='; puts '${GLQL}'; puts; puts '== Generated GraphQL =='; puts q; File.write('/tmp/glql_query.json', { query: q, variables: { limit: 2 } }.to_json); exit" \
| bundle exec rake console && \
echo "== GitLab API Response ==" && \
curl -s -X POST https://gitlab.com/api/graphql -H "Content-Type: application/json" -d @/tmp/glql_query.json | python3 -m json.tool
Result
{
    "data": {
        "namespace": {
            "projects": {
                "nodes": [
                    {
                        "id": "gid://gitlab/Project/80984258",
                        "fullPath": "gitlab-org/secure/tests/ifrenkel/dependency-resolution/dependency-resolution-gradle-fips-1775192527-deletion_scheduled-80984258",
                        "name": "dependency-resolution-gradle-fips-1775192527-deletion_scheduled-80984258",
                        "nameWithNamespace": "GitLab.org / Application Security Testing Stage / Tests / ifrenkel / dependency-resolution / dependency-resolution-gradle-fips-1775192527-deletion_scheduled-80984258",
                        "webUrl": "https://gitlab.com/gitlab-org/secure/tests/ifrenkel/dependency-resolution/dependency-resolution-gradle-fips-1775192527-deletion_scheduled-80984258",
                        "avatarUrl": null
                    }
                ]
            }
        }
    }
}

🤖 Generated with Claude Code

Edited by Daniele Rossetti

Merge request reports

Loading