GitHub user dosubot[bot] added a comment to the discussion: Unable to fetch jenkins scopes which are nested inside some folder
<!-- Answer --> To fetch Jenkins jobs that are nested inside a folder using the remote scopes API, you can use the `GetAllJobs` function from the `incubator-devlake` repository. This function is designed to recursively retrieve all jobs, including those within nested folders. Here's a brief overview of how it works: - The `GetAllJobs` function takes an `apiClient`, a `path` representing the folder path, a `beforename` for constructing full job names, a `pageSize`, and a `callback` function to process each job. - It calls the `GetJobs` function to fetch jobs from the specified path. - For each job, it checks if there are nested jobs (`job.Jobs != nil`). If so, it recursively calls `GetAllJobs` to fetch jobs within that folder, appending the folder name to the path. - The `callback` function processes each job, with a boolean `isPath` indicating whether the job is a folder. Make sure to pass the correct `path` representing the folder path where the jobs are nested. The `GetAllJobs` function will handle the recursive fetching of jobs within nested folders <sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/jenkins/api/remote_api.go)</sup><sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/jenkins/api/jobs_test.go)</sup><sup>[[3]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/jenkins/api/jobs.go)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/f831361b-f5ac-45b7-bcb7-ee9681b2a95d?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/f831361b-f5ac-45b7-bcb7-ee9681b2a95d?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/f831361b-f5ac-45b7-bcb7-ee9681b2a95d?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/f831361b-f5ac-45b7-bcb7-ee9681b2a95d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f831361b-f5ac-45b7-bcb7-ee9681b2a95d?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/f831361b-f5ac-45b7-bcb7-ee9681b2a95d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f831361b-f5ac-45b7-bcb7-ee9681b2a95d?feedback_type=other)</sup> GitHub link: https://github.com/apache/incubator-devlake/discussions/8419#discussioncomment-13010548 ---- This is an automatically sent email for dev@devlake.apache.org. To unsubscribe, please send an email to: dev-unsubscr...@devlake.apache.org