提交 7b6f1bab 编写于 作者: T Tomas Vik

fix: use project_id from the pipeline instead of the workspace project

上级 fb75debb
......@@ -17,10 +17,6 @@ import { getInstanceUrl as getInstanceUrlUtil } from './utils/get_instance_url';
import { GitLabProject } from './gitlab/gitlab_project';
import { getExtensionConfiguration } from './utils/get_extension_configuration';
interface GitLabPipeline {
id: number;
}
export interface RestJob {
name: string;
// eslint-disable-next-line camelcase
......@@ -371,13 +367,10 @@ export async function fetchIssuables(params: CustomQuery, workspaceFolder: strin
return issuable.map(normalizeAvatarUrl(await getInstanceUrl()));
}
export async function fetchLastJobsForCurrentBranch(
pipeline: GitLabPipeline,
workspaceFolder: string,
) {
const project = await fetchCurrentPipelineProject(workspaceFolder);
if (project) {
const { response } = await fetch(`/projects/${project.restId}/pipelines/${pipeline.id}/jobs`);
export async function fetchLastJobsForCurrentBranch(pipeline: RestPipeline): Promise<RestJob[]> {
const { response } = await fetch(
`/projects/${pipeline.project_id}/pipelines/${pipeline.id}/jobs`,
);
let jobs: RestJob[] = response;
// Gitlab return multiple jobs if you retry the pipeline we filter to keep only the last
......@@ -392,9 +385,6 @@ export async function fetchLastJobsForCurrentBranch(
});
return jobs;
}
return null;
}
export async function fetchOpenMergeRequestForCurrentBranch(
......
......@@ -102,7 +102,7 @@ export class StatusBar {
if (status === 'running' || status === 'failed') {
try {
const jobs = await gitLabService.fetchLastJobsForCurrentBranch(pipeline, workspaceFolder!);
const jobs = await gitLabService.fetchLastJobsForCurrentBranch(pipeline);
if (jobs) {
statusText = createStatusTextFromJobs(jobs, status);
}
......
......@@ -66,5 +66,6 @@ export const pipeline: RestPipeline = {
status: 'success',
updated_at: '2021-02-12T12:06:17Z',
id: 123456,
project_id: 567890,
web_url: 'https://example.com/foo/bar/pipelines/46',
};
......@@ -59,5 +59,6 @@ interface RestPipeline {
status: 'running' | 'pending' | 'success' | 'failed' | 'canceled' | 'skipped';
updated_at: string;
id: number;
project_id: number;
web_url: string;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册