Skip to content

feat: suport detached pipelines

This MR implements a new feature to support detached pipelines. Before this change, we would only ask for pipelines for the current branch. After this change, we'll first try to see whether the branch has got an open MR and if it does, we'll try to get detached pipeline for that MR, we use the standard branch pipeline as a fallback if there isn't detached pipeline.

The following code snippet explains the whole feature:

export async function fetchPipelineAndMrForCurrentBranch(
  workspaceFolder: string,
): Promise<{
  pipeline: RestPipeline | null;
  mr: RestIssuable | null;
}> {
  const mr = await fetchOpenMergeRequestForCurrentBranch(workspaceFolder);
  if (mr) {
    const pipeline = await fetchLastPipelineForMr(mr);
    if (pipeline) return { mr, pipeline };
  }
  const pipeline = await fetchLastPipelineForCurrentBranch(workspaceFolder);
  return { mr, pipeline };
}

This MR consists of atomic commits that have clear descriptions. I recommend reviewing it commit-by-commit. This MR is not meant to be squashed on merge.

before after
Extension_Development_Host_-__gitlab-ci_yml___gitlab-vscode-extension-TEST open-pipeline

Related to #228 (closed)

Edited by Tomas Vik (OOO back on 2025-01-02)

Merge request reports

Loading