artifacts

package
v1.0.38778-pre Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package artifacts implements the business logic for fetching and downloading CircleCI job artifacts, at either the job or pipeline level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, client Client, entries []Entry, dir string) error

Download fetches each entry's artifact and writes it under dir, preserving the artifact's Path as the relative file path.

Types

type Client

type Client interface {
	GetPipelineWorkflows(ctx context.Context, pipelineID string) ([]apiclient.PipelineWorkflowSummary, error)
	GetWorkflowJobs(ctx context.Context, workflowID string) ([]apiclient.WorkflowJob, error)
	GetJobArtifacts(ctx context.Context, projectSlug string, jobNumber int64) ([]apiclient.Artifact, error)
	DownloadArtifact(ctx context.Context, artifactURL string, dst io.Writer) error
}

Client is the subset of apiclient.Client methods we need.

type Entry

type Entry struct {
	JobName   string `json:"job_name"`
	JobNumber int64  `json:"job_number"`
	Path      string `json:"path"`
	URL       string `json:"url"`
	NodeIndex int    `json:"node_index"`
}

Entry is a single artifact with the job context it came from.

func ForJob

func ForJob(ctx context.Context, client Client, projectSlug string, jobNumber int64) ([]Entry, error)

ForJob fetches artifacts for a single job number within a project.

func ForPipeline

func ForPipeline(ctx context.Context, client Client, pipelineID string) ([]Entry, error)

ForPipeline fetches all artifacts across every job in the pipeline. Jobs with no artifacts are silently skipped.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL