Commit 63dbf507 authored by Stanislav Lashmanov's avatar Stanislav Lashmanov Committed by Tomas Vik (OOO back on 2026-08-31)
Browse files

fix: use project id from the project in repository

parent 58e1b8d5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ const getJobs = async (
): Promise<RestJob[]> => {
  if (!pipeline) return [];
  try {
    return await getGitLabService(projectInRepository).getJobsForPipeline(pipeline);
    const projectId = projectInRepository.project.restId;
    return await getGitLabService(projectInRepository).getJobsForPipeline(pipeline.id, projectId);
  } catch (e) {
    log.error(new UserFriendlyError('Failed to fetch jobs for pipeline.', e));
    return [];
+2 −2
Original line number Diff line number Diff line
@@ -907,9 +907,9 @@ export class GitLabService {
    }
  }

  async getJobsForPipeline(pipeline: RestPipeline): Promise<RestJob[]> {
  async getJobsForPipeline(pipelineId: number, projectId: number): Promise<RestJob[]> {
    return this.fetch(
      `/projects/${pipeline.project_id}/pipelines/${pipeline.id}/jobs`,
      `/projects/${projectId}/pipelines/${pipelineId}/jobs`,
      {},
      'jobs for pipeline',
    );
+5 −1
Original line number Diff line number Diff line
@@ -72,7 +72,11 @@ interface RestPipeline {
    | 'preparing';
  updated_at: string;
  id: number;
  project_id: number;
  /**
   * The project_id is only present in GitLab version 13.10 and later.
   * https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/553#note_882220438
   */
  project_id?: number;
  web_url: string;
}