Commit 78801abd authored by Tim Ryan's avatar Tim Ryan Committed by Tomas Vik (OOO back on 2026-08-31)
Browse files

feat: Downstream Pipeline Jobs

parent a5e56243
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,3 +34,4 @@
- Lennard Sprong [@X_Sheep](https://gitlab.com/X_Sheep)
- Florian Dageförde [@dagefoerde.florian](https://gitlab.com/dagefoerde.florian)
- Elian Cordoba [@ElianCordoba](https://gitlab.com/ElianCordoba)
- Tim Ryan [@TimRyanUBS](https://gitlab.com/TimRyanUBS)
+2 −2
Original line number Diff line number Diff line
@@ -63,10 +63,10 @@ export class JobLogCache {
    if (exists) this.#onDidChangeEmitter.fire(jobId);
  }

  startRefreshing(jobId: number) {
  startRefreshing(projectId: number, jobId: number) {
    const item = this.#storage[jobId];
    if (!item || item.eTag === null || item.refresher) return;
    item.refresher = new JobLogRefresher(this, jobId);
    item.refresher = new JobLogRefresher(this, projectId, jobId);
  }

  stopRefreshing(jobId: number) {
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ jest.mock('../gitlab/get_gitlab_service');
jest.mock('../gitlab/gitlab_project_repository');

describe('JobLogContentProvider', () => {
  const uri = toJobLogUri('/repo', 123);
  const uri = toJobLogUri('/repo', 123, 123);

  beforeEach(async () => {
    const rawTrace = await fs.readFile(
+6 −3
Original line number Diff line number Diff line
@@ -165,7 +165,10 @@ export class JobLogContentProvider implements vscode.TextDocumentContentProvider
    });
    undecoratedJobLogEditors.forEach(e => {
      doNotAwait(this.#decorateJobTextEditor(e));
      jobLogCache.startRefreshing(fromJobLogUri(e.document.uri).job);
      jobLogCache.startRefreshing(
        fromJobLogUri(e.document.uri).projectId,
        fromJobLogUri(e.document.uri).job,
      );
    });
  }

@@ -224,13 +227,13 @@ export class JobLogContentProvider implements vscode.TextDocumentContentProvider
  }

  async provideTextDocumentContent(uri: vscode.Uri): Promise<string | undefined> {
    const { repositoryRoot, job: id } = fromJobLogUri(uri);
    const { repositoryRoot, projectId, job: id } = fromJobLogUri(uri);

    if (!jobLogCache.get(id)) {
      const projectInRepository = getProjectRepository().getProjectOrFail(repositoryRoot);
      const gitlabService = getGitLabService(projectInRepository);

      const response = await gitlabService.getJobTrace(projectInRepository.project, id);
      const response = await gitlabService.getJobTrace(projectInRepository.project, projectId, id);
      assert(response);
      const { rawTrace, eTag } = response;

+2 −2
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ describe('JobLogRefresher', () => {

    jobLogCache.setForRunning('root', 123, 'raw trace', 'eTag');

    jobLogCache.startRefreshing(123);
    jobLogCache.startRefreshing(123, 123);

    jest.advanceTimersToNextTimer();

@@ -50,7 +50,7 @@ describe('JobLogRefresher', () => {

  it('aborts when cache is missing', async () => {
    // eslint-disable-next-line no-new
    new JobLogRefresher(jobLogCache, 123);
    new JobLogRefresher(jobLogCache, 123, 123);

    expect(jest.getTimerCount()).toBe(1);

Loading