Documentation
¶
Index ¶
- func New(client forge.Client, token string) ci.Driver
- type Driver
- func (d *Driver) AssertNoHarnessAgentArtifact(ctx context.Context, owner, repo, agent string, after time.Time) error
- func (d *Driver) AssertNoWorkflow(ctx context.Context, owner, repo, workflowFile string, after time.Time) error
- func (d *Driver) CountHarnessDispatches(ctx context.Context, owner, repo, agent string, after time.Time) (int, error)
- func (d *Driver) DownloadAgentArtifactsAfter(ctx context.Context, owner, repo, agent string, after time.Time, ...) error
- func (d *Driver) DownloadAgentArtifactsFromRun(ctx context.Context, owner, repo string, runID int, agent string, ...) error
- func (d *Driver) DownloadArtifacts(ctx context.Context, owner, repo string, runID int, destDir string) error
- func (d *Driver) DownloadNamedArtifactAfter(ctx context.Context, owner, repo, artifactName string, after time.Time, ...) error
- func (d *Driver) DownloadNamedArtifactFromRun(ctx context.Context, owner, repo string, runID int, artifactName string, ...) error
- func (d *Driver) FindCompletedWorkflowRun(ctx context.Context, owner, repo, workflowFile string, after time.Time) (*forge.WorkflowRun, error)
- func (d *Driver) GetRunLogs(ctx context.Context, owner, repo string, runID int) (string, error)
- func (d *Driver) ListRecentRuns(ctx context.Context, owner, repo string, limit int) ([]forge.WorkflowRun, error)
- func (d *Driver) WaitForFailedHarnessAgent(ctx context.Context, owner, repo, agent string, after time.Time) (*forge.WorkflowRun, error)
- func (d *Driver) WaitForHarnessAgent(ctx context.Context, owner, repo, agent string, after time.Time) (*forge.WorkflowRun, error)
- func (d *Driver) WaitForHarnessAgentRound(ctx context.Context, owner, repo, agent string, after time.Time, ...) (*forge.WorkflowRun, error)
- func (d *Driver) WaitForWorkflow(ctx context.Context, owner, repo, workflowFile string, after time.Time, ...) (*forge.WorkflowRun, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Driver ¶
Driver implements ci.Driver against GitLab CI pipelines.
Concurrency: the Driver is an immutable wrapper around forge.Client (which is itself safe for concurrent use) and holds no unsynchronized mutable fields (Client and Token are both set at construction and never modified). Sharing a single Driver across goroutines via World.Clone is safe by design. TestConcurrentAccess exercises the real driver under -race with a FakeClient.
func (*Driver) AssertNoHarnessAgentArtifact ¶
func (d *Driver) AssertNoHarnessAgentArtifact(ctx context.Context, owner, repo, agent string, after time.Time) error
AssertNoHarnessAgentArtifact asserts that the named agent's harness job did not run after the trigger time.
func (*Driver) AssertNoWorkflow ¶
func (d *Driver) AssertNoWorkflow(ctx context.Context, owner, repo, workflowFile string, after time.Time) error
AssertNoWorkflow asserts that no pipeline was created after the trigger time within a settling window.
func (*Driver) CountHarnessDispatches ¶
func (d *Driver) CountHarnessDispatches(ctx context.Context, owner, repo, agent string, after time.Time) (int, error)
CountHarnessDispatches returns the number of pipelines that scheduled the agent's harness job after the trigger time. Cancelled/skipped jobs are excluded. The count settles before returning.
func (*Driver) DownloadAgentArtifactsAfter ¶ added in v0.55.0
func (d *Driver) DownloadAgentArtifactsAfter(ctx context.Context, owner, repo, agent string, after time.Time, destDir string) error
DownloadAgentArtifactsAfter polls for a harness artifact from agent and downloads it from the selected pipeline.
func (*Driver) DownloadAgentArtifactsFromRun ¶ added in v0.55.0
func (d *Driver) DownloadAgentArtifactsFromRun(ctx context.Context, owner, repo string, runID int, agent string, destDir string) error
DownloadAgentArtifactsFromRun downloads the artifacts produced by agent from the given pipeline. GitLab uses the harness job name as the artifact name, so this translates the logical agent to that job name.
func (*Driver) DownloadArtifacts ¶
func (d *Driver) DownloadArtifacts(ctx context.Context, owner, repo string, runID int, destDir string) error
DownloadArtifacts downloads all artifacts from a pipeline's jobs.
func (*Driver) DownloadNamedArtifactAfter ¶
func (d *Driver) DownloadNamedArtifactAfter(ctx context.Context, owner, repo, artifactName string, after time.Time, destDir string) error
DownloadNamedArtifactAfter polls for a repository-level artifact whose physical name exactly matches artifactName, then downloads it.
func (*Driver) DownloadNamedArtifactFromRun ¶
func (d *Driver) DownloadNamedArtifactFromRun(ctx context.Context, owner, repo string, runID int, artifactName string, destDir string) error
DownloadNamedArtifactFromRun downloads an artifact whose physical name exactly matches artifactName.
func (*Driver) FindCompletedWorkflowRun ¶
func (d *Driver) FindCompletedWorkflowRun(ctx context.Context, owner, repo, workflowFile string, after time.Time) (*forge.WorkflowRun, error)
FindCompletedWorkflowRun finds a completed successful pipeline after the given time.
func (*Driver) GetRunLogs ¶
GetRunLogs retrieves the concatenated logs for all jobs in a pipeline.
func (*Driver) ListRecentRuns ¶ added in v0.46.0
func (d *Driver) ListRecentRuns(ctx context.Context, owner, repo string, limit int) ([]forge.WorkflowRun, error)
ListRecentRuns implements ci.RunLister.
func (*Driver) WaitForFailedHarnessAgent ¶
func (d *Driver) WaitForFailedHarnessAgent(ctx context.Context, owner, repo, agent string, after time.Time) (*forge.WorkflowRun, error)
WaitForFailedHarnessAgent waits for the named agent's harness run to complete with a terminal failure conclusion. It errors out early when the run completes successfully instead.
func (*Driver) WaitForHarnessAgent ¶
func (d *Driver) WaitForHarnessAgent(ctx context.Context, owner, repo, agent string, after time.Time) (*forge.WorkflowRun, error)
WaitForHarnessAgent waits for a successful harness-run pipeline job for the named agent, using artifact-first detection with job-name fallback. On a fail-fast the failed pipeline is returned together with the error, so the caller can save its logs before the scenario's repository is deleted.
func (*Driver) WaitForHarnessAgentRound ¶ added in v0.45.0
func (d *Driver) WaitForHarnessAgentRound(ctx context.Context, owner, repo, agent string, after time.Time, consumed map[int]bool) (*forge.WorkflowRun, error)
WaitForHarnessAgentRound is like WaitForHarnessAgent, but for scenarios where the same agent's harness is dispatched more than once (e.g. dummy-playback's review round, retried after fix). It selects the earliest eligible successful run whose ID is not in consumed instead of WaitForHarnessAgent's artifact-first "latest eligible run wins" selection, which would pick a later round's run when an earlier round's own completion is asserted only after the later round has also already finished (#7957).