Im trying to get list of all the pipelines and all the jobs from Gitlab that ran in a day using graphql API, Here is the query I have
query = """
query($projectPath: ID!, $pipelineCursor: String, $jobCursor: String) {
project(fullPath: $projectPath) {
pipelines(updatedAfter:"2023-09-06T00:00:00Z",updatedBefore:"2023-09-06T23:59:59Z",status:SUCCESS,first: 100,after: $pipelineCursor,source:"pipeline") {
pageInfo{
hasNextPage
endCursor
}
count
nodes {
jobs(first: 100, after: $jobCursor) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id
status
name
}
}
id
createdAt
startedAt
updatedAt
project {
id
webUrl
}
ref
status
createdAt
startedAt
updatedAt
duration
queuedDuration
user {
username
}
configSource
}
}
}
}
"""
response = requests.post(
api_url,
json={
"query": query,
"variables": {
"projectPath": project_path,
"pipelineCursor": pipeline_cursor,
"jobCursor": job_cursor,
}
},
headers=headers
)
Im able to get list of all the pipelines but only getting 100 jobs per pipeline. Can anyone please take a look at my query and suggest me what needs to be changed.
Note: pipelineCursor loop is working as expected but jobCursor is not looping through all the pages
New contributor